-
Notifications
You must be signed in to change notification settings - Fork 2
New - Prefer detected service name to service key one in azure app service #540
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
Open
cleverchuk
wants to merge
1
commit into
main
Choose a base branch
from
cc/NH-138965
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Prefer detected service name to service key name in Azure App Service | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need this file checked in? ;) |
||
|
|
||
| ## Summary | ||
|
|
||
| Centralizes service name resolution into `ResourceCustomizer` and introduces environment-aware precedence: on **Azure App Service**, the OTel-detected service name takes priority over the name embedded in the service key. For all other environments, the service key name continues to win. The service key is then updated to stay in sync with the resolved name. | ||
|
|
||
| --- | ||
|
|
||
| ## What changed and why | ||
|
|
||
| ### Service name resolution moved to `ResourceCustomizer` | ||
|
|
||
| The service name synchronization logic was previously duplicated in both `ConfigurationLoader` and `LambdaConfigurationLoader`. It ran during config loading — before OTel resource detection — which meant it could not see Azure-injected resource attributes. Both copies have been removed, and the logic now lives entirely in `ResourceCustomizer.apply()`, which runs after resource detection. | ||
|
|
||
| ### Azure App Service gets detected name precedence | ||
|
|
||
| Azure App Service uses OTel resource detection to inject a meaningful `service.name` (the app name). The old logic always overwrote this with the service key name. | ||
|
|
||
| The new `getServiceName` method applies this rule: | ||
|
|
||
| - **Default (non-Azure, no explicit `otel.service.name`)**: service key name wins. | ||
| - **Azure App Service** (`cloud.platform = azure.app_service`): detected name wins, _unless_ it is `null` or starts with `unknown_` (i.e., the OTel SDK fallback placeholder), in which case the service key name is used. | ||
| - **Explicit `otel.service.name` set**: detected/config name wins in all environments. | ||
|
|
||
| ### Service key kept in sync | ||
|
|
||
| After resolving the final service name, `updateServiceKey()` rewrites the service key as `{apiKey}:{resolvedName}`. This ensures the collector receives a consistent key regardless of which name source won. | ||
|
|
||
| ### Dependency exclusions for `opentelemetry-cel-sampler` | ||
|
|
||
| Guava and protobuf are now excluded from the `opentelemetry-cel-sampler` transitive dependency tree. Both are already on the classpath via the agent and were causing version conflicts at runtime. | ||
|
|
||
| ### Smoke test validation log removed | ||
|
|
||
| The old debug log line (`"This log line is used for validation only: service.name: ..."`) has been replaced with a proper `info` log (`"Resolved service name: ..."`) and the smoke test assertions referencing the old line have been removed. | ||
|
|
||
| ### `HttpSettingsReader` debug log enriched | ||
|
|
||
| The debug log now includes `serviceName` and `hostname` alongside the fetched settings, making it easier to correlate settings fetches with the service identity at the time of the call. | ||
|
|
||
| --- | ||
|
|
||
| ## Version | ||
|
|
||
| Bumped `swoAgentVersion` from `3.2.0` → `3.3.0`. | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.