Skip to content

Can't update root span name when using orpc integration #65

@nadilas

Description

@nadilas

What is the problem this feature would solve?

Right now the route is preferred when creating the root span name, for orpc handlers this becomes: GET /v1*

The underlying path however is: /v1/process/prc_01kadyd/schema

ctx: {
  "traceId": "2b2822f1bc4af90e1a339f9edc42a02f",
  "spanId": "ed3cd7e61617e082",
  "traceFlags": 1,
  "traceState": {
    "_internalState": {}
  }
}
path: "/v1/process/prc_01kadyd/schema"
route: "/v1*"

I would like to expose the path instead of the route so that the traces and spans become more readable in sentry.

What is the feature you are proposing to solve the problem?

I tried to do a one-liner fix on local:

        onTransform(() => {
          const { cookie, request, route, path } = context

          if (route) {
            rootSpan.updateName(
              // @ts-ignore private property
              `${method} ${route?.includes('*') ? path : route || path}`,
            )
          }

          if (context.route) attributes['http.route'] = context.route

But for some reason the root span still gets named after the route, despite the update executing.

Image

What alternatives have you considered?

Exposing a getRootSpan() method to allow access to users for updateName before returning from the main handler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions