Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/node/src/integrations/http.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ClientRequest, IncomingMessage, RequestOptions, ServerResponse } from 'node:http';
import type { Span } from '@opentelemetry/api';
import { diag } from '@opentelemetry/api';
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
import { addOpenTelemetryInstrumentation } from '@sentry/opentelemetry';

Expand All @@ -23,6 +24,8 @@ import { getRequestUrl } from '../utils/getRequestUrl';

const INTEGRATION_NAME = 'Http';

const INSTRUMENTATION_NAME = '@opentelemetry_sentry-patched/instrumentation-http';

interface HttpOptions {
/**
* Whether breadcrumbs should be recorded for requests.
Expand Down Expand Up @@ -195,6 +198,17 @@ export const instrumentHttp = Object.assign(
},
});

// We want to update the logger namespace so we can better identify what is happening here
try {
_httpInstrumentation['_diag'] = diag.createComponentLogger({
namespace: INSTRUMENTATION_NAME,
});

// @ts-expect-error This is marked as read-only, but we overwrite it anyhow
_httpInstrumentation.instrumentationName = INSTRUMENTATION_NAME;
} catch {
// ignore errors here...
}
addOpenTelemetryInstrumentation(_httpInstrumentation);
},
{
Expand Down