Skip to content

Commit 7ae85a5

Browse files
committed
fix: update channel names and always end the spans
1 parent 004200b commit 7ae85a5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/nitro/src/runtime/hooks/captureTracingEvents.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ function onTraceEnd(data: { span?: Span; result?: unknown }): void {
5757
const statusCode = getResponseStatusCode(data.result);
5858
if (data.span && statusCode !== undefined) {
5959
setHttpStatus(data.span, statusCode);
60-
data.span.end();
6160
}
61+
62+
data.span?.end();
6263
}
6364

6465
function onTraceError(data: { span?: Span; error: unknown }): void {
@@ -68,7 +69,7 @@ function onTraceError(data: { span?: Span; error: unknown }): void {
6869
}
6970

7071
function setupH3TracingChannels(): void {
71-
const h3Channel = tracingChannel<H3TracingRequestEvent>('h3.fetch', data => {
72+
const h3Channel = tracingChannel<H3TracingRequestEvent>('h3.request', data => {
7273
const parsedUrl = parseStringToURLObject(data.event.url.href);
7374
const [spanName, urlAttributes] = getHttpSpanDetailsFromUrlObject(parsedUrl, 'server', 'auto.http.nitro.h3', {
7475
method: data.event.req.method,
@@ -100,7 +101,7 @@ function setupSrvxTracingChannels(): void {
100101
// This ensures they all appear as siblings in the trace
101102
let requestParentSpan: Span | null = null;
102103

103-
const fetchChannel = tracingChannel<SrvxRequestEvent>('srvx.fetch', data => {
104+
const fetchChannel = tracingChannel<SrvxRequestEvent>('srvx.request', data => {
104105
const parsedUrl = data.request._url ? parseStringToURLObject(data.request._url.href) : undefined;
105106
const [spanName, urlAttributes] = getHttpSpanDetailsFromUrlObject(parsedUrl, 'server', 'auto.http.nitro.srvx', {
106107
method: data.request.method,

0 commit comments

Comments
 (0)