Skip to content

Rename enduser attributes for v3 preview#18795

Open
trask wants to merge 5 commits into
open-telemetry:mainfrom
trask:rename-enduser-to-user
Open

Rename enduser attributes for v3 preview#18795
trask wants to merge 5 commits into
open-telemetry:mainfrom
trask:rename-enduser-to-user

Conversation

@trask
Copy link
Copy Markdown
Member

@trask trask commented May 19, 2026

Resolves #13203

Summary

  • emit user.id and user.roles instead of deprecated enduser.* attributes when v3 preview is enabled
  • gate common identity config names so default mode reads enduser.* and v3 preview reads user.*
  • update servlet and Spring Security coverage/docs for the v3 preview behavior

@trask trask marked this pull request as ready for review May 19, 2026 04:27
@trask trask requested a review from a team as a code owner May 19, 2026 04:27
Copilot AI review requested due to automatic review settings May 19, 2026 04:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.roles in v3 preview mode (and suppress enduser.scope in v3 preview), while retaining enduser.* by default.
  • Add config gating so “common identity” enablement reads enduser.* in default mode and user.* 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Comment thread instrumentation/spring/spring-security-config-6.0/metadata.yaml Outdated
@trask trask force-pushed the rename-enduser-to-user branch from eabd7a6 to 119d256 Compare May 19, 2026 05:02
@trask trask requested a review from Copilot May 19, 2026 05:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

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

Change enduser.* attributes to user.* in 3.0

2 participants