Skip to content

feat: implement distributed tracing with OpenTelemetry and trace context propagation (closes #108)#210

Merged
elizabetheonoja-art merged 1 commit into
Utility-Protocol:mainfrom
oche11207-art:feat/issue-108-opentelemetry-tracing
Jul 24, 2026
Merged

feat: implement distributed tracing with OpenTelemetry and trace context propagation (closes #108)#210
elizabetheonoja-art merged 1 commit into
Utility-Protocol:mainfrom
oche11207-art:feat/issue-108-opentelemetry-tracing

Conversation

@oche11207-art

Copy link
Copy Markdown
Contributor

Summary

Implements distributed tracing with OpenTelemetry SDK across all services as described in #108.

Changes

  • OTLP gRPC batch exporter with head-based error-aware sampling (1% success, 100% error) and 5s batch interval
  • W3C traceparent + Baggage propagation via HTTP headers (already existed, enhanced with for test-safe usage)
  • tracing-opentelemetry bridge () to export spans as OpenTelemetry spans
  • Database query tracing () with and helpers
  • Kafka trace context propagation () for W3C traceparent injection/extraction in message headers
  • Custom spans on key operations: , , , , , Soroban RPC , settlement executor /
  • Integration tests for OTLP pipeline, W3C propagation, Kafka headers, sampling, and DB tracing

Technical Invariants Met

Requirement Implementation
Head-based 1% sampling, 100% error +
Auto-instrument HTTP Existing (Axum)
Auto-instrument database module +
Auto-instrument Kafka with W3C traceparent headers
OTLP batch every 5s
Correlation: trace_id in logs bridge layer

Closes #108

…ext propagation (closes Utility-Protocol#108)

- Add OTLP gRPC batch exporter with head-based error-aware sampling
  (1% success, 100% error) and 5s batch interval
- Add init_tracing_otel_bridge() to wire tracing spans into OpenTelemetry
- Add init_propagators_only() for test-safe W3C context propagation
- Create db_tracing module with QuerySpanGuard and trace_query()
- Create kafka_propagator module for W3C traceparent injection in
  Kafka message headers
- Add #[tracing::instrument] spans to key handlers:
  submit_reading, settle_account, register_meter, get_diagnostics,
  calibrate_meter
- Add tracing spans to Soroban RPC call_rpc and settlement executor
- Wire OpenTelemetry initialization into main.rs startup
- Add integration tests for OTLP pipeline, W3C propagation, Kafka
  headers, sampling, and DB tracing guards
- Add tonic/grpc-tonic features to opentelemetry-otlp dependency
@elizabetheonoja-art
elizabetheonoja-art merged commit 2ec5f4a into Utility-Protocol:main Jul 24, 2026
2 of 4 checks passed
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.

Distributed Tracing with OpenTelemetry and Trace Context Propagation

2 participants