Skip to content

Commit

Permalink
Close the channel and log on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgajg1134 committed Feb 9, 2024
1 parent 78a1cd5 commit 2aa0bcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions exporter/datadogexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ func (f *factory) createMetricsExporter(
}
statsToAgent := make(chan *pb.StatsPayload)
statsWriter := writer.NewStatsWriter(acfg, statsToAgent, telemetry.NewNoopCollector())

set.Logger.Debug("Starting Datadog Trace-Agent StatsWriter")
go statsWriter.Run()

var statsIn chan []byte
Expand Down Expand Up @@ -356,6 +358,9 @@ func (f *factory) createMetricsExporter(
if statsIn != nil {
close(statsIn)
}
if statsToAgent != nil {
close(statsToAgent)
}
return nil
}),
)
Expand Down
2 changes: 1 addition & 1 deletion exporter/datadogexporter/traces_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ func newTraceAgent(ctx context.Context, params exporter.CreateSettings, cfg *Con
if err != nil {
return nil, err
}
tracelog.SetLogger(&zaplogger{params.Logger})
return agent.NewAgent(ctx, acfg, telemetry.NewNoopCollector()), nil
}

Expand Down Expand Up @@ -218,5 +217,6 @@ func newTraceAgentConfig(ctx context.Context, params exporter.CreateSettings, cf
if addr := cfg.Traces.Endpoint; addr != "" {
acfg.Endpoints[0].Host = addr
}
tracelog.SetLogger(&zaplogger{params.Logger}) //TODO: This shouldn't be a singleton
return acfg, nil
}

0 comments on commit 2aa0bcc

Please sign in to comment.