Skip to content

fix: enforce single provider init telemetry sample - #537

Open
nicklasl wants to merge 1 commit into
mainfrom
fix/provider-init-single-sample
Open

fix: enforce single provider init telemetry sample#537
nicklasl wants to merge 1 commit into
mainfrom
fix/provider-init-single-sample

Conversation

@nicklasl

@nicklasl nicklasl commented Aug 24, 2026

Copy link
Copy Markdown
Member

Context

#485 introduced provider_init_rate telemetry for the local providers. The provider wrapper is the sole owner of this metric: one provider instance should emit exactly one sample, with count = 1, on its first successful telemetry write.

The initial implementation appended that sample to the repeated protobuf field. That happened to work when the resolver returned an empty provider_init_rate, but it encoded the wrong merge behavior: any unexpected or stale samples from a lower-level resolver would be retained, producing multiple provider-init samples in one request. The JS test also codified that behavior by expecting the existing sample to survive.

Counts greater than one should only appear after the telemetry backend aggregates samples from multiple provider initializations. A provider should never send a single wire sample with an accumulated count, nor combine its sample with samples supplied by a lower layer.

Change

Make the provider layer replace provider_init_rate with a singleton sample instead of appending to it in the JS, Java, Go, Python, and Rust local providers:

provider_init_rate = [{ count: 1, labels: <provider init labels> }]

Other telemetry metadata in the request, including resolver version and SDK information, is still preserved or populated as before. The existing once-only and retry behavior is unchanged; this only makes ownership of the field explicit when the first sample is attached.

Each provider now has regression coverage that starts with an existing provider-init sample and verifies that it is replaced by exactly one provider-owned sample.

Validation

  • Go provider telemetry tests and Docker lint/test target
  • Java ProviderTelemetryResolverTest and Spotify Java formatter
  • JS provider tests, typecheck, and Prettier validation
  • Python provider tests and Docker lint/test targets (90 tests)
  • Rust logger tests and formatting

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.

1 participant