Description
Assign one or more metrics to one or more tags.
The user will send an array of expressions that define the metrics he wants to assign the tags to.
Note: It can take up to 20 minutes until the metric tagging operation will be applied to the relevant metrics.
Important
- If a tag already exists then the tag will be removed from the metrics that previously matched the search expression; a tag will be added only to the metrics that match the current search expression.
- Tags should NOT contain the following characters :{ .SPACE}
Definition
POST https://api.anodot.com/api/v1/metrics/tags/assign-metrics-to-tags?token={token}
Headers
Content-type=application/json
Body
{
"expressions": [
{
"expression": [
{
"type": "property",
"key": "key1",
"value": "val1"
}
]
}
],
"tags": [
{
"key": "tag1",
"value": "tagval1"
},
{
"key": "tag2",
"value": "tagval2"
}
]
}
Argument / Definition
tag |
key: tag key name value: tag key value |
expressions |
Array of expressions, each expression can contain several metrics queries. type: the type of the search expression, can be of type [search] or [property] (recommended). key: the metric key name value: the metric key value |
Example Request
{
"expressions": [
{
"expression": [
{
"type": "property",
"key": "pos2",
"value": "jerusalem"
}
]
}
],
"tags": [
{
"key": "role",
"value": "bob"
},
{
"key": "role",
"value": "dod"
}
]
}
Example Response
In case of a validation error:
{
"validation": {
"passed": false,
"failures": [
{
"id": 6,
"message": "Tag value is empty."
}
]
},
"tags": []
}
In case of success:
{
"validation": {
"passed": true,
"failures": []
},
"tags": [
{
"id": "cd85e4ff18a66de54b80ab22d703e630",
"expressions": [
{
"expression": [
{
"type": "property",
"key": "pos2",
"value": "jerusalem"
}
]
}
],
"tag": {
"key": "role",
"value": "bob",
"metricTagRepresentation": "#role=bob"
}
},
{
"id": "a1eb605a8de93beffa70617b732dc4d4",
"expressions": [
{
"expression": [
{
"type": "property",
"key": "pos2",
"value": "jerusalem"
}
]
}
],
"tag": {
"key": "role",
"value": "dod",
"metricTagRepresentation": "#role=dod"
}
}
]
}