Documentation
¶
Overview ¶
Package telemetry provides metrics collection and reporting for monitoring the LLM-Memory service performance.
Index ¶
- Constants
- type MetricsCollector
- func (m *MetricsCollector) GetCounter(name string) int64
- func (m *MetricsCollector) GetGauge(name string) float64
- func (m *MetricsCollector) GetReport() string
- func (m *MetricsCollector) GetTimeSince(name string) time.Duration
- func (m *MetricsCollector) GetTimerAverage(name string) time.Duration
- func (m *MetricsCollector) GetTimerP95(name string) time.Duration
- func (m *MetricsCollector) IncrementCounter(name string, amount int64)
- func (m *MetricsCollector) RecordTimer(name string, duration time.Duration)
- func (m *MetricsCollector) RecordTimestamp(name string)
- func (m *MetricsCollector) Reset()
- func (m *MetricsCollector) SetGauge(name string, value float64)
Constants ¶
const ( // API Call counts by provider MetricAPICallsAnthropic = "summarizer.api_calls.anthropic" MetricAPICallsOpenAI = "summarizer.api_calls.openai" MetricAPICallsGoogle = "summarizer.api_calls.google" MetricAPICallsXAI = "summarizer.api_calls.xai" // Success/failure metrics MetricAPICallsSuccess = "summarizer.api_calls.success" MetricAPICallsFailure = "summarizer.api_calls.failure" // Retry metrics MetricRetryAttempts = "summarizer.retry_attempts" MetricRetrySuccess = "summarizer.retry_success" // Fallback metrics MetricFallbackAttempts = "summarizer.fallback_attempts" MetricFallbackSuccess = "summarizer.fallback_success" // Cache metrics MetricCacheHits = "summarizer.cache.hits" MetricCacheMisses = "summarizer.cache.misses" MetricCacheSize = "summarizer.cache.size" // Response times MetricResponseTimeAnthropic = "summarizer.response_time.anthropic" MetricResponseTimeOpenAI = "summarizer.response_time.openai" MetricResponseTimeGoogle = "summarizer.response_time.google" MetricResponseTimeXAI = "summarizer.response_time.xai" // Provider health MetricProviderHealthAnthropic = "summarizer.health.anthropic" MetricProviderHealthOpenAI = "summarizer.health.openai" MetricProviderHealthGoogle = "summarizer.health.google" MetricProviderHealthXAI = "summarizer.health.xai" )
SummarizerMetrics defines constants for metrics related to the AI Summarizer
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector provides a thread-safe interface for collecting application metrics for monitoring and troubleshooting.
func NewMetricsCollector ¶
func NewMetricsCollector() *MetricsCollector
NewMetricsCollector creates a new MetricsCollector instance
func (*MetricsCollector) GetCounter ¶
func (m *MetricsCollector) GetCounter(name string) int64
GetCounter retrieves the current value of a counter
func (*MetricsCollector) GetGauge ¶
func (m *MetricsCollector) GetGauge(name string) float64
GetGauge retrieves the current value of a gauge
func (*MetricsCollector) GetReport ¶
func (m *MetricsCollector) GetReport() string
GetReport generates a report of all collected metrics
func (*MetricsCollector) GetTimeSince ¶
func (m *MetricsCollector) GetTimeSince(name string) time.Duration
GetTimeSince calculates the time elapsed since a recorded timestamp
func (*MetricsCollector) GetTimerAverage ¶
func (m *MetricsCollector) GetTimerAverage(name string) time.Duration
GetTimerAverage calculates the average duration for a timer
func (*MetricsCollector) GetTimerP95 ¶
func (m *MetricsCollector) GetTimerP95(name string) time.Duration
GetTimerP95 calculates the 95th percentile duration for a timer
func (*MetricsCollector) IncrementCounter ¶
func (m *MetricsCollector) IncrementCounter(name string, amount int64)
IncrementCounter increments a named counter by the specified amount
func (*MetricsCollector) RecordTimer ¶
func (m *MetricsCollector) RecordTimer(name string, duration time.Duration)
RecordTimer records a duration for the specified timer
func (*MetricsCollector) RecordTimestamp ¶
func (m *MetricsCollector) RecordTimestamp(name string)
RecordTimestamp records the current time for the specified event
func (*MetricsCollector) Reset ¶
func (m *MetricsCollector) Reset()
Reset clears all collected metrics
func (*MetricsCollector) SetGauge ¶
func (m *MetricsCollector) SetGauge(name string, value float64)
SetGauge sets a named gauge to the specified value