Skip to content

Commit

Permalink
elasticsearchexporter: remove dedup config
Browse files Browse the repository at this point in the history
This config setting has been deprecated for 6 months
and can be safely removed now.
  • Loading branch information
axw committed Jan 16, 2025
1 parent 0788185 commit 2be47b5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 46 deletions.
3 changes: 0 additions & 3 deletions exporter/elasticsearchexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ behaviours, which may be configured through the following settings:
It works only for logs where the log record body is a map. Each LogRecord
body is serialized to JSON as-is and becomes a separate document for ingestion.
If the log record body is not a map, the exporter will log a warning and drop the log record.
- `dedup` (DEPRECATED). This configuration is deprecated and non-operational,
and will be removed in the future. Object keys are always deduplicated to
avoid Elasticsearch rejecting documents.
- `dedot` (default=true; DEPRECATED, in future dedotting will always be enabled
for ECS mode, and never for other modes): When enabled attributes with `.`
will be split into proper json objects.
Expand Down
10 changes: 0 additions & 10 deletions exporter/elasticsearchexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,6 @@ type MappingsSettings struct {
// Mode configures the field mappings.
Mode string `mapstructure:"mode"`

// Dedup is non-operational, and will be removed in the future.
//
// Deprecated: [v0.104.0] deduplication is always enabled, and cannot be
// disabled. Disabling deduplication is not meaningful, as Elasticsearch
// will always reject documents with duplicate JSON object keys.
Dedup *bool `mapstructure:"dedup,omitempty"`

// Deprecated: [v0.104.0] dedotting will always be applied for ECS mode
// in future, and never for other modes. Elasticsearch's "dot_expander"
// Ingest processor may be used as an alternative for non-ECS modes.
Expand Down Expand Up @@ -363,9 +356,6 @@ func (cfg *Config) MappingMode() MappingMode {
}

func handleDeprecatedConfig(cfg *Config, logger *zap.Logger) {
if cfg.Mapping.Dedup != nil {
logger.Warn("dedup is deprecated, and is always enabled")
}
if cfg.Mapping.Dedot && cfg.MappingMode() != MappingECS || !cfg.Mapping.Dedot && cfg.MappingMode() == MappingECS {
logger.Warn("dedot has been deprecated: in the future, dedotting will always be performed in ECS mode only")
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/elasticsearchexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func TestExporterLogs(t *testing.T) {

exporter := newTestLogsExporter(t, server.URL, func(cfg *Config) {
cfg.Mapping.Mode = "raw"
// dedup is the default
// deduplication is always performed - there is no configuration that controls it
})
logs := newLogsWithAttributes(
// Scope collides with the top-level "Scope" field,
Expand Down
32 changes: 0 additions & 32 deletions exporter/elasticsearchexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,6 @@ func TestFactory_CreateTraces(t *testing.T) {
require.NoError(t, exporter.Shutdown(context.Background()))
}

func TestFactory_DedupDeprecated(t *testing.T) {
factory := NewFactory()
cfg := withDefaultConfig(func(cfg *Config) {
dedup := false
cfg.Endpoint = "http://testing.invalid:9200"
cfg.Mapping.Dedup = &dedup
cfg.Mapping.Dedot = false // avoid dedot warnings
})

loggerCore, logObserver := observer.New(zap.WarnLevel)
set := exportertest.NewNopSettings()
set.Logger = zap.New(loggerCore)

logsExporter, err := factory.CreateLogs(context.Background(), set, cfg)
require.NoError(t, err)
require.NoError(t, logsExporter.Shutdown(context.Background()))

tracesExporter, err := factory.CreateTraces(context.Background(), set, cfg)
require.NoError(t, err)
require.NoError(t, tracesExporter.Shutdown(context.Background()))

metricsExporter, err := factory.CreateMetrics(context.Background(), set, cfg)
require.NoError(t, err)
require.NoError(t, metricsExporter.Shutdown(context.Background()))

records := logObserver.AllUntimed()
assert.Len(t, records, 3)
assert.Equal(t, "dedup is deprecated, and is always enabled", records[0].Message)
assert.Equal(t, "dedup is deprecated, and is always enabled", records[1].Message)
assert.Equal(t, "dedup is deprecated, and is always enabled", records[2].Message)
}

func TestFactory_DedotDeprecated(t *testing.T) {
loggerCore, logObserver := observer.New(zap.WarnLevel)
set := exportertest.NewNopSettings()
Expand Down

0 comments on commit 2be47b5

Please sign in to comment.