Skip to content

Conversation

@isaacaflores2
Copy link
Contributor

@isaacaflores2 isaacaflores2 commented Jan 26, 2026

Overview

The span.id attribute was previously added to Elastic Transactions in #251 to match legacy apm-data behavior, but this attribute is not always needed (example: x-elastic-mapping-mode: otel)
Adding a config so that this enrichment can be controlled

The span.id enrichment for Elastic Transaction is no longer need since Elasticsearch Exporter will continue to add the span.id attribute for the ECS mapping mode

@isaacaflores2 isaacaflores2 requested review from a team and gregkalapos January 26, 2026 17:50
Copy link
Member

@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.

@isaacaflores2 Couldn't we just set clear_span_id: false, so the top-level SpanID field is set?

@isaacaflores2
Copy link
Contributor Author

@axw I tried that but that did not help.
The top level span.id is always added due to the otel data plugin here

The issue I am trying to fix is that the final index document has attributes.span.id added since it was present has a span attribute (my understanding is the otel data plugin is adding attributes.* here).

@axw
Copy link
Member

axw commented Jan 27, 2026

@isaacaflores2 just to make sure we're on the same page, I should have said:

  1. Remove this line:
		attribute.PutStr(span.Attributes(), elasticattr.SpanID, transactionID)
  1. And set clear_span_id: false

So the outcome is that we'll never set attributes.span.id, and the only choice is whether or not span.id is set.

Does that work/make sense?

@isaacaflores2
Copy link
Contributor Author

isaacaflores2 commented Jan 27, 2026

Ah I see now @axw . I added this line previously to achieve parity with apm-data.

		attribute.PutStr(span.Attributes(), elasticattr.SpanID, transactionID)

So we would like this attribute when the mapping-mode is ecs but not otel. My goal here is to have the option to have it present based on a specific collector configuration (two separate pipelines that use two different elasticapm processors).

@isaacaflores2 isaacaflores2 changed the title Add elastic_transaction::span_id config to control Elastic transaction span.id attribute Remove span.id enrichment for Elastic Transactions Jan 27, 2026
@isaacaflores2
Copy link
Contributor Author

@axw I updated to remove attribute.PutStr(span.Attributes(), elasticattr.SpanID, transactionID). Thanks again!

Copy link
Member

@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.

thanks :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants