Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change configuration place.
  • Loading branch information
gfonseca-tc committed Dec 7, 2021
1 parent 9a841e3 commit 31189d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion exporter/datadogexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ datadog:
datadog:
api:
key: "<API key>"
span_name_as_resource_name: true
traces:
span_name_as_resource_name: true
```

The hostname, environment, service and version can be set in the configuration for unified service tagging.
Expand Down
10 changes: 5 additions & 5 deletions exporter/datadogexporter/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ type APIConfig struct {
// It can also be set through the `DD_SITE` environment variable.
// The default value is "datadoghq.com".
Site string `mapstructure:"site"`

// If set to true the OpenTelemetry span name will used in the Datadog resource name.
// If set to false the resource name will be filled with the instrumentation library name + span kind.
// The default value is `false`.
SpanNameAsResourceName bool `mapstructure:"span_name_as_resource_name"`
}

// GetCensoredKey returns the API key censored for logging purposes
Expand Down Expand Up @@ -158,6 +153,11 @@ type TracesConfig struct {
// instrumentation:express.server: express
// go.opentelemetry.io_contrib_instrumentation_net_http_otelhttp.client: http.client
SpanNameRemappings map[string]string `mapstructure:"span_name_remappings"`

// If set to true the OpenTelemetry span name will used in the Datadog resource name.
// If set to false the resource name will be filled with the instrumentation library name + span kind.
// The default value is `false`.
SpanNameAsResourceName bool `mapstructure:"span_name_as_resource_name"`
}

// TagsConfig defines the tag-related configuration
Expand Down
2 changes: 1 addition & 1 deletion exporter/datadogexporter/translate_traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func spanToDatadogSpan(s pdata.Span,
span := &pb.Span{
TraceID: decodeAPMTraceID(s.TraceID().Bytes()),
SpanID: decodeAPMSpanID(s.SpanID().Bytes()),
Name: remapDatadogSpanName(getDatadogSpanName(s, tags, cfg.API.SpanNameAsResourceName), spanNameMap),
Name: remapDatadogSpanName(getDatadogSpanName(s, tags, cfg.Traces.SpanNameAsResourceName), spanNameMap),
Resource: resourceName,
Service: normalizedServiceName,
Start: int64(startTime),
Expand Down

0 comments on commit 31189d4

Please sign in to comment.