fix(telemetry): make metrics best-effort so telemetry never crashes storage ops - #123
Closed
jayya2 wants to merge 1 commit into
Closed
fix(telemetry): make metrics best-effort so telemetry never crashes storage ops#123jayya2 wants to merge 1 commit into
jayya2 wants to merge 1 commit into
Conversation
…torage ops OpenTelemetry version skew on some clusters made metric recording raise `AttributeError: 'AutoProxy[opentelemetry.metrics.Counter]' object has no attribute 'add'`, crashing daemon upload/download jobs. The shared cross-process Counter/Gauge proxies were registered without an explicit `exposed` method set, so multiprocessing's default discovery (`public_methods` via `dir()`) dropped `add`/`set` whenever the installed OpenTelemetry build delegated those methods. - Declare `exposed=["add"]` / `exposed=["set"]` on the Counter/Gauge proxy registrations so the proxy method set no longer depends on the instrument's runtime shape (mirrors the existing explicit `exposed` used for Span). - Make telemetry best-effort end to end: disable metrics/traces on any provider/exporter construction failure (and cache the disabled state); latch the synchronous record path so a failing record disables metrics instead of crashing the storage operation; skip metrics init entirely when `MSC_TELEMETRY_DISABLED` / `OTEL_SDK_DISABLED` is set. - Fail fast with a clear error when the installed OTLP exporter is too old for the mTLS client-certificate options instead of an opaque TypeError. Adds unit tests for the proxy exposed set, the disable-on-failure paths, the record latch, and the env kill-switches; documents disabling telemetry. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contributor
Author
|
Superseded — split into two independent PRs per review:
Closing this combined PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
OpenTelemetry version skew on some clusters made metric recording raise
AttributeError: 'AutoProxy[opentelemetry.metrics.Counter]' object has no attribute 'add',crashing daemon upload/download jobs. The shared cross-process
Counter/Gaugeproxies areregistered without an explicit
exposedmethod set, somultiprocessing's default discovery(
public_methodsviadir()) dropsadd/setwhenever the installed OpenTelemetry builddelegates those methods on the instrument.
This makes telemetry best-effort and hardens the proxies:
exposed=["add"]/exposed=["set"]on theCounter/Gaugeregistrations so the proxy method set no longer depends on the installed OpenTelemetry's instrument
shape (mirrors the existing explicit
exposedused forSpan).cache the disabled state); latch the synchronous record path so a failing record disables metrics
instead of crashing the storage operation; skip metrics init entirely when
MSC_TELEMETRY_DISABLEDor
OTEL_SDK_DISABLEDis set.options, instead of an opaque
TypeError.Adds unit tests (proxy exposed set, disable-on-failure paths, record latch, env kill-switches) and
documents disabling telemetry.
Checklist
.release_notes/.unreleased.md🤖 Generated with Claude Code