Skip to content

feat: add metrics-exporter-opentelemetry crate #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

palindrom615
Copy link

Summary

  • Implements OpenTelemetry metrics exporter for the metrics crate ecosystem
  • Provides full integration with OpenTelemetry collectors and OTLP endpoints
  • Includes comprehensive tests, documentation, and practical examples

Features

  • Complete metric type support: Counters, gauges, and histograms with proper OpenTelemetry semantics
  • Custom histogram boundaries: Configure bucket boundaries per metric for optimal histogram resolution
  • Metric descriptions and units: Full support for metadata with automatic unit conversion
  • High performance: Lock-free concurrent data structures using SCC (Scalable Concurrent Collections)
  • Thread safety: Designed for high-concurrency applications with minimal contention

Test Plan

  • Integration tests using InMemoryMetricExporter with proper assertions
  • Test counter accumulation and metric isolation
  • Test gauge current state tracking
  • Test histogram bucket distribution
  • Test custom histogram boundaries
  • Test metric descriptions and units
  • Verify thread safety and concurrent access

Examples

  • Basic usage example showing simple setup and metric recording
  • Custom histogram bounds example demonstrating bucket configuration
  • OTLP exporter integration example for real-world usage

Closes #275

🤖 Generated with Claude Code

palindrom615 and others added 8 commits July 11, 2025 17:29
… boundaries

Add support for configuring custom histogram bucket boundaries in the OpenTelemetry exporter.
This allows users to define specific bucket boundaries for individual metrics, enabling
better histogram resolution tailored to expected value distributions.

- Add histogram_bounds HashMap shared between recorder and storage via Arc<RwLock<>>
- Implement set_histogram_bounds() method to configure boundaries before histogram creation
- Apply custom boundaries when creating histograms in OtelMetricStorage
- Add comprehensive test coverage for custom histogram bounds functionality
- Fix integration tests to use InMemoryMetricExporter with proper assertions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add detailed documentation following patterns from other metrics exporters:
- Module-level overview with features, usage examples, and performance notes
- Comprehensive API documentation for OpenTelemetryRecorder
- Detailed method docs with examples and behavioral constraints
- Internal type documentation for MetricDescription and MetricMetadata
- Missing docs enforcement and broken link detection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add basic usage example
- Add custom histogram bounds example
- Add OTLP exporter example
- Significantly reduce documentation verbosity
- Delegate unit conversion details to Unit documentation
- Clarify that descriptions/bounds only apply to metrics created after they are set

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

OpenTelemetry exporter?
1 participant