Skip to content

feat(influx2otel): add an option to set name separator - #341

Open
mchrome wants to merge 3 commits into
influxdata:mainfrom
mchrome:configurable-name-separator
Open

feat(influx2otel): add an option to set name separator#341
mchrome wants to merge 3 commits into
influxdata:mainfrom
mchrome:configurable-name-separator

Conversation

@mchrome

@mchrome mchrome commented Jun 8, 2026

Copy link
Copy Markdown

Adds nameSeparator field to LineProtocolToOtelMetrics and a new constructor with custom separator as an argument. This is needed in order to preserve metric names when switching from graphite output plugin to OTel output plugin in telegraf.

Fixes telegraf#18251

@mchrome
mchrome requested review from a team as code owners June 8, 2026 08:51
@mchrome
mchrome requested a review from helenosheaa June 8, 2026 08:51
@jacobmarble

Copy link
Copy Markdown
Contributor

Fixes telegraf#18251

To other reviewers: this PR alone doesn't fix the issue, someone needs to bump the dependency in the telegraf repo to pull this in after merging.

@mchrome

mchrome commented Jul 16, 2026

Copy link
Copy Markdown
Author

@helenosheaa Hi, could you take a look at this? Thanks

@mchrome

mchrome commented Aug 11, 2026

Copy link
Copy Markdown
Author

@skartikey Hi, could you take a look at this? In relation to influxdata/telegraf#19156

@skartikey skartikey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mchrome Thanks! A couple of comments, Please take a look.

Comment thread influx2otel/metrics.go Outdated
}, nil
}

func NewLineProtocolToOtelMetricsWithSeparator(logger common.Logger, nameSeparator string) (*LineProtocolToOtelMetrics, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] Could this take a config struct instead of a separator arg? otel2influx hit the same thing and went with OtelMetricsToLineProtocolConfig plus DefaultOtelMetricsToLineProtocolConfig() (metrics.go:14, same shape in logs.go and traces.go), so there's a pattern to copy. Same number of new exported names either way, since the old constructor has to stay regardless, but the next knob becomes a struct field instead of another constructor name, and contrib and telegraf both import this so those names are permanent. It'd also handle "" for free, which today silently gives you measurementfield. Not blocking if you'd rather ship it as is.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, i got rid of the new constructor in 6ad72fb in favor of a config struct


assertMetricsEqual(t, expect, b.GetMetrics())
}
func TestAddPoint_v1_sum_separator(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] The three new test funcs have no blank line between them, 595 and 660 butt straight up against the previous closing brace. gofmt doesn't care, just easier to scan with one. Ignore if you like.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6ad72fb

@mchrome

mchrome commented Aug 19, 2026

Copy link
Copy Markdown
Author

@skartikey Hi, could you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dot-separated OpenTelemetry metric names in OpenTelemetry output plugin

3 participants