Skip to content

Commit

Permalink
otel2influx: metrics name has prefix field__ covert to fields #310
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyliyao authored Feb 7, 2025
1 parent 099aaf5 commit fd0066f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion otel2influx/metrics_telegraf_prometheus_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ func (c *metricWriterTelegrafPrometheusV2) initMetricTagsAndTimestamp(dataPoint
tags = maps.Clone(tags)
dataPoint.Attributes().Range(func(k string, v pcommon.Value) bool {
if k != "" {
tags[k] = v.AsString()
if strings.HasPrefix(k, "field__") {
k = strings.TrimPrefix(k, "field__")
fields[k] = v
} else {
tags[k] = v.AsString()
}
}
return true
})
Expand Down

0 comments on commit fd0066f

Please sign in to comment.