Skip to content

Commit

Permalink
feat(opentelemetry): Export getRequestSpanData (#11508)
Browse files Browse the repository at this point in the history
Instead of exporting `_INTERNAL` here, it's OK IMHO to export this. The
API is stable enough.
  • Loading branch information
mydea authored Apr 9, 2024
1 parent cdf20be commit 4759d4c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/node/src/integrations/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
setCapturedScopesOnSpan,
spanToJSON,
} from '@sentry/core';
import { _INTERNAL, getClient, getSpanKind } from '@sentry/opentelemetry';
import { getClient, getRequestSpanData, getSpanKind } from '@sentry/opentelemetry';
import type { IntegrationFn } from '@sentry/types';

import { stripUrlQueryAndFragment } from '@sentry/utils';
Expand Down Expand Up @@ -162,7 +162,7 @@ function _addRequestBreadcrumb(span: Span, response: HTTPModuleRequestIncomingMe
return;
}

const data = _INTERNAL.getRequestSpanData(span);
const data = getRequestSpanData(span);
addBreadcrumb(
{
category: 'http',
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/integrations/node-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SpanKind } from '@opentelemetry/api';
import type { Instrumentation } from '@opentelemetry/instrumentation';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { addBreadcrumb, defineIntegration } from '@sentry/core';
import { _INTERNAL, getSpanKind } from '@sentry/opentelemetry';
import { getRequestSpanData, getSpanKind } from '@sentry/opentelemetry';
import type { IntegrationFn } from '@sentry/types';
import { logger } from '@sentry/utils';
import { DEBUG_BUILD } from '../debug-build';
Expand Down Expand Up @@ -88,7 +88,7 @@ function _addRequestBreadcrumb(span: Span): void {
return;
}

const data = _INTERNAL.getRequestSpanData(span);
const data = getRequestSpanData(span);
addBreadcrumb({
category: 'http',
data: {
Expand Down
12 changes: 1 addition & 11 deletions packages/opentelemetry/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getRequestSpanData } from './utils/getRequestSpanData';
export { getRequestSpanData } from './utils/getRequestSpanData';

export type { OpenTelemetryClient } from './types';
export { wrapClientClass } from './custom/client';
Expand Down Expand Up @@ -39,13 +39,3 @@ export { openTelemetrySetupCheck } from './utils/setupCheck';

// Legacy
export { getClient } from '@sentry/core';

/**
* The following internal utils are not considered public API and are subject to change.
* @hidden
*/
const _INTERNAL = {
getRequestSpanData,
} as const;

export { _INTERNAL };

0 comments on commit 4759d4c

Please sign in to comment.