Skip to content

Commit

Permalink
[exporter/datadog] Remove reference to Config on ProcessMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-psi committed Mar 10, 2022
1 parent 695fdff commit ac59baf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
4 changes: 1 addition & 3 deletions exporter/datadogexporter/internal/metrics/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (

"go.opentelemetry.io/collector/component"
"gopkg.in/zorkian/go-datadog-api.v2"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/config"
)

type MetricDataType string
Expand Down Expand Up @@ -94,7 +92,7 @@ func DefaultMetrics(exporterType string, hostname string, timestamp uint64, buil

// ProcessMetrics adds the hostname to the metric and prefixes it with the "otel"
// namespace as the Datadog backend expects
func ProcessMetrics(ms []datadog.Metric, cfg *config.Config) {
func ProcessMetrics(ms []datadog.Metric) {
addNamespace(ms, otelNamespacePrefix)
}

Expand Down
13 changes: 1 addition & 12 deletions exporter/datadogexporter/internal/metrics/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ import (

"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/component"
"go.uber.org/zap"
"gopkg.in/zorkian/go-datadog-api.v2"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/config"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/utils/cache"
)

Expand Down Expand Up @@ -82,15 +80,6 @@ func TestProcessMetrics(t *testing.T) {
// Reset hostname cache
cache.Cache.Flush()

cfg := &config.Config{
// Global tags should be ignored and sent as metadata
TagsConfig: config.TagsConfig{
Env: "test_env",
Tags: []string{"key:val"},
},
}
cfg.Sanitize(zap.NewNop())

ms := []datadog.Metric{
NewGauge(
"metric_name",
Expand All @@ -106,7 +95,7 @@ func TestProcessMetrics(t *testing.T) {
),
}

ProcessMetrics(ms, cfg)
ProcessMetrics(ms)

assert.Equal(t, "metric_name", *ms[0].Metric)
assert.ElementsMatch(t,
Expand Down
2 changes: 1 addition & 1 deletion exporter/datadogexporter/metrics_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (exp *metricsExporter) PushMetricsData(ctx context.Context, md pdata.Metric
return fmt.Errorf("failed to map metrics: %w", err)
}
ms, sl := consumer.All(pushTime, exp.params.BuildInfo)
metrics.ProcessMetrics(ms, exp.cfg)
metrics.ProcessMetrics(ms)

err = nil
if len(ms) > 0 {
Expand Down

0 comments on commit ac59baf

Please sign in to comment.