refactor(config): restructure telemetry config with export and embedded sub-configs

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Alexander
2026-04-14 21:56:32 +02:00
parent bc6ad70386
commit 1bc704a7b2
+28 -2
View File
@@ -36,13 +36,27 @@ type ReplaceRule struct {
}
type TelemetryConfig struct {
Export ExportConfig `yaml:"export"`
Embedded EmbeddedConfig `yaml:"embedded"`
ServiceName string `yaml:"service_name"`
}
type ExportConfig 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 != "" }
func (e ExportConfig) Enabled() bool { return e.Endpoint != "" }
type EmbeddedConfig struct {
Enabled bool `yaml:"enabled"`
Port int `yaml:"port"`
PersesBinary string `yaml:"perses_binary"`
VMBinary string `yaml:"vm_binary"`
VMPort int `yaml:"vm_port"`
BinDir string `yaml:"bin_dir"`
}
type LoggingConfig struct {
Level string `yaml:"level"`
@@ -89,6 +103,18 @@ func Load(path string) (*Config, error) {
if cfg.Telemetry.ServiceName == "" {
cfg.Telemetry.ServiceName = "anthropic-proxy"
}
if cfg.Telemetry.Embedded.Port == 0 {
cfg.Telemetry.Embedded.Port = 8080
}
if cfg.Telemetry.Embedded.PersesBinary == "" {
cfg.Telemetry.Embedded.PersesBinary = "perses"
}
if cfg.Telemetry.Embedded.VMBinary == "" {
cfg.Telemetry.Embedded.VMBinary = "victoria-metrics"
}
if cfg.Telemetry.Embedded.VMPort == 0 {
cfg.Telemetry.Embedded.VMPort = 8428
}
// Check for deprecated claude_credentials field
var rawCfg map[string]interface{}