Werk #18209: otel: Create metric for every data point
Component | Checks & agents | ||||
Title | otel: Create metric for every data point | ||||
Date | Jun 3, 2025 | ||||
Level | Trivial Change | ||||
Class | New Feature | ||||
Compatibility | Incompatible - Manual interaction might be required | ||||
Checkmk versions & editions |
|
Before, only one metric for the first data point with the name of the OpenTelemetry metric name was created in Checkmk.
Now, for every data point a metric is created. The name is generated from the OpenTelemetry metric name and the datapoint attributes following this logic:
- Alphabetically sorted
<key>_<value>
pairs of data point attributes, where leading namespaces are stripped from the key such that only unique keys remain - Concatenate these pairs with
__
as separator - If a rate is to be calculated for a metric (e.g. monotonic counters), add a
__per_sec
suffix - Replace special characters, which are not allowed in metric names in Checkmk, with
_
Please note, that because of this change metrics, which were previously created by the OpenTelemetry integration, will no longer be supplied with data. Instead, new metrics following this new naming convention will be created.
Example
Let this be an OpenTelemetry metric to be checked:
{
"name": "my.counter",
"unit": "1",
"description": "I am a Counter",
"sum": {
"aggregationTemporality": 1,
"isMonotonic": true,
"dataPoints": [
{
"asDouble": 5,
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"attributes": [
{
"key": "my.counter.name",
"value": {
"stringValue": "some value"
}
}
]
},
{
"asDouble": 5,
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"attributes": [
{
"key": "my.counter.attr",
"value": {
"stringValue": "some value"
}
}
]
},
{
"asDouble": 5,
"startTimeUnixNano": "1544712660300000000",
"timeUnixNano": "1544712660300000000",
"attributes": [
{
"key": "your.counter.attr",
"value": {
"stringValue": "some value"
}
}
]
}
]
}
}
This will result in three metrics:
- name_some_value__per_sec (i.e. the
my.counter
namespace was removed, becausename
is unique) - my_counter_attr_some_value__per_sec (i.e. the attribute key was not truncated as only the first namespace
my
makes it unique) - your_counter_attr_some_value__per_sec (i.e. the attribute key was not truncated as only the first namespace
your
makes it unique)