Skip to content

[process/elasticapmprocessor] enable service language attribute processing for traces#1151

Merged
aelnahas merged 2 commits into
elastic:mainfrom
aelnahas:add-service-default-language-trace-processing
Apr 10, 2026
Merged

[process/elasticapmprocessor] enable service language attribute processing for traces#1151
aelnahas merged 2 commits into
elastic:mainfrom
aelnahas:add-service-default-language-trace-processing

Conversation

@aelnahas

@aelnahas aelnahas commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

trace events currently do not populate the default service name for otlp ecs. This PR fixes that by enabling the enricher DefaultServiceLanguage flag

We need to set the field telemetry.sdk.language so that our exporter would map it to service.language.name

Tests

  • Updated processor tests and executed them

@aelnahas aelnahas requested review from a team as code owners April 7, 2026 15:31
@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4dd7fd36-b522-44bb-a707-ebe884417ee6

📥 Commits

Reviewing files that changed from the base of the PR and between 866d8da and 71094c1.

📒 Files selected for processing (1)
  • processor/elasticapmprocessor/processor.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • processor/elasticapmprocessor/processor.go

📝 Walkthrough

Walkthrough

Enabled DefaultServiceLanguage ECS resource enrichment for standard ECS traces in the Elastic APM processor and explicitly disabled that enrichment for intake-path traces and logs. Test fixtures were updated to add a telemetry.sdk.language: unknown resource attribute in two ECS outputs. Additional minor YAML formatting adjustments were made in a Swift crash test fixture.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR

Comment @coderabbitai help to get the list of available commands and usage tips.

@carsonip carsonip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

populate the default service name for otlp ecs

q: isn't this PR around telemetry.sdk.language?

intakeECSEnricherConfig.Transaction.Result.Enabled = false
// The `host.os.type` field should not be added for APM events
intakeECSEnricherConfig.Resource.HostOSType.Enabled = false
intakeECSEnricherConfig.Resource.DefaultServiceLanguage.Enabled = false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sorry I don't have much context. What does it mean to enable it for ecs enricher but not intake ecs enricher?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is the effect of this PR to enable default service language for otlp ecs path but not intake ecs path?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I saw it was done for the log event and potentially for the metrics event in #1122 and followed the same pattern.

From what I understood from the code, I think this is done so that we do not set a default language for apm events. That's what I understood from intake receiver mapping.

So in this context, we would only add the default service language for otlp ecs path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can add a comment so it is clearer for the next reader

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can consider dedicated methods to build each class of configs (otlp ecs vs intake ecs) if the drift gets more significant

@aelnahas

aelnahas commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

populate the default service name for otlp ecs

q: isn't this PR around telemetry.sdk.language?

Sorry I should have added that in the pr body

but we need to populate telemetry.sdk.language so that our exporter would map it to service.language.name

@carsonip

carsonip commented Apr 7, 2026

Copy link
Copy Markdown
Member

but we need to populate telemetry.sdk.language so that our o that our exporter would map it to service.language.name

I see, so it is about service language name, not service name.

@aelnahas aelnahas merged commit 9c4bc7d into elastic:main Apr 10, 2026
19 checks passed
@aelnahas aelnahas deleted the add-service-default-language-trace-processing branch April 10, 2026 14:19
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