Skip to content

Commit

Permalink
[exporter/datadog] Always add current hostname (#5967)
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-psi authored Nov 2, 2021
1 parent 6c21bf2 commit 247420a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions exporter/datadogexporter/metrics_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func (exp *metricsExporter) PushMetricsData(ctx context.Context, md pdata.Metric
}

consumer := metrics.NewConsumer()
consumer.ConsumeHost(metadata.GetHost(exp.params.Logger, exp.cfg))
pushTime := uint64(time.Now().UTC().UnixNano())
err := exp.tr.MapMetrics(ctx, md, consumer)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions exporter/datadogexporter/translate_traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func convertToDatadogTd(td pdata.Traces, fallbackHost string, cfg *config.Config
var traces []*pb.TracePayload

seenHosts := make(map[string]struct{})
seenHosts[fallbackHost] = struct{}{}
var series []datadog.Metric
pushTime := pdata.NewTimestampFromTime(time.Now())

Expand Down
2 changes: 1 addition & 1 deletion exporter/datadogexporter/translate_traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func TestConvertToDatadogTdNoResourceSpans(t *testing.T) {
outputTraces, runningMetrics := convertToDatadogTd(traces, "test-host", &config.Config{}, denylister, buildInfo)

assert.Equal(t, 0, len(outputTraces))
assert.Equal(t, 0, len(runningMetrics))
assert.Equal(t, 1, len(runningMetrics))
}

func TestRunningTraces(t *testing.T) {
Expand Down

0 comments on commit 247420a

Please sign in to comment.