Epic: Custom Metrics Collection and Registration
Epic Issue: #20
Overview
Establish the core infrastructure and support for all OpenTelemetry metric types beyond the current Observable Gauge limitation.
Deliverables
1. Enhanced OTel Connector (common/otel_connector.py)
- Add support for Counter, UpDownCounter, Histogram, and Observable Gauge
- Implement metric type validation and appropriate creation methods
- Add error handling for unsupported metric configurations
2. Metric Source Base Classes (common/metric_sources/)
MetricSourceBase - Abstract base class for all metric sources
StaticMetricSource - For simple value-based metrics
CallbackMetricSource - For function-based metric collection
3. Basic Metric Source Registry (common/metric_registry.py)
- Registration and discovery system for metric sources
- Type checking and validation framework
- Basic lifecycle management (register/unregister)
4. Enhanced Configuration Support
- Extend
toml_utils.py to parse [custom_metrics] sections
- Add validation for metric type and source configurations
- Implement configuration merging (defaults + custom)
5. Updated Base Sensor Integration
- Modify
base_sensor.py to use registry-based metric collection
- Maintain backward compatibility with existing process metrics
- Add hooks for custom metric integration
Configuration Example
[custom_metrics]
enabled = true
[[custom_metrics.metrics]]
name = "heap_memory"
source_type = "static"
otel_type = "gauge"
unit = "bytes"
value_callback = "get_heap_memory"
[[custom_metrics.metrics]]
name = "request_count"
source_type = "static"
otel_type = "counter"
unit = "1"
value_callback = "get_request_count"
Success Criteria
- All 4 OpenTelemetry metric types supported and tested
- Plugin architecture foundation established
- Backward compatibility maintained
- 80%+ test coverage for new components
- Performance impact < 5% vs current implementation
Milestone
Target: v0.2.00
Epic: Custom Metrics Collection and Registration
Epic Issue: #20
Overview
Establish the core infrastructure and support for all OpenTelemetry metric types beyond the current Observable Gauge limitation.
Deliverables
1. Enhanced OTel Connector (
common/otel_connector.py)2. Metric Source Base Classes (
common/metric_sources/)MetricSourceBase- Abstract base class for all metric sourcesStaticMetricSource- For simple value-based metricsCallbackMetricSource- For function-based metric collection3. Basic Metric Source Registry (
common/metric_registry.py)4. Enhanced Configuration Support
toml_utils.pyto parse[custom_metrics]sections5. Updated Base Sensor Integration
base_sensor.pyto use registry-based metric collectionConfiguration Example
Success Criteria
Milestone
Target: v0.2.00