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

Translate OTEL log's InstrumentationScope as logger name #416

Closed
wants to merge 1 commit into from

Conversation

oldium
Copy link

@oldium oldium commented Dec 18, 2024

InstrumentationScope usually contains the name of the instrumentation library. However, in the case of logs, it may also contain the name of the logger if the log source defines it, see here. An instrumentation library usually has a version set, so assume that the name without the version is the name of the logger.

@oldium oldium requested a review from a team as a code owner December 18, 2024 15:33
Copy link

cla-checker-service bot commented Dec 18, 2024

💚 CLA has been signed

@oldium
Copy link
Author

oldium commented Dec 18, 2024

Signed the agreement

InstrumentationScope usually contains the name of the instrumentation
library. However, in the case of logs, it may also contain the name of the
logger if the log source defines it, see [here][1]. An instrumentation
library usually has a version set, so assume that the name without the
version is the name of the logger.

[1]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/api.md#get-a-logger

Signed-off-by: Oldřich Jedlička <[email protected]>
@oldium
Copy link
Author

oldium commented Feb 5, 2025

Anybody here?

Copy link
Member

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

Sorry for the delayed response. I'll have to check with the team and see whether introducing an assumption around "a missing version = scope name is a logger name" is desirable. Meanwhile, do you mind adding a unit test for the logic?

@oldium
Copy link
Author

oldium commented Feb 5, 2025

I'll have to check with the team and see whether introducing an assumption around "a missing version = scope name is a logger name" is desirable.

Yes, please. The Instrumentation Scope field is unfortunately shared with Logger Name as intended...

Meanwhile, do you mind adding a unit test for the logic?

Yes, sure.

@carsonip
Copy link
Member

carsonip commented Feb 6, 2025

@oldium thanks for the PR. While this PR fixes your use case, it might be a breaking change for some users relying on this behavior. In fact, this is an inherent issue stemming from how apm server converts some known OTel fields to the closest APM field.

At Elastic, we are actively working on an OTel-native ingestion solution named EDOT as an alternative to APM server. See docs for EDOT and a blog post for EDOT collector for more details. EDOT collector accepts otlp, sends to Elasticsearch directly, bypassing APM Server, and stores them in an OpenTelemetry native format, e.g. scope name will be stored in scope.name, resource attributes will be under resource.attributes.*, while having APM UI work out of the box.

Alternatively, if you prefer to stick with APM Server, you may set an ingest pipeline for logs to unset service.framework.name and set log.logger if service.framework.version == nil, which would yield the same result as your PR. See docs on ingest pipelines.

Closing this PR but let me know if you have any questions.

@carsonip carsonip closed this Feb 6, 2025
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.

2 participants