Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/datadog] Remove Config.OnlyMetadata and APIConfig.GetCensoredKey #8980

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
- `filelogreceiver`, `journaldreceiver`, `syslogreceiver`, `tcplogreceiver`, `udplogreceiver`:
- Updated data model to align with stable logs data model, which includes various breaking changes. (#8835)
- A detailed [Upgrade Guide](https://github.com/open-telemetry/opentelemetry-log-collection/releases/tag/v0.28.0) is available in the log-collection v0.28.0 release notes.
- `datadogexporter`: Remove `OnlyMetadata` method from `Config` struct (#8980)
- `datadogexporter`: Remove `GetCensoredKey` method from `APIConfig` struct (#8980)

### 🧰 Bug fixes 🧰

- `hostmetricsreceiver`: Use cpu times for time delta in cpu.utilization calculation (#8856)
Expand Down
20 changes: 0 additions & 20 deletions exporter/datadogexporter/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"fmt"
"regexp"
"strings"
"sync"

"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/confignet"
Expand Down Expand Up @@ -61,15 +60,6 @@ type APIConfig struct {
Site string `mapstructure:"site"`
}

// GetCensoredKey returns the API key censored for logging purposes.
// Deprecated: [v0.48.0] Will be removed in v0.49.0.
func (api *APIConfig) GetCensoredKey() string {
if len(api.Key) <= 5 {
return api.Key
}
return strings.Repeat("*", len(api.Key)-5) + api.Key[len(api.Key)-5:]
}

// MetricsConfig defines the metrics exporter specific configuration options
type MetricsConfig struct {
// Quantiles states whether to report quantiles from summary metrics.
Expand Down Expand Up @@ -311,20 +301,10 @@ type Config struct {
// Disable this in the Collector if you are using an agent-collector setup.
UseResourceMetadata bool `mapstructure:"use_resource_metadata"`

// onceMetadata ensures only one exporter (metrics/traces) sends host metadata
onceMetadata sync.Once

// warnings stores non-fatal configuration errors.
warnings []error
}

// OnceMetadata gets a sync.Once instance used for initializing the host metadata.
// Deprecated: [v0.48.0] do not use, will be removed on v0.49.0.
// TODO (#8373): Remove this method.
func (c *Config) OnceMetadata() *sync.Once {
return &c.onceMetadata
}

// Sanitize tries to sanitize a given configuration
func (c *Config) Sanitize(logger *zap.Logger) error {
if c.TagsConfig.Env == "" {
Expand Down
12 changes: 0 additions & 12 deletions exporter/datadogexporter/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,6 @@ func TestInvalidHostname(t *testing.T) {
require.Error(t, err)
}

func TestCensorAPIKey(t *testing.T) {
cfg := APIConfig{
Key: "ddog_32_characters_long_api_key1",
}

assert.Equal(
t,
"***************************_key1",
cfg.GetCensoredKey(),
)
}

func TestIgnoreResourcesValidation(t *testing.T) {
validCfg := Config{Traces: TracesConfig{IgnoreResources: []string{"[123]"}}}
invalidCfg := Config{Traces: TracesConfig{IgnoreResources: []string{"[123"}}}
Expand Down
6 changes: 0 additions & 6 deletions exporter/datadogexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ func (f *factory) createMetricsExporter(
go metadata.Pusher(ctx, set, newMetadataConfigfromConfig(cfg), attrs)
})

// Consume configuration sync.Once to preserve behavior.
// TODO (#8373): Remove this call.
cfg.OnceMetadata().Do(func() {})
return nil
}
} else {
Expand Down Expand Up @@ -204,9 +201,6 @@ func (f *factory) createTracesExporter(
go metadata.Pusher(ctx, set, newMetadataConfigfromConfig(cfg), attrs)
})

// Use configuration sync.Once to do nothing to preserve behavior.
// TODO (#8373): Remove this call.
cfg.OnceMetadata().Do(func() {})
return nil
}
} else {
Expand Down
4 changes: 0 additions & 4 deletions exporter/datadogexporter/metrics_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ func (exp *metricsExporter) PushMetricsData(ctx context.Context, md pdata.Metric
}
go metadata.Pusher(exp.ctx, exp.params, newMetadataConfigfromConfig(exp.cfg), attrs)
})

// Consume configuration's sync.Once to preserve behavior.
// TODO (#8373): Remove this function call.
exp.cfg.OnceMetadata().Do(func() {})
}

consumer := metrics.NewConsumer()
Expand Down
4 changes: 0 additions & 4 deletions exporter/datadogexporter/traces_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ func (exp *traceExporter) pushTraceData(
}
go metadata.Pusher(exp.ctx, exp.params, newMetadataConfigfromConfig(exp.cfg), attrs)
})

// Consume configuration's sync.Once to preserve behavior.
// TODO (#8373): Remove this function call.
exp.cfg.OnceMetadata().Do(func() {})
}

// convert traces to datadog traces and group trace payloads by env
Expand Down