Repository navigation
feat: fix OTel tracing and add observability metrics/spans - #8
Merged
Merged
Conversation
…ics and spans - Fix tracing init failing with conflicting semconv schema URL when enabled - No-op when disabled; honor OTEL_EXPORTER_OTLP_* env; add stdout exporter - Validate sample rate, parent-based sampling, propagate W3C trace context - Client spans/observer for MU API calls, trace_id in failure logs - Spans for flush/backends; metrics for API requests, outbox, job freshness, backend user operations, build info - Document metrics, traces and collector setup Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
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.
Findings (existing integration)
/metrics, :9090) and an OTLP/gRPC tracer already existed, but were undocumented.MU_TRACING_ENABLED=true) failed at startup withconflicting Schema URL(resource merge of SDK default + semconv v1.24). Tracing could never actually run.MU_TRACING_ENDPOINTdefault overrodeOTEL_EXPORTER_OTLP_*; a real SDK provider was installed even when disabled; no sample-rate validation; MU API client calls, upload flush and backend operations were not traced; no API / outbox / freshness metrics.Changes
MU_TRACING_EXPORTER=stdoutfor collector-less debugging; URL orhost:portendpoints, falls back toOTEL_EXPORTER_OTLP_*; OTel errors routed to slog;service.version/mu.node_idresource attributes.MU.<rpc>client spans (sanitized errors only, status code, request id) with W3Ctraceparentpropagation to the MU API;App.flushTraffic; per-backend attributes (sync.users_*,traffic.*); error status on root spans;trace_id/span_idinMU API request failedlogs.mu_api_requests_total,mu_api_request_duration_seconds,mu_job_last_success_timestamp_seconds,mu_traffic_outbox_{batches,logs},mu_backend_user_operations_total,mu_build_info; metrics server now logs the listen error.Verification
go vet ./...,go test -race ./...pass locally (new tests for tracing init/regression, client spans + propagation + observer, app spans and outbox/backend metrics).MU_TRACING_EXPORTER=stdout: spans nested correctly and/metricsexposed the new series.Note: metrics remain Prometheus-based (scrape directly or via Collector
prometheusreceiver); no OTLP metrics exporter was added.Made with Cursor