Add observabilitty and monitoring

This commit is contained in:
2026-03-03 06:39:42 +00:00
parent 2edb290563
commit b56c78fa07
15 changed files with 1549 additions and 38 deletions

View File

@@ -16,6 +16,7 @@ type Config struct {
Conversations ConversationConfig `yaml:"conversations"`
Logging LoggingConfig `yaml:"logging"`
RateLimit RateLimitConfig `yaml:"rate_limit"`
Observability ObservabilityConfig `yaml:"observability"`
}
// ConversationConfig controls conversation storage.
@@ -50,6 +51,41 @@ type RateLimitConfig struct {
Burst int `yaml:"burst"`
}
// ObservabilityConfig controls observability features.
type ObservabilityConfig struct {
Enabled bool `yaml:"enabled"`
Metrics MetricsConfig `yaml:"metrics"`
Tracing TracingConfig `yaml:"tracing"`
}
// MetricsConfig controls Prometheus metrics.
type MetricsConfig struct {
Enabled bool `yaml:"enabled"`
Path string `yaml:"path"` // default: "/metrics"
}
// TracingConfig controls OpenTelemetry tracing.
type TracingConfig struct {
Enabled bool `yaml:"enabled"`
ServiceName string `yaml:"service_name"` // default: "llm-gateway"
Sampler SamplerConfig `yaml:"sampler"`
Exporter ExporterConfig `yaml:"exporter"`
}
// SamplerConfig controls trace sampling.
type SamplerConfig struct {
Type string `yaml:"type"` // "always", "never", "probability"
Rate float64 `yaml:"rate"` // 0.0 to 1.0
}
// ExporterConfig controls trace exporters.
type ExporterConfig struct {
Type string `yaml:"type"` // "otlp", "stdout"
Endpoint string `yaml:"endpoint"`
Insecure bool `yaml:"insecure"`
Headers map[string]string `yaml:"headers"`
}
// AuthConfig holds OIDC authentication settings.
type AuthConfig struct {
Enabled bool `yaml:"enabled"`