diff --git a/packages/node/test/integration/breadcrumbs.test.ts b/packages/node/test/integration/breadcrumbs.test.ts index f052d1ea66d9..2f22af6f30f0 100644 --- a/packages/node/test/integration/breadcrumbs.test.ts +++ b/packages/node/test/integration/breadcrumbs.test.ts @@ -1,5 +1,4 @@ -import { addBreadcrumb, captureException, withIsolationScope, withScope } from '@sentry/core'; -import { startSpan } from '@sentry/opentelemetry'; +import { startSpan, addBreadcrumb, captureException, withIsolationScope, withScope } from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { getClient } from '../../src/'; import type { NodeClient } from '../../src/sdk/client'; diff --git a/packages/node/test/integration/scope.test.ts b/packages/node/test/integration/scope.test.ts index 20b01d6fce47..54f086fe51a2 100644 --- a/packages/node/test/integration/scope.test.ts +++ b/packages/node/test/integration/scope.test.ts @@ -1,5 +1,4 @@ -import { getCapturedScopesOnSpan, getCurrentScope } from '@sentry/core'; -import { getClient } from '@sentry/opentelemetry'; +import { getCapturedScopesOnSpan, getCurrentScope, getClient } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import * as Sentry from '../../src/'; import type { NodeClient } from '../../src/sdk/client'; diff --git a/packages/opentelemetry/src/exports.ts b/packages/opentelemetry/src/exports.ts index ef8a8844bb80..13d98a4a90ff 100644 --- a/packages/opentelemetry/src/exports.ts +++ b/packages/opentelemetry/src/exports.ts @@ -1,30 +1,8 @@ -export { getRequestSpanData } from './utils/getRequestSpanData'; - export { getScopesFromContext } from './utils/contextData'; -export { - spanHasAttributes, - spanHasEvents, - spanHasKind, - spanHasName, - spanHasParentId, - spanHasStatus, -} from './utils/spanTypes'; - -// Re-export this for backwards compatibility (this used to be a different implementation) -export { getDynamicSamplingContextFromSpan } from '@sentry/core'; - export { enhanceDscWithOpenTelemetryRootSpanName } from './utils/enhanceDscWithOpenTelemetryRootSpanName'; -export { getActiveSpan } from './utils/getActiveSpan'; -export { - startSpan, - startSpanManual, - startInactiveSpan, - withActiveSpan, - continueTrace, - getTraceContextForScope, -} from './trace'; +export { getTraceContextForScope } from './trace'; export { suppressTracing } from './utils/suppressTracing'; @@ -33,7 +11,7 @@ export { setupEventContextTrace } from './setupEventContextTrace'; // eslint-disable-next-line typescript/no-deprecated export { wrapContextManagerClass } from './contextManager'; -export { SentryPropagator, shouldPropagateTraceForUrl } from './propagator'; +export { SentryPropagator } from './propagator'; export { SentrySpanProcessor } from './spanProcessor'; export { SentrySampler, wrapSamplingDecision } from './sampler'; export { applyOtelSpanData } from './applyOtelSpanData'; @@ -44,8 +22,3 @@ export type { OpenTelemetryTracerProvider } from './types'; export { openTelemetrySetupCheck, setIsSetup } from './utils/setupCheck'; export { getSentryResource } from './resource'; - -export { withStreamedSpan } from '@sentry/core'; - -// Legacy -export { getClient } from '@sentry/core'; diff --git a/packages/opentelemetry/src/propagator.ts b/packages/opentelemetry/src/propagator.ts index c22fde1fe750..e8123813b108 100644 --- a/packages/opentelemetry/src/propagator.ts +++ b/packages/opentelemetry/src/propagator.ts @@ -132,9 +132,6 @@ export class SentryPropagator extends W3CBaggagePropagator { } } -// Re-exported from @sentry/core for backwards compatibility -export { shouldPropagateTraceForUrl } from '@sentry/core'; - /** * Get propagation injection data for the given context. * The additional options can be passed to override the scope and client that is otherwise derived from the context. diff --git a/packages/opentelemetry/src/utils/spanTypes.ts b/packages/opentelemetry/src/utils/spanTypes.ts index ea3f2c9dddc2..f9fce62f7c7f 100644 --- a/packages/opentelemetry/src/utils/spanTypes.ts +++ b/packages/opentelemetry/src/utils/spanTypes.ts @@ -1,8 +1,7 @@ -import type { SpanKind, SpanStatus } from '@opentelemetry/api'; -import type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base'; +import type { SpanStatus } from '@opentelemetry/api'; +import type { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import type { AbstractSpan } from '../types'; import { isObjectLike } from '@sentry/core'; -import { getParentSpanId } from './getParentSpanId'; /** * Check if a given span has attributes. @@ -16,16 +15,6 @@ export function spanHasAttributes( return isObjectLike(castSpan.attributes); } -/** - * Check if a given span has a kind. - * This is necessary because the base `Span` type does not have a kind, - * so in places where we are passed a generic span, we need to check if we want to access it. - */ -export function spanHasKind(span: SpanType): span is SpanType & { kind: SpanKind } { - const castSpan = span as ReadableSpan; - return typeof castSpan.kind === 'number'; -} - /** * Check if a given span has a status. * This is necessary because the base `Span` type does not have a status, @@ -47,27 +36,3 @@ export function spanHasName(span: SpanType): span const castSpan = span as ReadableSpan; return !!castSpan.name; } - -/** - * Check if a given span has a kind. - * This is necessary because the base `Span` type does not have a kind, - * so in places where we are passed a generic span, we need to check if we want to access it. - */ -export function spanHasParentId( - span: SpanType, -): span is SpanType & { parentSpanId: string } { - const castSpan = span as ReadableSpan; - return !!getParentSpanId(castSpan); -} - -/** - * Check if a given span has events. - * This is necessary because the base `Span` type does not have events, - * so in places where we are passed a generic span, we need to check if we want to access it. - */ -export function spanHasEvents( - span: SpanType, -): span is SpanType & { events: TimedEvent[] } { - const castSpan = span as ReadableSpan; - return Array.isArray(castSpan.events); -} diff --git a/packages/opentelemetry/test/utils/spanTypes.test.ts b/packages/opentelemetry/test/utils/spanTypes.test.ts index 36f88e20c03e..5dd4419411e7 100644 --- a/packages/opentelemetry/test/utils/spanTypes.test.ts +++ b/packages/opentelemetry/test/utils/spanTypes.test.ts @@ -1,6 +1,6 @@ import type { Span } from '@opentelemetry/api'; import { describe, expect, it } from 'vitest'; -import { spanHasAttributes, spanHasEvents, spanHasKind, spanHasParentId } from '../../src/utils/spanTypes'; +import { spanHasAttributes } from '../../src/utils/spanTypes'; describe('spanTypes', () => { describe('spanHasAttributes', () => { @@ -19,57 +19,4 @@ describe('spanTypes', () => { } }); }); - - describe('spanHasKind', () => { - it.each([ - [{}, false], - [{ kind: null }, false], - [{ kind: 0 }, true], - [{ kind: 5 }, true], - [{ kind: 'TEST_KIND' }, false], - ])('works with %j', (span, expected) => { - const castSpan = span as unknown as Span; - const actual = spanHasKind(castSpan); - - expect(actual).toBe(expected); - - if (actual) { - expect(castSpan.kind).toBeDefined(); - } - }); - }); - - describe('spanHasParentId', () => { - it.each([ - [{}, false], - [{ parentSpanId: null }, false], - [{ parentSpanId: 'TEST_PARENT_ID' }, true], - ])('works with %j', (span, expected) => { - const castSpan = span as unknown as Span; - const actual = spanHasParentId(castSpan); - - expect(actual).toBe(expected); - - if (actual) { - expect(castSpan.parentSpanId).toBeDefined(); - } - }); - }); - - describe('spanHasEvents', () => { - it.each([ - [{}, false], - [{ events: null }, false], - [{ events: [] }, true], - ])('works with %j', (span, expected) => { - const castSpan = span as unknown as Span; - const actual = spanHasEvents(castSpan); - - expect(actual).toBe(expected); - - if (actual) { - expect(castSpan.events).toBeDefined(); - } - }); - }); });