Rename enduser attributes for v3 preview#18795
Open
trask wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates identity attribute emission to align with Semantic Conventions v3 preview by switching from deprecated enduser.* attributes to user.* equivalents when otel.instrumentation.common.v3-preview is enabled, while keeping legacy behavior by default.
Changes:
- Emit
user.id/user.rolesin v3 preview mode (and suppressenduser.scopein v3 preview), while retainingenduser.*by default. - Add config gating so “common identity” enablement reads
enduser.*in default mode anduser.*in v3 preview mode. - Update Spring Security + Servlet implementations, docs, and test coverage (including running tests in both default and v3 preview modes).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| instrumentation/spring/spring-security-config-6.0/metadata.yaml | Documents v3 preview behavior and adds user.* config options alongside legacy enduser.*. |
| instrumentation/spring/spring-security-config-6.0/library/src/test/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/webflux/EnduserAttributesCapturingWebFilterTest.java | Updates assertions to accept user.* vs enduser.* depending on v3 preview. |
| instrumentation/spring/spring-security-config-6.0/library/src/test/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/servlet/EnduserAttributesCapturingServletFilterTest.java | Updates assertions for v3 preview and adjusts deprecation suppression placement. |
| instrumentation/spring/spring-security-config-6.0/library/src/test/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerTest.java | Expands tests to validate attribute renames under v3 preview. |
| instrumentation/spring/spring-security-config-6.0/library/src/main/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturer.java | Implements runtime switch to emit user.id / user.roles in v3 preview and skip scopes. |
| instrumentation/spring/spring-security-config-6.0/library/README.md | Documents default vs v3 preview identity attribute behavior. |
| instrumentation/spring/spring-security-config-6.0/library/build.gradle.kts | Adds a testV3Preview task and wires it into check to run tests under v3 preview. |
| instrumentation/spring/spring-security-config-6.0/javaagent/README.md | Documents v3 preview behavior and the new otel.instrumentation.common.user.* enablement keys. |
| instrumentation/spring/spring-security-config-6.0/javaagent/build.gradle.kts | Adds a testV3Preview task that enables v3 preview + user.* configs, and runs it under check. |
| instrumentation/servlet/servlet-common/library/src/main/java/io/opentelemetry/instrumentation/servlet/internal/ServletAdditionalAttributesExtractor.java | Switches emitted principal attribute from enduser.id to user.id when v3 preview is enabled. |
| instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/common/BaseServletHelper.java | Switches server span principal attribute from enduser.id to user.id in v3 preview. |
| instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/SemconvStability.java | Allows v3 preview to be enabled via system property fallback (otel.instrumentation.common.v3-preview). |
| instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfigTest.java | Adds coverage validating config selection between enduser.* and user.* based on v3 preview. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java | Implements v3 preview config switching to user.* and disables scope in v3 preview. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java | Propagates v3_preview into EnduserConfig so identity config gating matches preview mode. |
eabd7a6 to
119d256
Compare
| Principal principal = accessor.getRequestUserPrincipal(request); | ||
| if (principal != null) { | ||
| serverSpan.setAttribute(ENDUSER_ID, principal.getName()); | ||
| serverSpan.setAttribute(v3Preview() ? USER_ID : ENDUSER_ID, principal.getName()); |
Comment on lines
+7
to
+8
| is enabled, `enduser.id` is emitted as `user.id`, `enduser.role` is emitted as `user.roles`, | ||
| and `enduser.scope` is not emitted. |
Comment on lines
+7
to
+8
| `otel.instrumentation.common.v3-preview` is enabled, it emits `user.id` and `user.roles` instead, | ||
| and `enduser.scope` is not supported. |
| from Spring Security `Authentication` objects. | ||
|
|
||
| By default this instrumentation emits the deprecated `enduser.*` attributes when enabled. When | ||
| `otel.instrumentation.common.v3-preview` is enabled, it emits `user.id` and `user.roles` instead, |
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.
Resolves #13203
Summary
user.idanduser.rolesinstead of deprecatedenduser.*attributes when v3 preview is enabledenduser.*and v3 preview readsuser.*