Add telemetry
This commit is contained in:
@@ -11,11 +11,12 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Port int `yaml:"port"`
|
||||
APIKeys []string `yaml:"api_keys"`
|
||||
ClaudeBinary string `yaml:"claude_binary"`
|
||||
Sanitize SanitizeConfig `yaml:"sanitize"`
|
||||
Logging LoggingConfig `yaml:"logging"`
|
||||
Port int `yaml:"port"`
|
||||
APIKeys []string `yaml:"api_keys"`
|
||||
ClaudeBinary string `yaml:"claude_binary"`
|
||||
Sanitize SanitizeConfig `yaml:"sanitize"`
|
||||
Logging LoggingConfig `yaml:"logging"`
|
||||
Telemetry TelemetryConfig `yaml:"telemetry"`
|
||||
}
|
||||
|
||||
type SanitizeConfig struct {
|
||||
@@ -34,6 +35,15 @@ type ReplaceRule struct {
|
||||
Replace string `yaml:"replace"`
|
||||
}
|
||||
|
||||
type TelemetryConfig struct {
|
||||
Endpoint string `yaml:"endpoint"`
|
||||
Insecure bool `yaml:"insecure"`
|
||||
ServiceName string `yaml:"service_name"`
|
||||
Headers map[string]string `yaml:"headers"`
|
||||
}
|
||||
|
||||
func (t TelemetryConfig) ExportEnabled() bool { return t.Endpoint != "" }
|
||||
|
||||
type LoggingConfig struct {
|
||||
Level string `yaml:"level"`
|
||||
File string `yaml:"file"`
|
||||
@@ -76,6 +86,10 @@ func Load(path string) (*Config, error) {
|
||||
cfg.Logging.MaxAgeDays = 30
|
||||
}
|
||||
|
||||
if cfg.Telemetry.ServiceName == "" {
|
||||
cfg.Telemetry.ServiceName = "anthropic-proxy"
|
||||
}
|
||||
|
||||
// Check for deprecated claude_credentials field
|
||||
var rawCfg map[string]interface{}
|
||||
if err := yaml.Unmarshal(data, &rawCfg); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user