ExLLM.Infrastructure.CircuitBreaker.Metrics.StatsDReporter (ex_llm v0.8.1)
View SourceStatsD metrics reporter for circuit breakers.
Provides enhanced StatsD integration with custom tags support, metric aggregation, and batch reporting capabilities.
Features
- Custom Tags: Support for DogStatsD-style tags
- Metric Aggregation: Batch multiple metrics for efficiency
- Error Recovery: Resilient to StatsD server unavailability
- Rate Limiting: Configurable metric sampling
Configuration
config :ex_llm, :circuit_breaker_metrics,
statsd: [
host: "localhost",
port: 8125,
namespace: "ex_llm.circuit_breaker",
tags: ["service:ex_llm", "version:1.0.0"],
sample_rate: 1.0,
batch_size: 10,
flush_interval: 1000
]
Usage
# Start reporter
ExLLM.CircuitBreaker.Metrics.StatsDReporter.start_link()
# Report metrics
ExLLM.CircuitBreaker.Metrics.StatsDReporter.counter("requests.total", 1,
tags: ["circuit:api_service", "result:success"])
# Report with sampling
ExLLM.CircuitBreaker.Metrics.StatsDReporter.gauge("health.score", 85,
tags: ["circuit:api_service"], sample_rate: 0.1)
Summary
Functions
Returns a specification to start this module under a supervisor.
Report a counter metric.
Flush any pending metrics immediately.
Report a gauge metric.
Report a histogram metric.
Report a set metric.
Start the StatsD reporter.
Get current reporter status and statistics.
Report a timing metric.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Report a counter metric.
Flush any pending metrics immediately.
Report a gauge metric.
Report a histogram metric.
Report a set metric.
Start the StatsD reporter.
Get current reporter status and statistics.
Report a timing metric.