Skip to content

Commit c522de2

Browse files
authored
[pkg/datadog] add IgnoreMissingDatadogFields config flag for consumpt… (#40226)
…ion by datadog-agent connector <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description IgnoreMissingDatadogFields is needed in datadog-agent fork of datadogconnector. In `opentelemetry-collector-contrib`, for now, using this flag will throw an error. In an upcoming datadog-agent PR, we will use this flag to control datadogconnector logic in datadog-agent's `stats.OTLPTracesToConcentratorInputsWithObfuscation`. Once that is merged, a follow up PR in `opentelemetry-collector-contrib` will bump the datadog-agent version and enable these changes, at which point we'll allow IgnoreMissingDatadogFields to be set. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
1 parent 75fe428 commit c522de2

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

connector/datadogconnector/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
package datadogconnector // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector"
55

66
import (
7+
"errors"
8+
79
"go.opentelemetry.io/collector/component"
810

911
datadogconfig "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/config"
@@ -21,5 +23,8 @@ type Config struct {
2123

2224
// Validate checks if the configuration is valid
2325
func (c *Config) Validate() error {
26+
if c.Traces.IgnoreMissingDatadogFields {
27+
return errors.New("ignore_missing_datadog_fields is not yet supported in the connector")
28+
}
2429
return c.Traces.Validate()
2530
}

connector/datadogconnector/config_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ func TestValidate(t *testing.T) {
9999
},
100100
err: "bucket interval must be non-negative",
101101
},
102+
{
103+
name: "With ignore_missing_datadog_fields",
104+
cfg: &Config{
105+
Traces: datadogconfig.TracesConnectorConfig{
106+
IgnoreMissingDatadogFields: true,
107+
},
108+
},
109+
err: "ignore_missing_datadog_fields is not yet supported in the connector",
110+
},
102111
}
103112
for _, testInstance := range tests {
104113
t.Run(testInstance.name, func(t *testing.T) {

pkg/datadog/config/traces.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ type TracesConnectorConfig struct {
150150
// If you are concerned about the metric volume generated by the Datadog connector and the resulting networking egress, try increasing bucket_interval.
151151
// Default is 10s if unset.
152152
BucketInterval time.Duration `mapstructure:"bucket_interval"`
153+
154+
// IgnoreMissingDatadogFields specifies whether we should recompute DD span fields if the corresponding "datadog."
155+
// namespaced span attributes are missing. If it is false (default), we will use the incoming "datadog." namespaced
156+
// OTLP span attributes to construct the DD span, and if they are missing, we will recompute them from the other
157+
// OTLP semantic convention attributes. If it is true, we will only populate a field if its associated "datadog."
158+
// OTLP span attribute exists, otherwise we will leave it empty.
159+
IgnoreMissingDatadogFields bool `mapstructure:"ignore_missing_datadog_fields"`
153160
}
154161

155162
func (c *TracesConnectorConfig) Validate() error {

0 commit comments

Comments
 (0)