-
-
Notifications
You must be signed in to change notification settings - Fork 277
Closed
Labels
Description
Problem Statement
It's currently quite cumbersome to start transactions from headers on the backend.
See the following example:
final request = ...
final urlDetails = HttpSanitizer.sanitizeUrl(request.url.toString());
var description = request.method.toString();
if (urlDetails != null) {
description += ' ${urlDetails.urlOrFallback}';
}
final traceHeaderValue = request.headers['sentry-trace'];
final baggageHeaderValue = request.headers['baggage'];
SentryTransactionContext? trxContext;
if (traceHeaderValue != null) {
trxContext = SentryTransactionContext.fromSentryTrace(
description,
'http.client',
SentryTraceHeader.fromTraceHeader(traceHeaderValue),
baggage: baggageHeaderValue != null
? SentryBaggage.fromHeader(baggageHeaderValue)
: null,
);
}
final trx = trxContext != null
? Sentry.startTransactionWithContext(trxContext, bindToScope: true)
: Sentry.startTransaction(description, 'http.client', bindToScope: true);Solution Brainstorm
It would be very convenient if I can either create a SentryTransactionContext from headers, or start a transaction directly from headers with something like Sentry.startTransactionFromHeaders.
I recognize that it's probably tricky to choose what to except as cookies, since dart:io, http and dio use different formats for their headers.
Are you willing to submit a PR?
None
Metadata
Metadata
Assignees
Labels
Projects
Status
Done