-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Description
Context
Following @ariesdevil's suggestion in #1445, we should standardize metrics collection using OpenTelemetry instead of custom histogram implementations.
Proposal
Integrate the OpenTelemetry Metrics API to replace custom metric collection with industry-standard observability.
Technical Approach
- Depend on
opentelemetry-apicrate only (not the SDK) - Replace custom histogram with OTEL
Histograminstrument - Use OTEL semantic conventions for metric naming
- Let applications configure SDK and exporters
Benefits
- Industry standard: Compatible with existing OTEL infrastructure (Prometheus, Jaeger, etc.)
- Zero runtime overhead for libraries: API is lightweight; SDK dependency stays in applications
- Flexibility: Applications choose exporters (OTLP, Prometheus, StatsD, etc.)
- Better instrumentation: Standardized metric names and attributes
Migration Strategy
- Add
opentelemetry-apias dependency - Replace custom histogram in feat: add histogram-based statistics for Apply batch sizes #1445 with OTEL Histogram
- Define metric instruments (histograms, counters, gauges) for existing metrics
- Update examples to show SDK configuration
- Add feature flag for OTEL support (optional migration path)
Implementation Notes
Since OTEL separates API from SDK:
- openraft (library): Depends on
opentelemetry-apionly - Applications: Add
opentelemetry-sdkand choose exporters - No-op by default: If app doesn't configure SDK, metrics collection has minimal overhead
Related: #1445
Metadata
Metadata
Assignees
Labels
No labels