Tags

Tags are the most flexible way to partition targets into groups.

Target Tags

A target may have a number of associated tags. Most operations on targets can be filtered on matching tags. For instance when updating targets, can filter targets based on one or several tags with the --tags option.

As well as global and per-target contexts there is also per-tag context. This overrides anything defined in the global context.

For example, we want a group of targets to sample more aggressively. In the pipe's context there is a variable interval which has a default value of 15m. Assume the targets share the tag 'urgent', then it is easy to make them sample faster:

$ hotrod context tag urgent interval=2m

Pipe Tags

Since hotrod targets update can filter on tags, it is possible to do bulk operations like attaching pipes to groups of targets. But there is a cleaner method. The pipe itself may have associated tags:

name: sample
tags:
  - samplers
context:
  interval: 15m
input:
...

Pipes with tags will automatically attach to targets if there is a matching tag, so all targets with the tag 'samplers' will have the sample pipe enabled.

Bulk Upload of Targets and Targets

It can be tedious to add targets one-by-one using hotrod targets add, so there is a bulk option.

# targets.sls
Sites:
- name: test1
  bbox: 1
  tags: [active]
- name: test2
  bbox: 2
  tags: [active,fast]

Given this file we can populate some targets easily:

$ hotrod targets add-all targets.sls 
$ hotrod targets list
 name  | id | tags        | pipes | last seen 
-------+----+-------------+-------+-----------
 test1 | 1  | active      |       |  
 test2 | 2  | active fast |       | 

NOTE WELL This does not merge with existing targets and so can only be used for initial populating of targets and tags.