Skip to content

perf(productmetrics): export metrics every 30m instead of 60s - #1610

Merged
jhrozek merged 1 commit into
mainfrom
Nashon-Steffen/metrics-poll-interval-30m
Sep 16, 2026
Merged

jhrozek merged 1 commit into
mainfrom
Nashon-Steffen/metrics-poll-interval-30m

Conversation

@Nashon-Steffen

Copy link
Copy Markdown
Contributor

What

Change the product-metrics OTLP export cadence to the ingest endpoint at mecatl.metrics.stacklok.com from every 60s to every 30m.

Why

NewProvider in internal/adapter/productmetrics/provider.go built its PeriodicReader with no interval option, so it flushed collected metrics at the OTel SDK's default defaultInterval of 60s. This pipeline is a low-frequency product-telemetry path (heartbeat/feature snapshots), not an operational monitoring feed — minute-granularity export buys nothing and generates ~30x more export traffic to the vendor destination than needed.

Change

  • Added a named exportInterval = 30 * time.Minute constant (mirroring the existing DefaultHeartbeatInterval style), with a comment noting it overrides the SDK's 60s default.
  • Passed it via sdkmetric.WithInterval(exportInterval) to NewPeriodicReader.

Notes

  • This affects only the OTLP export interval — the cadence at which buffered metrics are flushed. It is distinct from DefaultHeartbeatInterval (24h), the feature-heartbeat fire.
  • The pipeline only runs in real release builds (gated by a build-time baked ingest key); dev/CI builds have no key and never export, so this has no effect on local/test runs.
  • No test pinned the 60s default, so nothing else required updating. go build and go vet pass.

🤖 Generated with Claude Code

The product-metrics OTLP pipeline built its PeriodicReader with no interval
option, so it flushed to the vendor ingest at mecatl.metrics.stacklok.com at
the OTel SDK's default 60s cadence. This pipeline has no need for
minute-granularity export; override the reader interval to 30m via a named
exportInterval constant, cutting export traffic ~30x.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@jhrozek
jhrozek merged commit 1712363 into main Sep 16, 2026
35 checks passed
@jhrozek
jhrozek deleted the Nashon-Steffen/metrics-poll-interval-30m branch September 16, 2026 09:53
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Sep 21, 2026
2 tasks
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.

3 participants