Skip to content

Commit

Permalink
update telemetry initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
eikenb committed May 26, 2022
1 parent 9a26477 commit f5dc65c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"sync"
"time"

"github.com/armon/go-metrics"
"github.com/hashicorp/consul-esm/version"
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/lib"
Expand Down Expand Up @@ -71,7 +70,7 @@ type Agent struct {
knownNodeStatuses map[string]lastKnownStatus
knownNodeStatusesLock sync.Mutex

memSink *metrics.InmemSink
metrics *lib.MetricsConfig
}

func NewAgent(config *Config, logger hclog.Logger) (*Agent, error) {
Expand All @@ -81,7 +80,8 @@ func NewAgent(config *Config, logger hclog.Logger) (*Agent, error) {
return nil, err
}

memSink, err := lib.InitTelemetry(config.Telemetry)
// Never used locally. I think we keep the reference to avoid GC.
metricsConf, err := lib.InitTelemetry(config.Telemetry, logger)
if err != nil {
return nil, err
}
Expand All @@ -94,7 +94,7 @@ func NewAgent(config *Config, logger hclog.Logger) (*Agent, error) {
shutdownCh: make(chan struct{}),
inflightPings: make(map[string]struct{}),
knownNodeStatuses: make(map[string]lastKnownStatus),
memSink: memSink,
metrics: metricsConf,
}

logger.Info("Connecting to Consul", "address", clientConf.Address)
Expand Down

0 comments on commit f5dc65c

Please sign in to comment.