Skip to content

Capture transaction name for errors (v8) #10846

Closed
@mydea

Description

@mydea

We have a transaction field on events (e.g. error events) which is used in-product for a bunch of things.

We need a way to also ensure this works in v8. We've deprecated scope.setTransactionName() but maybe need to revisit this.

Status Quo

In the JS SDK, we currently only set event.transaction in the request data integration - so only in server environments.
In Browser SDKs, we never set this today - we only set a transaction tag.

Some constraints:

  • This needs to work with and without performance/spans
  • Ideally we capture this even if a span is over.

Solution

Update: After an internal meeting, we settled on the following solution:

We un-deprecate scope.setTransactionName(), which can be used with or without performance.
In our own auto-instrumentation, we can use that to automatically set the transaction name on the scope. This can happen based on spans, or not.

Users can always overwrite it on the given scope.

Important: The scope's transaction name will no longer be coupled to root spans or spans in general. Meaning, it's purpose is to associate errors and other events with location (i.e. a transaction) and not 1:1 with a root span name. In many cases, when we auto instrument things, the names will be the same but there can be cases when these two diverge.

Examples:

  • In browser tracing integration, we update the transaction name.
  • In OTEL, we update it in http.server middlewares
  • Possibly we can also generally set it whenever a root span is started via startSpan APIs (=a span without a parent)
### Undeprecation and Decoupling
- [ ] https://github.com/getsentry/sentry-javascript/pull/10966
- [x] Un-deprecate API in `v7` (https://github.com/getsentry/sentry-javascript/pull/10964)
- [ ] https://github.com/getsentry/sentry-javascript/pull/10991
- [ ] https://github.com/getsentry/sentry-javascript/pull/11513
### Auto-Updating Scope `transactionName` (browser)
- [ ] https://github.com/getsentry/sentry-javascript/pull/10992
- [ ] https://github.com/getsentry/sentry-javascript/pull/11043
- [ ] https://github.com/getsentry/sentry-javascript/pull/11048
- [x] ember (nothing to do)
- [ ] https://github.com/getsentry/sentry-javascript/pull/11406
- [ ] https://github.com/getsentry/sentry-javascript/pull/11420
- [ ] https://github.com/getsentry/sentry-javascript/pull/11423
- [ ] https://github.com/getsentry/sentry-javascript/pull/11424
### Auto-Updating Scope transactionName (server)
- [ ] https://github.com/getsentry/sentry-javascript/pull/11434
- [ ] https://github.com/getsentry/sentry-javascript/pull/11447
- [ ] https://github.com/getsentry/sentry-javascript/pull/11448
- [ ] https://github.com/getsentry/sentry-javascript/pull/11510
- [ ] https://github.com/getsentry/sentry-javascript/pull/11476
- [ ] https://github.com/getsentry/sentry-javascript/pull/11511
- [x] https://github.com/getsentry/sentry-javascript/pull/11784
- [x] https://github.com/getsentry/sentry-javascript/pull/11782
- [ ] https://github.com/getsentry/sentry-javascript/pull/11786
- [x] Gatsby (no server-side features)

Some caveats:

  • In OTEL, unsampled spans (=the majority of spans) are NonRecordingSpans which have no name. So we can't read it off the active span (which additionally also has the downside that we can't read it once the active span is over, e.g. browser tracing).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions