Skip to content

Commit ec7d3a1

Browse files
committed
[connector/datadog] remove TracesConfig
1 parent 854101c commit ec7d3a1

File tree

6 files changed

+42
-18
lines changed

6 files changed

+42
-18
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: datadogconnector
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Remove `datagodconnector.TracesConfig`, use `datadogconfig.TracesConnectorConfig` instead
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [38661]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [api]

connector/datadogconnector/config.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ var _ component.Config = (*Config)(nil)
1414
// Config defines configuration for the Datadog connector.
1515
type Config struct {
1616
// Traces defines the Traces specific configuration
17-
Traces TracesConfig `mapstructure:"traces"`
17+
Traces datadogconfig.TracesConnectorConfig `mapstructure:"traces"`
1818
}
1919

20-
// Deprecated: [v0.110.0] Use `datadog.TracesConnectorConfig` instead.
21-
// TracesConfig defines the traces specific configuration options
22-
type TracesConfig = datadogconfig.TracesConnectorConfig
23-
2420
// Validate checks if the configuration is valid
2521
func (c *Config) Validate() error {
2622
return c.Traces.Validate()

connector/datadogconnector/config_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestValidate(t *testing.T) {
2121
{
2222
name: "span name remapping valid",
2323
cfg: &Config{
24-
Traces: TracesConfig{
24+
Traces: datadogconfig.TracesConnectorConfig{
2525
TracesConfig: datadogconfig.TracesConfig{
2626
SpanNameRemappings: map[string]string{"old.opentelemetryspan.name": "updated.name"},
2727
},
@@ -30,7 +30,7 @@ func TestValidate(t *testing.T) {
3030
},
3131
{
3232
name: "span name remapping empty val",
33-
cfg: &Config{Traces: TracesConfig{
33+
cfg: &Config{Traces: datadogconfig.TracesConnectorConfig{
3434
TracesConfig: datadogconfig.TracesConfig{
3535
SpanNameRemappings: map[string]string{"oldname": ""},
3636
},
@@ -39,7 +39,7 @@ func TestValidate(t *testing.T) {
3939
},
4040
{
4141
name: "span name remapping empty key",
42-
cfg: &Config{Traces: TracesConfig{
42+
cfg: &Config{Traces: datadogconfig.TracesConnectorConfig{
4343
TracesConfig: datadogconfig.TracesConfig{
4444
SpanNameRemappings: map[string]string{"": "newname"},
4545
},
@@ -48,15 +48,15 @@ func TestValidate(t *testing.T) {
4848
},
4949
{
5050
name: "ignore resources valid",
51-
cfg: &Config{Traces: TracesConfig{
51+
cfg: &Config{Traces: datadogconfig.TracesConnectorConfig{
5252
TracesConfig: datadogconfig.TracesConfig{
5353
IgnoreResources: []string{"[123]"},
5454
},
5555
}},
5656
},
5757
{
5858
name: "ignore resources missing bracket",
59-
cfg: &Config{Traces: TracesConfig{
59+
cfg: &Config{Traces: datadogconfig.TracesConnectorConfig{
6060
TracesConfig: datadogconfig.TracesConfig{
6161
IgnoreResources: []string{"[123"},
6262
},
@@ -65,21 +65,21 @@ func TestValidate(t *testing.T) {
6565
},
6666
{
6767
name: "With trace_buffer",
68-
cfg: &Config{Traces: TracesConfig{
68+
cfg: &Config{Traces: datadogconfig.TracesConnectorConfig{
6969
TraceBuffer: 10,
7070
}},
7171
},
7272
{
7373
name: "neg trace_buffer",
74-
cfg: &Config{Traces: TracesConfig{
74+
cfg: &Config{Traces: datadogconfig.TracesConnectorConfig{
7575
TraceBuffer: -10,
7676
}},
7777
err: "trace buffer must be non-negative",
7878
},
7979
{
8080
name: "With peer_tags",
8181
cfg: &Config{
82-
Traces: TracesConfig{
82+
Traces: datadogconfig.TracesConnectorConfig{
8383
TracesConfig: datadogconfig.TracesConfig{
8484
PeerTags: []string{"tag1", "tag2"},
8585
},
@@ -89,13 +89,13 @@ func TestValidate(t *testing.T) {
8989
{
9090
name: "With bucket_interval",
9191
cfg: &Config{
92-
Traces: TracesConfig{BucketInterval: 30 * time.Second},
92+
Traces: datadogconfig.TracesConnectorConfig{BucketInterval: 30 * time.Second},
9393
},
9494
},
9595
{
9696
name: "neg bucket_interval",
9797
cfg: &Config{
98-
Traces: TracesConfig{BucketInterval: -30 * time.Second},
98+
Traces: datadogconfig.TracesConnectorConfig{BucketInterval: -30 * time.Second},
9999
},
100100
err: "bucket interval must be non-negative",
101101
},

connector/datadogconnector/connector.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"go.uber.org/zap"
2727

2828
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog"
29+
datadogconfig "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/config"
2930
)
3031

3132
// traceToMetricConnector is the schema for connector
@@ -99,7 +100,7 @@ func newTraceToMetricConnector(set component.TelemetrySettings, cfg component.Co
99100
}, nil
100101
}
101102

102-
func getTraceAgentCfg(logger *zap.Logger, cfg TracesConfig, attributesTranslator *attributes.Translator) *traceconfig.AgentConfig {
103+
func getTraceAgentCfg(logger *zap.Logger, cfg datadogconfig.TracesConnectorConfig, attributesTranslator *attributes.Translator) *traceconfig.AgentConfig {
103104
acfg := traceconfig.New()
104105
acfg.OTLPReceiver.AttributesTranslator = attributesTranslator
105106
acfg.OTLPReceiver.SpanNameRemappings = cfg.SpanNameRemappings

connector/datadogconnector/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func NewFactory() connector.Factory {
4343

4444
func createDefaultConfig() component.Config {
4545
return &Config{
46-
Traces: TracesConfig{
46+
Traces: datadogconfig.TracesConnectorConfig{
4747
TracesConfig: datadogconfig.TracesConfig{
4848
IgnoreResources: []string{},
4949
PeerServiceAggregation: true,

connector/datadogconnector/factory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestCreateDefaultConfig(t *testing.T) {
1919

2020
assert.Equal(t,
2121
&Config{
22-
Traces: TracesConfig{
22+
Traces: datadogconfig.TracesConnectorConfig{
2323
TracesConfig: datadogconfig.TracesConfig{
2424
IgnoreResources: []string{},
2525
PeerServiceAggregation: true,

0 commit comments

Comments
 (0)