Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/dd-conn-bkt-size.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: datadogconnector

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Add a config `bucket_interval`"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: []

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: "`bucket_interval` specifies the time interval size of aggregation buckets that aggregate the Datadog trace metrics. It is also the time interval that Datadog trace metrics payloads are flushed to the pipeline. Default is 10s if unset."

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
6 changes: 6 additions & 0 deletions connector/datadogconnector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ connectors:
## A list of resource attributes that should be used as container tags.
#
# resource_attributes_as_container_tags: ["could.availability_zone", "could.region"]

## @param bucket_interval specifies the time interval size of aggregation buckets that aggregate the Datadog trace metrics.
## It is also the time interval that Datadog trace metrics payloads are flushed to the pipeline.
## Default is 10s if unset.
#
# bucket_interval: 30s
```

**NOTE**: `compute_stats_by_span_kind` and `peer_tags_aggregation` only work when the feature gate `connector.datadogconnector.performance` is enabled. See below for details on this feature gate.
Expand Down
10 changes: 10 additions & 0 deletions connector/datadogconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package datadogconnector // import "github.com/open-telemetry/opentelemetry-coll
import (
"fmt"
"regexp"
"time"

"go.opentelemetry.io/collector/component"
)
Expand Down Expand Up @@ -75,6 +76,11 @@ type TracesConfig struct {

// ResourceAttributesAsContainerTags specifies the list of resource attributes to be used as container tags.
ResourceAttributesAsContainerTags []string `mapstructure:"resource_attributes_as_container_tags"`

// BucketInterval specifies the time interval size of aggregation buckets that aggregate the Datadog trace metrics.
// It is also the time interval that Datadog trace metrics payloads are flushed to the pipeline.
// Default is 10s if unset.
BucketInterval time.Duration `mapstructure:"bucket_interval"`
}

// Validate the configuration for errors. This is required by component.Config.
Expand Down Expand Up @@ -103,5 +109,9 @@ func (c *Config) Validate() error {
return fmt.Errorf("Trace buffer must be non-negative")
}

if c.Traces.BucketInterval < 0 {
return fmt.Errorf("bucket interval must be non-negative")
}

return nil
}
14 changes: 14 additions & 0 deletions connector/datadogconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package datadogconnector

import (
"testing"
"time"

"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -70,6 +71,19 @@ func TestValidate(t *testing.T) {
Traces: TracesConfig{PeerTags: []string{"tag1", "tag2"}},
},
},
{
name: "With bucket_interval",
cfg: &Config{
Traces: TracesConfig{BucketInterval: 30 * time.Second},
},
},
{
name: "neg bucket_interval",
cfg: &Config{
Traces: TracesConfig{BucketInterval: -30 * time.Second},
},
err: "bucket interval must be non-negative",
},
}
for _, testInstance := range tests {
t.Run(testInstance.name, func(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions connector/datadogconnector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ func getTraceAgentCfg(logger *zap.Logger, cfg TracesConfig, attributesTranslator
logger.Info("traces::compute_top_level_by_span_kind needs to be enabled in both the Datadog connector and Datadog exporter configs if both components are being used")
acfg.Features["enable_otlp_compute_top_level_by_span_kind"] = struct{}{}
}
if v := cfg.BucketInterval; v > 0 {
acfg.BucketInterval = v
}
return acfg
}

Expand Down
1 change: 1 addition & 0 deletions connector/datadogconnector/connector_native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func creteConnectorNativeWithCfg(t *testing.T, cfg *Config) (*traceToMetricConne
creationParams := connectortest.NewNopSettings()
metricsSink := &consumertest.MetricsSink{}

cfg.Traces.BucketInterval = 1 * time.Second
tconn, err := factory.CreateTracesToMetrics(context.Background(), creationParams, cfg, metricsSink)
assert.NoError(t, err)

Expand Down
1 change: 1 addition & 0 deletions connector/datadogconnector/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func creteConnector(t *testing.T) (*traceToMetricConnector, *consumertest.Metric
creationParams := connectortest.NewNopSettings()
cfg := factory.CreateDefaultConfig().(*Config)
cfg.Traces.ResourceAttributesAsContainerTags = []string{semconv.AttributeCloudAvailabilityZone, semconv.AttributeCloudRegion, "az"}
cfg.Traces.BucketInterval = 1 * time.Second

metricsSink := &consumertest.MetricsSink{}

Expand Down
5 changes: 5 additions & 0 deletions connector/datadogconnector/examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ connectors:
## A list of resource attributes that should be used as container tags.
#
resource_attributes_as_container_tags: ["could.availability_zone", "could.region"]
## @param bucket_interval specifies the time interval size of aggregation buckets that aggregate the Datadog trace metrics.
## It is also the time interval that Datadog trace metrics payloads are flushed to the pipeline.
## Default is 10s if unset.
#
bucket_interval: 30s
exporters:
debug:
verbosity: detailed
Expand Down
Loading