From 76a2f23e4cabac31fb2b71510f5f9630a1483653 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Thu, 4 Jan 2024 14:56:20 -0800 Subject: [PATCH] Use pointer for cost config (#573) --- pkg/config/service.go | 5 +++-- pkg/stats/monitor.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/config/service.go b/pkg/config/service.go index 98dea18b..9b467be6 100644 --- a/pkg/config/service.go +++ b/pkg/config/service.go @@ -47,7 +47,7 @@ type ServiceConfig struct { PrometheusPort int `yaml:"prometheus_port"` // prometheus handler port DebugHandlerPort int `yaml:"debug_handler_port"` // egress debug handler port - CPUCostConfig `yaml:"cpu_cost"` // CPU costs for the different egress types + *CPUCostConfig `yaml:"cpu_cost"` // CPU costs for the different egress types } type CPUCostConfig struct { @@ -69,7 +69,8 @@ func NewServiceConfig(confString string) (*ServiceConfig, error) { ApiSecret: os.Getenv("LIVEKIT_API_SECRET"), WsUrl: os.Getenv("LIVEKIT_WS_URL"), }, - TemplatePort: defaultTemplatePort, + TemplatePort: defaultTemplatePort, + CPUCostConfig: &CPUCostConfig{}, } if confString != "" { if err := yaml.Unmarshal([]byte(confString), conf); err != nil { diff --git a/pkg/stats/monitor.go b/pkg/stats/monitor.go index 94a72bcc..3c2b0c8c 100644 --- a/pkg/stats/monitor.go +++ b/pkg/stats/monitor.go @@ -32,7 +32,7 @@ import ( ) type Monitor struct { - cpuCostConfig config.CPUCostConfig + cpuCostConfig *config.CPUCostConfig promCPULoad prometheus.Gauge promProcCPULoad *prometheus.GaugeVec