Skip to content

v0.3.00: Basic Built-in Metric Sources #23

@laplaque

Description

@laplaque

Epic: Custom Metrics Collection and Registration

Epic Issue: #20
Depends on: #22 (v0.2.00: Foundation & Multiple OpenTelemetry Metric Types)

Overview

Implement fundamental metric source types for immediate value: HTTP endpoints, command execution, and log file parsing.

Deliverables

1. HTTP Endpoint Source (common/metric_sources/http_source.py)

  • Poll REST/HTTP endpoints for metrics data
  • Support JSON response parsing with JSONPath expressions
  • Configurable intervals, timeouts, and retry logic
  • Authentication support (Bearer tokens, basic auth)
  • Response validation and error handling

2. Command Execution Source (common/metric_sources/command_source.py)

  • Execute shell commands and parse output for metrics
  • Support for various output formats (JSON, CSV, plain text)
  • Regex-based value extraction from command output
  • Command timeout and error handling
  • Security considerations for command execution

3. Log File Parsing Source (common/metric_sources/log_source.py)

  • Monitor log files for metric-relevant patterns
  • Regex-based pattern matching and value extraction
  • File rotation handling and position tracking
  • Rate-based metrics (errors per minute, transactions per second)
  • Configurable file paths and update intervals

4. Enhanced Configuration

  • Extended TOML configuration for new source types
  • Validation for source-specific parameters
  • Configuration templates and examples

5. Comprehensive Testing

  • Unit tests for each source type
  • Integration tests with mock services
  • Performance and reliability testing
  • Documentation and usage examples

Configuration Example

[[custom_metrics.sources]]
name = "api_health"
type = "http"
url = "http://localhost:8080/health"
interval = 30
metrics = [
    {name = "response_time", otel_type = "histogram", json_path = "$.response_time"},
    {name = "active_connections", otel_type = "gauge", json_path = "$.connections.active"}
]

[[custom_metrics.sources]]
name = "error_monitor"
type = "log_file"
path = "/var/log/app.log"
interval = 10
metrics = [
    {name = "error_count", otel_type = "counter", pattern = "ERROR", unit = "1"}
]

Success Criteria

  • 3 production-ready built-in source types
  • Real-world integration examples
  • Performance benchmarks established
  • 85%+ test coverage
  • Comprehensive documentation

Milestone

Target: v0.3.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