fix(openfeature): read OTEL_SERVICE_NAME for metrics resource#11424
Open
sameerank wants to merge 3 commits into
Open
fix(openfeature): read OTEL_SERVICE_NAME for metrics resource#11424sameerank wants to merge 3 commits into
sameerank wants to merge 3 commits into
Conversation
Contributor
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
Contributor
|
greghuels
approved these changes
May 20, 2026
dd-oleksii
approved these changes
May 20, 2026
Apply google-java-format to FlagEvalMetrics.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Reads the
OTEL_SERVICE_NAMEenvironment variable and sets it as theservice.nameresource attribute when exporting OTLP metrics fromFlagEvalMetrics.Motivation
The OpenTelemetry SDK's
Resource.getDefault()only providesunknown_service:javaas the service name. This causes OTLP metrics to be exported with an incorrect service name, making it difficult to identify which service the metrics belong to.This fix reads
OTEL_SERVICE_NAMEfrom the environment (the standard OTel env var) and merges it with the default resource, ensuring metrics are properly attributed to the correct service.For comparison, the service name in dd-trace-go is set in
ddmetric.NewMeterProvider()with priority:DD_SERVICE→DD_TAGS[service]→OTEL_SERVICE_NAME(https://github.com/DataDog/dd-trace-go/blob/fb5394071eff386cdba3517dc9acb9641bac1d7e/ddtrace/opentelemetry/metric/resource.go#L41). Meanwhile Java created its ownSdkMeterProviderwith justResource.getDefault().Additional Notes
Resource.getDefault()ifOTEL_SERVICE_NAMEis not setConfigHelper.env()for consistent environment variable handlingContributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issue