Skip to content

[exporter/splunkhec] Define heartbeat metrics in metadata.yaml - #50942

Open
singhvibhanshu wants to merge 1 commit into
open-telemetry:mainfrom
singhvibhanshu:splunkhec-telemetry-metadata
Open

[exporter/splunkhec] Define heartbeat metrics in metadata.yaml#50942
singhvibhanshu wants to merge 1 commit into
open-telemetry:mainfrom
singhvibhanshu:splunkhec-telemetry-metadata

Conversation

@singhvibhanshu

Copy link
Copy Markdown
Member

Description

This PR moves the heartbeat metric definitions into metadata.yaml and generates them with mdatagen, using the generated TelemetryBuilder in the exporter instead of hand-creating the counters.

This is a no-op for users: the emitted metric names (otelcol_exporter_splunkhec_heartbeats_sent/_failed) are unchanged, and the telemetry.enabled, telemetry.override_metrics_names, and telemetry.extra_attributes options continue to behave as before.

Link to tracking issue

Fixes #49009

Testing

Tuned.

Documentation

Tuned.

Authorship

  • I, a human, wrote this pull request description myself.

Signed-off-by: singhvibhanshu <find.vibhanshu@gmail.com>
@singhvibhanshu

Copy link
Copy Markdown
Member Author

/rerun

}
builder.meter = Meter(settings)
var err, errs error
builder.ExporterSplunkhecHeartbeatsFailed, err = builder.meter.Int64Counter(

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.

can you use those metrics instead of defining them again in hearbeat.go?

@singhvibhanshu singhvibhanshu Sep 13, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

can you use those metrics instead of defining them again in hearbeat.go?

The default path already uses the generated counters (telemetryBuilder.ExporterSplunkhecHeartbeatsSent / ...Failed). The extra meter.Int64Counter(...) in heartbeatCounter is only a fallback for when telemetry.override_metrics_names is set, since the generated metrics have fixed names. I kept it so this PR stays a no-op for anyone relying on that option

I know, the issue mentions eventually deprecating telemetry.enabled, I'm happy to deprecate the whole custom telemetry block and use the generated metrics directly as a follow-up (after some releases, most probably after 2) so this one stays a clean migration?

WDYT?

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-09-13 22:34 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[exporter/splunk_hec] Push metric definitions to metadata.yaml

2 participants