user.id attribute on all traces and logs. This makes it easy to correlate telemetry data back to the user who triggered it.
User context is enabled by default.
How it appears in traces
When a user is authenticated, theuser.id attribute is set on the root span of each trace. Any observability backend that supports OpenTelemetry attributes — such as Jaeger, Grafana Tempo, or Honeycomb — will display this attribute alongside the span.
Disabling user context
If your application has privacy requirements that prevent you from recording user identifiers in telemetry data, disable user context with:config/opentelemetry.php:
Custom resolver
By default, onlyuser.id is recorded. You can customize which attributes are collected by registering a resolver in your service provider’s boot method:
Authenticatable instance and must return an associative array of attribute key-value pairs. All returned attributes are added to every root span and log record while that user is authenticated.
Be mindful of which attributes you include. Attributes like
user.email can be useful for debugging, but consider your privacy policy and data retention rules before adding personally identifiable information to traces.