Skip to content

v0.2.00: Foundation & Multiple OpenTelemetry Metric Types #22

@laplaque

Description

@laplaque

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmajorRelated to a major fix or architectural change

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions