Tagging metrics enables you to enrich your metrics without the need to create greater granularity and cardinality in the metrics. In summary, this means that you can enrich your metrics without paying for more metrics.
This article introduces tags and how to work with them, and includes:
- Common use cases for tagging
- What you need to know about tags
- How to recognize tags in Anodot
- How to use tags
- Streaming metrics with tags
- Applying tags on metrics already in Anodot
Common use cases for tagging
- You have your customer KPIs as metrics and they include the organization as one of the dimensions. If you want each such metric to include the CSM or AE name, you can add them as a tag-based on mapping of the organization<->CSM mapping you hold.
- You have service / department codes as part of your metrics; the service codes can be mapped to human readable names which can be added as tags for easy handling of your metrics, anomalies and alerts.
- You have a dynamic environment, and services move from one data-center to another over time. You can add the current data-center as a tag and include it in the alert expressions so you will be alerted on the relevant data-center in real-time.
What you need to know about tags
- Tags do not change the metric ID, so you can change them without changing the metric itself. This is relevant for the following reasons:
- Anodot will not need to re-learn a new metric.
- Anodot will not bill you for a new metric.
- There are two separate methods to manage tags in Anodot, as described in the Streaming metrics with tags and Applying tags on metrics already in Anodot sections.
How to recognize tags in Anodot
Tags, like dimensions, are key-value pairs.
Tags look like a dimension name with a hash (#) before the name (for example: #CSM). As shown in the image below: originId is the tag key, SSSxkGmb4Mo0h is the tag value.
Example:
An example of a metric with a measure, dimensions, and tags, is listed below:
Measure: Cost
Dimensions: AWS service, region
Tags: Project, department
This information shows that we are monitoring the cost of AWS services in our regions. The cost information is also mapped, based on the project and department.
How to use tags
Tags are almost identical to dimensions, so you can:
- Use tags as filters by typing # in the Metric explorer. As you type, Anodot will show an auto-complete list of the existing tags.
- Use tags as function parameters, for example in “Group by” functions. This is relevant when you create composites, composite alerts and dashboard expressions.
- Use tags as alert variables, so you get the relevant tag value in your alert.
- Use tags for dynamically routing alerts.
- Tags are also used in Anodot’s correlation engine.
Streaming metrics with tags
When using data collectors, rename one of the columns in the Stream table step to start with ‘#’. In the image below, the owner column is set to be a tag.
Note: Only the column name needs to be prefixed with a ‘#’. The values themselves are streamed to Anodot as-is, and there is no need to prefix them with ‘#’.
Common practices when working with tags in streams
- Prefixing a column with # is typically done with a mapping table (lookup table), from a key/ID to a human value (such as service id mapped to service name mapping).
- If you are using Anodot’s agent, tagging should be configured in the pipeline configuration file. See an example from Anodot's Influx agent pipeline config file
[
{
"source": "test_influx",
"pipeline_id": "test_influx_file_full",
"measurement_name": "cpu_test",
"values": {"usage_active": "gauge", "usage_idle": "gauge"},
"units": {"usage_active": "sec", "usage_idle": "sec"},
"dimensions": {
"required": ["cpu", "host"],
"optional": ["zone"]
},
"target_type": "gauge",
"properties": {"key1": "value1", "key2": "value2", "key3": "value3"},
"tags": {"key1": ["value1"], "key2": ["value2"], "key3": ["value3"]},
"delay": "10m",
"interval": "300",
"filtering": "zone = 'GF'"
}
]
- If you are using REST API, note that the JSON structure should include tags in your metric posting.
- Tags that you add via collectors cannot be removed or updated using the tagging API.
Applying tags on metrics already in Anodot
There are scenarios where the streaming process is fixed and you cannot add tags as part of the streaming process, for whatever reason. In such cases, tagging can only be done on top of the metrics once they are in Anodot.
Examples for such cases might be:
1. Using Legacy code to stream metrics without the ability to change that code
2. Segregation of authorities in an organization, where one unit provides the integration mechanism and another unit needs to use the data "as-is" yet needs to enrich the metrics to add business context.
In these cases, you need to use the tagging API which is included in the Anodot API site.
The API does the following:
- Gets relevant metrics using a search expression.
- Adds / deletes tags for the metrics included in the search result.
See the Tagging use case example article for more details on the API usage.