fix: SYS_SENSORS context error (#643)

This commit is contained in:
henrygd
2025-03-06 05:36:20 -05:00
parent a6daa70010
commit d25c7c58c1

View File

@@ -33,8 +33,9 @@ type Agent struct {
func NewAgent() *Agent { func NewAgent() *Agent {
agent := &Agent{ agent := &Agent{
fsStats: make(map[string]*system.FsStats), sensorsContext: context.Background(),
cache: NewSessionCache(69 * time.Second), fsStats: make(map[string]*system.FsStats),
cache: NewSessionCache(69 * time.Second),
} }
agent.memCalc, _ = GetEnv("MEM_CALC") agent.memCalc, _ = GetEnv("MEM_CALC")
@@ -59,8 +60,6 @@ func NewAgent() *Agent {
agent.sensorsContext = context.WithValue(agent.sensorsContext, agent.sensorsContext = context.WithValue(agent.sensorsContext,
common.EnvKey, common.EnvMap{common.HostSysEnvKey: sysSensors}, common.EnvKey, common.EnvMap{common.HostSysEnvKey: sysSensors},
) )
} else {
agent.sensorsContext = context.Background()
} }
// Set sensors whitelist // Set sensors whitelist