def METHOD_NAME(user, request):
    if otel_is_enabled():
        span = get_current_span()
        def _set(name, attr, source, set_baggage=False):
            try:
                value = attrgetter(attr)(source)
            except AttributeError:
                value = None
            if value:
                span.set_attribute(name, value)
                if set_baggage:
                    context.attach(baggage.set_baggage(name, value))
        _set("user.id", "id", user, set_baggage=True)
        _set("user.untrusted_client_session_id", "untrusted_client_session_id", user)
        _set("user.token_id", "user_token.id", request)