Skip to content

Conversation

@jlind23
Copy link
Contributor

@jlind23 jlind23 commented Jan 6, 2026

Description

Marked the manually provided mapping mode as deprecated, config can still be supplied but will be ignored.
We will then default to otel mapping if no header nor attributes are specified.

Link to tracking issue

Fixes #45246

Testing

Tests were updated in order to validate the new behavior, tests that were passing option via config file were updated in order to rely on the header instead.

Documentation

Elasticsearch exporter readme file was updated in order to add migration steps to help users move away from file provided configuration.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 6, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Contributor

@carsonip carsonip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

elasticsearch:
endpoint: https://elasticsearch:9200
auth:
authenticator: headers_setter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending testing whether this works

case 0:
return e.defaultMappingMode, nil
if e.defaultMappingMode != MappingOTel {
e.set.Logger.Warn("mapping mode can no longer be supplied via config file. Use the `X-Elastic-Mapping-Mode` client metadata key or the `elastic.mapping.mode` scope attribute instead.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally a bit conflicted about the per-request warning on deprecated mapping mode but given the impact it might be reasonable.

if e.defaultMappingMode != MappingOTel {
e.set.Logger.Warn("mapping mode can no longer be supplied via config file. Use the `X-Elastic-Mapping-Mode` client metadata key or the `elastic.mapping.mode` scope attribute instead.")
}
return MappingOTel, nil
Copy link
Contributor

@carsonip carsonip Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[likely no-op] If we do not need per-request warning, it'll be better if we propagate the hardcoded default to up to newExporter instead of passing it into getRequestMappingMode then ignoring it.

@jlind23 jlind23 marked this pull request as ready for review January 6, 2026 13:30
@jlind23 jlind23 requested a review from a team as a code owner January 6, 2026 13:30
@jlind23 jlind23 requested a review from MovieStoreGuy January 6, 2026 13:30

Since the `mapping::mode` config option is deprecated, use one of the following methods to set the mapping mode:

**Option 1: Using client metadata via headers_setter extension**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this and I'm afraid this doesn't work. The headers_setter sets HTTP and gRPC headers to outgoing requests, and in this case, any HTTP requests from es exporter to ES, by wrapping the HTTP roundtrip. Therefore, the header won't be available to es exporter. For header setter to work, it needs to happen before the pipeline, i.e. in otlp exporter with header setter, then in this pipeline's otlp receiver with include_metadata, so that the header is transformed into context metadata, which will then be available to es exporter.

Unless there are easier ways to inject client metadata, I suggest we either remove this option in the section, or simply describe how it needs to happen before the pipeline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, I agree with your statement and think that we should remove this option and keep the other one instead in order to keep things simple.

Copy link
Contributor

@carsonip carsonip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks

@carsonip
Copy link
Contributor

carsonip commented Jan 6, 2026

/rerun

Copy link
Contributor

@axw axw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlind23 code changes look good, but per https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#configuration-changes-1 we should deprecate first and make the breaking change (i.e. ignoring config) in a subsequent release.

@jlind23
Copy link
Contributor Author

jlind23 commented Jan 7, 2026

Thanks @axw - Created this #45262 in order to add a deprecation warning as a first step before ignoring the provided config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove the ability to set ES exporter mapping mode via config file

5 participants