-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[collectd 6] Generate better names and labels for legacy metrics. #4197
Conversation
This changes `plugin_value_list_to_metric_family` to generate metric names that are more in line with OpenTelemetry's naming guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks OK. Have just small optimization suggestion(s).
No need for hierarchical labels, metric name being such is enough. |
…int()` call. Co-authored-by: Florian Forster <octo@collectd.org>
This breaks Prometheus integration. Dot is invalid in metric and label names. Double colon is also invalid for labels, but could be used as separator for metric names. See: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels EDIT: that issue was worked around in Prometheus plugin. |
Legacy metrics, i.e. metrics reported with the
value_list_t
data structure, need to be upgraded tometric_family_t
.The new code puts all metrics into the
collectd.v5
namespace. The metric family name is:collectd.v5.${plugin}.utilization
for metrics withtype
"percent".collectd.v5.${plugin}.io
for directional metrics ending in_octets
.collectd.v5.${type}.${data_source}
for metrics with more than one data source (except directional metrics).collectd.v5.${type}
for metrics with one data source.If the
hostname
field is set, it is translated into thehost.name
resource attribute. Otherwise resource attributes are omitted to trigger the default behavior (like an emptyhostname
field does).The labels depend on whether plugin instance, type instance, or both are set:
${plugin}=${plugin_instance}
,type=${type_instance}
${plugin}=${plugin_instance}
${plugin}=${type_instance}
plugin=${plugin}
This does a decent job of mapping metrics to the new schema, but I do wonder if we should simply put those fields into labels 1-to-1:
collectd.v5.plugin=${plugin}
,collectd.v5.plugin_instance=${plugin_instance}
,collectd.v5.type_instance=${type_instance}
. What do you think?Directional metrics are metrics with two data sources called "read" and "write", or "rx" and "tx". Despite having more than one data source, the data source name is added to a
direction
label instead of the metric family name.ChangeLog: collectd: The schema with which metrics are translated from v5 to v6 has been improved.