@sentry/opentelemetry 10.68.0 → 11.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +2 -15
  2. package/build/cjs/index.js +844 -95
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/esm/index.js +837 -58
  5. package/build/esm/index.js.map +1 -1
  6. package/build/esm/package.json +1 -1
  7. package/build/types/applyOtelSpanData.d.ts +1 -4
  8. package/build/types/applyOtelSpanData.d.ts.map +1 -1
  9. package/build/types/asyncContextStrategy.d.ts +2 -4
  10. package/build/types/asyncContextStrategy.d.ts.map +1 -1
  11. package/build/types/asyncLocalStorageContextManager.d.ts +16 -4
  12. package/build/types/asyncLocalStorageContextManager.d.ts.map +1 -1
  13. package/build/types/constants.d.ts +0 -10
  14. package/build/types/constants.d.ts.map +1 -1
  15. package/build/types/index.d.ts +8 -4
  16. package/build/types/index.d.ts.map +1 -1
  17. package/build/types/propagator.d.ts +12 -33
  18. package/build/types/propagator.d.ts.map +1 -1
  19. package/build/types/trace.d.ts +1 -27
  20. package/build/types/trace.d.ts.map +1 -1
  21. package/build/types/tracer.d.ts.map +1 -1
  22. package/build/types/tracerProvider.d.ts +0 -9
  23. package/build/types/tracerProvider.d.ts.map +1 -1
  24. package/build/types/types.d.ts +2 -21
  25. package/build/types/types.d.ts.map +1 -1
  26. package/build/types/utils/TraceState.d.ts.map +1 -1
  27. package/build/types/utils/backfillStreamedSpanData.d.ts +1 -3
  28. package/build/types/utils/backfillStreamedSpanData.d.ts.map +1 -1
  29. package/build/types/utils/mapStatus.d.ts +0 -6
  30. package/build/types/utils/mapStatus.d.ts.map +1 -1
  31. package/build/types/utils/parseSpanDescription.d.ts +6 -30
  32. package/build/types/utils/parseSpanDescription.d.ts.map +1 -1
  33. package/build/types/utils/reconcileDscSampled.d.ts +14 -0
  34. package/build/types/utils/reconcileDscSampled.d.ts.map +1 -0
  35. package/build/types/utils/suppressTracing.d.ts +5 -4
  36. package/build/types/utils/suppressTracing.d.ts.map +1 -1
  37. package/package.json +10 -37
  38. package/build/cjs/asyncContextStrategy-volGaYqZ.js +0 -1892
  39. package/build/cjs/asyncContextStrategy-volGaYqZ.js.map +0 -1
  40. package/build/cjs/index.browser.js +0 -53
  41. package/build/cjs/index.browser.js.map +0 -1
  42. package/build/esm/asyncContextStrategy-jD8YWNDU.js +0 -1857
  43. package/build/esm/asyncContextStrategy-jD8YWNDU.js.map +0 -1
  44. package/build/esm/index.browser.js +0 -14
  45. package/build/esm/index.browser.js.map +0 -1
  46. package/build/types/contextManager.d.ts +0 -22
  47. package/build/types/contextManager.d.ts.map +0 -1
  48. package/build/types/custom/client.d.ts +0 -12
  49. package/build/types/custom/client.d.ts.map +0 -1
  50. package/build/types/exports.d.ts +0 -27
  51. package/build/types/exports.d.ts.map +0 -1
  52. package/build/types/index.browser.d.ts +0 -10
  53. package/build/types/index.browser.d.ts.map +0 -1
  54. package/build/types/nodeAsyncContextStrategy.d.ts +0 -4
  55. package/build/types/nodeAsyncContextStrategy.d.ts.map +0 -1
  56. package/build/types/resource.d.ts +0 -26
  57. package/build/types/resource.d.ts.map +0 -1
  58. package/build/types/sampler.d.ts +0 -32
  59. package/build/types/sampler.d.ts.map +0 -1
  60. package/build/types/semanticAttributes.d.ts +0 -4
  61. package/build/types/semanticAttributes.d.ts.map +0 -1
  62. package/build/types/spanExporter.d.ts +0 -50
  63. package/build/types/spanExporter.d.ts.map +0 -1
  64. package/build/types/spanProcessor.d.ts +0 -31
  65. package/build/types/spanProcessor.d.ts.map +0 -1
  66. package/build/types/utils/enhanceDscWithOpenTelemetryRootSpanName.d.ts +0 -7
  67. package/build/types/utils/enhanceDscWithOpenTelemetryRootSpanName.d.ts.map +0 -1
  68. package/build/types/utils/getParentSpanId.d.ts +0 -8
  69. package/build/types/utils/getParentSpanId.d.ts.map +0 -1
  70. package/build/types/utils/getRequestSpanData.d.ts +0 -8
  71. package/build/types/utils/getRequestSpanData.d.ts.map +0 -1
  72. package/build/types/utils/getSpanKind.d.ts +0 -10
  73. package/build/types/utils/getSpanKind.d.ts.map +0 -1
  74. package/build/types/utils/getTraceData.d.ts +0 -12
  75. package/build/types/utils/getTraceData.d.ts.map +0 -1
  76. package/build/types/utils/groupSpansWithParents.d.ts +0 -17
  77. package/build/types/utils/groupSpansWithParents.d.ts.map +0 -1
  78. package/build/types/utils/isSentryRequest.d.ts +0 -8
  79. package/build/types/utils/isSentryRequest.d.ts.map +0 -1
  80. package/build/types/utils/setupCheck.d.ts +0 -9
  81. package/build/types/utils/setupCheck.d.ts.map +0 -1
  82. package/build/types/utils/spanTypes.d.ts +0 -52
  83. package/build/types/utils/spanTypes.d.ts.map +0 -1
  84. package/build/types-ts3.8/applyOtelSpanData.d.ts +0 -18
  85. package/build/types-ts3.8/asyncContextStrategy.d.ts +0 -9
  86. package/build/types-ts3.8/asyncLocalStorageContextManager.d.ts +0 -31
  87. package/build/types-ts3.8/constants.d.ts +0 -24
  88. package/build/types-ts3.8/contextManager.d.ts +0 -22
  89. package/build/types-ts3.8/custom/client.d.ts +0 -12
  90. package/build/types-ts3.8/debug-build.d.ts +0 -7
  91. package/build/types-ts3.8/exports.d.ts +0 -27
  92. package/build/types-ts3.8/index.browser.d.ts +0 -10
  93. package/build/types-ts3.8/index.d.ts +0 -5
  94. package/build/types-ts3.8/nodeAsyncContextStrategy.d.ts +0 -4
  95. package/build/types-ts3.8/propagator.d.ts +0 -43
  96. package/build/types-ts3.8/resource.d.ts +0 -29
  97. package/build/types-ts3.8/sampler.d.ts +0 -32
  98. package/build/types-ts3.8/semanticAttributes.d.ts +0 -4
  99. package/build/types-ts3.8/setupEventContextTrace.d.ts +0 -4
  100. package/build/types-ts3.8/spanExporter.d.ts +0 -50
  101. package/build/types-ts3.8/spanProcessor.d.ts +0 -31
  102. package/build/types-ts3.8/trace.d.ts +0 -75
  103. package/build/types-ts3.8/tracer.d.ts +0 -13
  104. package/build/types-ts3.8/tracerProvider.d.ts +0 -23
  105. package/build/types-ts3.8/types.d.ts +0 -29
  106. package/build/types-ts3.8/utils/TraceState.d.ts +0 -21
  107. package/build/types-ts3.8/utils/backfillStreamedSpanData.d.ts +0 -16
  108. package/build/types-ts3.8/utils/buildContextWithSentryScopes.d.ts +0 -12
  109. package/build/types-ts3.8/utils/contextData.d.ts +0 -30
  110. package/build/types-ts3.8/utils/enhanceDscWithOpenTelemetryRootSpanName.d.ts +0 -7
  111. package/build/types-ts3.8/utils/getActiveSpan.d.ts +0 -6
  112. package/build/types-ts3.8/utils/getParentSpanId.d.ts +0 -8
  113. package/build/types-ts3.8/utils/getRequestSpanData.d.ts +0 -8
  114. package/build/types-ts3.8/utils/getSamplingDecision.d.ts +0 -27
  115. package/build/types-ts3.8/utils/getSpanKind.d.ts +0 -10
  116. package/build/types-ts3.8/utils/getTraceData.d.ts +0 -12
  117. package/build/types-ts3.8/utils/groupSpansWithParents.d.ts +0 -17
  118. package/build/types-ts3.8/utils/isSentryRequest.d.ts +0 -8
  119. package/build/types-ts3.8/utils/makeTraceState.d.ts +0 -10
  120. package/build/types-ts3.8/utils/mapStatus.d.ts +0 -9
  121. package/build/types-ts3.8/utils/parseSpanDescription.d.ts +0 -56
  122. package/build/types-ts3.8/utils/setupCheck.d.ts +0 -9
  123. package/build/types-ts3.8/utils/spanTypes.d.ts +0 -52
  124. package/build/types-ts3.8/utils/suppressTracing.d.ts +0 -5
@@ -1,29 +0,0 @@
1
- import { Attributes, AttributeValue } from '@opentelemetry/api';
2
- type RawResourceAttribute = [
3
- string,
4
- AttributeValue | undefined
5
- ];
6
- /**
7
- * Minimal Resource implementation that satisfies the OpenTelemetry Resource interface
8
- * used by BasicTracerProvider, without depending on `@opentelemetry/resources`.
9
- */
10
- declare class SentryResource {
11
- private _attributes;
12
- constructor(attributes: Attributes);
13
- readonly attributes: Attributes;
14
- merge(other: SentryResource | null): SentryResource;
15
- getRawAttributes(): RawResourceAttribute[];
16
- }
17
- /**
18
- * Returns a Resource for use in Sentry's OpenTelemetry TracerProvider setup.
19
- *
20
- * Combines the default OTel SDK telemetry attributes with Sentry-specific
21
- * service attributes, equivalent to what was previously done via:
22
- * `defaultResource().merge(resourceFromAttributes({ ... }))`
23
- *
24
- * Respects OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES environment variables
25
- * per the OpenTelemetry specification.
26
- */
27
- export declare function getSentryResource(serviceNameFallback: string): SentryResource;
28
- export {};
29
- //# sourceMappingURL=resource.d.ts.map
@@ -1,32 +0,0 @@
1
- import { Context } from '@opentelemetry/api';
2
- import { SpanKind } from '@opentelemetry/api';
3
- import { Sampler, SamplingResult } from '@opentelemetry/sdk-trace-base';
4
- import { SamplingDecision } from '@opentelemetry/sdk-trace-base';
5
- import { Client, SpanAttributes } from '@sentry/core';
6
- /**
7
- * A custom OTEL sampler that uses Sentry sampling rates to make its decision
8
- */
9
- export declare class SentrySampler implements Sampler {
10
- private _client;
11
- private _isSpanStreaming;
12
- constructor(client: Client);
13
- /** @inheritDoc */
14
- shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, spanAttributes: SpanAttributes, _links: unknown): SamplingResult;
15
- /** Returns the sampler name or short description with the configuration. */
16
- toString(): string;
17
- }
18
- /**
19
- * Wrap a sampling decision with data that Sentry needs to work properly with it.
20
- * If you pass `decision: undefined`, it will be treated as `NOT_RECORDING`, but in contrast to passing `NOT_RECORDING`
21
- * it will not propagate this decision to downstream Sentry SDKs.
22
- */
23
- export declare function wrapSamplingDecision({ decision, context, spanAttributes, sampleRand, downstreamTraceSampleRate, ignoredChildSpan, ignoredSegmentSpan, }: {
24
- decision: SamplingDecision | undefined;
25
- context: Context;
26
- spanAttributes: SpanAttributes;
27
- sampleRand?: number;
28
- downstreamTraceSampleRate?: number;
29
- ignoredChildSpan?: boolean;
30
- ignoredSegmentSpan?: boolean;
31
- }): SamplingResult;
32
- //# sourceMappingURL=sampler.d.ts.map
@@ -1,4 +0,0 @@
1
- /** If this attribute is true, it means that the parent is a remote span. */
2
- export declare const SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE = "sentry.parentIsRemote";
3
- export declare const SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION = "sentry.graphql.operation";
4
- //# sourceMappingURL=semanticAttributes.d.ts.map
@@ -1,4 +0,0 @@
1
- import { Client } from '@sentry/core';
2
- /** Ensure the `trace` context is set on all events. */
3
- export declare function setupEventContextTrace(client: Client): void;
4
- //# sourceMappingURL=setupEventContextTrace.d.ts.map
@@ -1,50 +0,0 @@
1
- import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
2
- import { TransactionEvent } from '@sentry/core';
3
- /**
4
- * A Sentry-specific exporter that converts OpenTelemetry Spans to Sentry Spans & Transactions.
5
- */
6
- export declare class SentrySpanExporter {
7
- private _finishedSpanBuckets;
8
- private _finishedSpanBucketSize;
9
- private _spansToBucketEntry;
10
- private _lastCleanupTimestampInS;
11
- private _sentSpans;
12
- private _debouncedFlush;
13
- constructor(options?: {
14
- /** Lower bound of time in seconds until spans that are buffered but have not been sent as part of a transaction get cleared from memory. */
15
- timeout?: number;
16
- });
17
- /**
18
- * Export a single span.
19
- * This is called by the span processor whenever a span is ended.
20
- */
21
- export(span: ReadableSpan): void;
22
- /**
23
- * Try to flush any pending spans immediately.
24
- * This is called internally by the exporter (via _debouncedFlush),
25
- * but can also be triggered externally if we force-flush.
26
- */
27
- flush(): void;
28
- /**
29
- * Clear the exporter.
30
- * This is called when the span processor is shut down.
31
- */
32
- clear(): void;
33
- /**
34
- * Send the given spans, but only if they are part of a finished transaction.
35
- *
36
- * Returns the sent spans.
37
- * Spans remain unsent when their parent span is not yet finished.
38
- * This will happen regularly, as child spans are generally finished before their parents.
39
- * But it _could_ also happen because, for whatever reason, a parent span was lost.
40
- * In this case, we'll eventually need to clean this up.
41
- */
42
- private _maybeSend;
43
- /** Check if a node is a completed root node or a node whose parent has already been sent */
44
- private _nodeIsCompletedRootNodeOrHasSentParent;
45
- /** Get all completed root nodes from a list of nodes */
46
- private _getCompletedRootNodes;
47
- }
48
- /** Exported only for tests. */
49
- export declare function createTransactionForOtelSpan(span: ReadableSpan): TransactionEvent;
50
- //# sourceMappingURL=spanExporter.d.ts.map
@@ -1,31 +0,0 @@
1
- import { Context } from '@opentelemetry/api';
2
- import { ReadableSpan, Span, SpanProcessor as SpanProcessorInterface } from '@opentelemetry/sdk-trace-base';
3
- import { Client } from '@sentry/core';
4
- /**
5
- * Converts OpenTelemetry Spans to Sentry Spans and sends them to Sentry via
6
- * the Sentry SDK.
7
- */
8
- export declare class SentrySpanProcessor implements SpanProcessorInterface {
9
- private _exporter;
10
- private _client;
11
- private _unsubscribePreprocessSpan;
12
- constructor(options?: {
13
- timeout?: number;
14
- client?: Client;
15
- });
16
- /**
17
- * @inheritDoc
18
- */
19
- forceFlush(): Promise<void>;
20
- /**
21
- * @inheritDoc
22
- */
23
- shutdown(): Promise<void>;
24
- /**
25
- * @inheritDoc
26
- */
27
- onStart(span: Span, parentContext: Context): void;
28
- /** @inheritDoc */
29
- onEnd(span: Span & ReadableSpan): void;
30
- }
31
- //# sourceMappingURL=spanProcessor.d.ts.map
@@ -1,75 +0,0 @@
1
- import { Span } from '@opentelemetry/api';
2
- import { Client, continueTrace as baseContinueTrace, DynamicSamplingContext, Scope, TraceContext } from '@sentry/core';
3
- import { OpenTelemetrySpanContext } from './types';
4
- /**
5
- * Wraps a function with a transaction/span and finishes the span after the function is done.
6
- * The created span is the active span and will be used as parent by other spans created inside the function
7
- * and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
8
- *
9
- * If you want to create a span that is not set as active, use {@link startInactiveSpan}.
10
- *
11
- * You'll always get a span passed to the callback,
12
- * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
13
- */
14
- export declare function startSpan<T>(options: OpenTelemetrySpanContext, callback: (span: Span) => T): T;
15
- /**
16
- * Similar to `Sentry.startSpan`. Wraps a function with a span, but does not finish the span
17
- * after the function is done automatically. You'll have to call `span.end()` or the `finish` function passed to the callback manually.
18
- *
19
- * The created span is the active span and will be used as parent by other spans created inside the function
20
- * and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
21
- *
22
- * You'll always get a span passed to the callback,
23
- * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
24
- */
25
- export declare function startSpanManual<T>(options: OpenTelemetrySpanContext, callback: (span: Span, finish: () => void) => T): T;
26
- /**
27
- * Creates a span. This span is not set as active, so will not get automatic instrumentation spans
28
- * as children or be able to be accessed via `Sentry.getActiveSpan()`.
29
- *
30
- * If you want to create a span that is set as active, use {@link startSpan}.
31
- *
32
- * This function will always return a span,
33
- * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
34
- */
35
- export declare function startInactiveSpan(options: OpenTelemetrySpanContext): Span;
36
- /**
37
- * Forks the current scope and sets the provided span as active span in the context of the provided callback. Can be
38
- * passed `null` to start an entirely new span tree.
39
- *
40
- * @param span Spans started in the context of the provided callback will be children of this span. If `null` is passed,
41
- * spans started within the callback will be root spans.
42
- * @param callback Execution context in which the provided span will be active. Is passed the newly forked scope.
43
- * @returns the value returned from the provided callback function.
44
- */
45
- export declare function withActiveSpan<T>(span: Span | null, callback: (scope: Scope) => T): T;
46
- /**
47
- * Continue a trace from `sentry-trace` and `baggage` values.
48
- * These values can be obtained from incoming request headers, or in the browser from `<meta name="sentry-trace">`
49
- * and `<meta name="baggage">` HTML tags.
50
- *
51
- * Spans started with `startSpan`, `startSpanManual` and `startInactiveSpan`, within the callback will automatically
52
- * be attached to the incoming trace.
53
- *
54
- * This is a custom version of `continueTrace` that is used in OTEL-powered environments.
55
- * It propagates the trace as a remote span, in addition to setting it on the propagation context.
56
- */
57
- export declare function continueTrace<T>(options: Parameters<typeof baseContinueTrace>[0], callback: () => T): T;
58
- /**
59
- * Start a new trace with a unique traceId, ensuring all spans created within the callback
60
- * share the same traceId.
61
- *
62
- * This is a custom version of `startNewTrace` for OTEL-powered environments.
63
- * It injects the new traceId as a remote span context into the OTEL context, so that
64
- * `startInactiveSpan` and `startSpan` pick it up correctly.
65
- */
66
- export declare function startNewTrace<T>(callback: () => T): T;
67
- /**
68
- * Get the trace context for a given scope.
69
- * We have a custom implementation here because we need an OTEL-specific way to get the span from a scope.
70
- */
71
- export declare function getTraceContextForScope(client: Client, scope: Scope): [
72
- /*dynamicSamplingContext*/ Partial<DynamicSamplingContext>,
73
- /*traceContext*/ TraceContext
74
- ];
75
- //# sourceMappingURL=trace.d.ts.map
@@ -1,13 +0,0 @@
1
- import { Context, Span as OpenTelemetrySpan, SpanOptions, Tracer } from '@opentelemetry/api';
2
- export declare class SentryTracer implements Tracer {
3
- /** @inheritdoc */
4
- startSpan(name: string, options?: SpanOptions, ctx?: Context): OpenTelemetrySpan;
5
- /** @inheritdoc */
6
- startActiveSpan<F extends (span: OpenTelemetrySpan) => unknown>(name: string, fn: F): ReturnType<F>;
7
- startActiveSpan<F extends (span: OpenTelemetrySpan) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
8
- startActiveSpan<F extends (span: OpenTelemetrySpan) => unknown>(name: string, options: SpanOptions, ctx: Context, fn: F): ReturnType<F>;
9
- private _startSentrySpan;
10
- private _startRootSpanWithRemoteParent;
11
- private _createNonRecordingSpan;
12
- }
13
- //# sourceMappingURL=tracer.d.ts.map
@@ -1,23 +0,0 @@
1
- import { Tracer, TracerOptions, TracerProvider } from '@opentelemetry/api';
2
- import { SpanAttributes } from '@sentry/core';
3
- /**
4
- * A minimal OpenTelemetry TracerProvider which creates native Sentry spans.
5
- */
6
- export declare class SentryTracerProvider implements TracerProvider {
7
- readonly resource?: {
8
- attributes: SpanAttributes;
9
- };
10
- private readonly _tracers;
11
- constructor(options?: {
12
- resource?: {
13
- attributes: SpanAttributes;
14
- };
15
- });
16
- /** @inheritdoc */
17
- getTracer(name: string, version?: string, options?: TracerOptions): Tracer;
18
- /** Compatibility with SDK tracer providers. */
19
- forceFlush(): Promise<void>;
20
- /** Compatibility with SDK tracer providers. */
21
- shutdown(): Promise<void>;
22
- }
23
- //# sourceMappingURL=tracerProvider.d.ts.map
@@ -1,29 +0,0 @@
1
- import { Span as WriteableSpan, SpanKind, Tracer, TracerProvider } from '@opentelemetry/api';
2
- import { BasicTracerProvider, ReadableSpan } from '@opentelemetry/sdk-trace-base';
3
- import { Scope, Span, StartSpanOptions } from '@sentry/core';
4
- export interface OpenTelemetryTracerProvider extends TracerProvider {
5
- forceFlush(): Promise<void>;
6
- shutdown(): Promise<void>;
7
- }
8
- export interface OpenTelemetryClient {
9
- tracer: Tracer;
10
- traceProvider: BasicTracerProvider | OpenTelemetryTracerProvider | undefined;
11
- }
12
- export interface OpenTelemetrySpanContext extends StartSpanOptions {
13
- kind?: SpanKind;
14
- }
15
- /**
16
- * The base `Span` type is basically a `WriteableSpan`.
17
- * There are places where we basically want to allow passing _any_ span,
18
- * so in these cases we type this as `AbstractSpan` which could be either a regular `Span` or a `ReadableSpan`.
19
- * You'll have to make sure to check relevant fields before accessing them.
20
- *
21
- * Note that technically, the `Span` exported from `@opentelemetry/sdk-trace-base` matches this,
22
- * but we cannot be 100% sure that we are actually getting such a span, so this type is more defensive.
23
- */
24
- export type AbstractSpan = WriteableSpan | ReadableSpan | Span;
25
- export interface CurrentScopes {
26
- scope: Scope;
27
- isolationScope: Scope;
28
- }
29
- //# sourceMappingURL=types.d.ts.map
@@ -1,21 +0,0 @@
1
- import { TraceState as TraceStateInterface } from '@opentelemetry/api';
2
- /**
3
- * Minimal implementation of the W3C `tracestate` field as a `@opentelemetry/api`
4
- * `TraceState`. New entries are inserted at the front of the list, and updating
5
- * an existing key moves it to the front.
6
- *
7
- * See https://www.w3.org/TR/trace-context/#tracestate-field for the field spec.
8
- */
9
- export declare class TraceState implements TraceStateInterface {
10
- private _internalState;
11
- /** @inheritDoc */
12
- set(key: string, value: string): TraceState;
13
- /** @inheritDoc */
14
- unset(key: string): TraceState;
15
- /** @inheritDoc */
16
- get(key: string): string | undefined;
17
- /** @inheritDoc */
18
- serialize(): string;
19
- private _clone;
20
- }
21
- //# sourceMappingURL=TraceState.d.ts.map
@@ -1,16 +0,0 @@
1
- import { StreamedSpanJSON } from '@sentry/core';
2
- /**
3
- * Backfill op, source, name and data on a streamed span JSON from OTel semantic conventions.
4
- * Mirrors the inference the {@link SentrySpanExporter} applies to non-streamed spans via `getSpanData`.
5
- * Explicitly set attributes are preserved via `safeSetSpanJSONAttributes`.
6
- *
7
- * Runs as a `preprocessSpan` subscriber (streamed-only) on both span pipelines: the OTel SDK
8
- * `SentrySpanProcessor` and the `SentryTracerProvider`. On the latter, `applyOtelSpanData` has already
9
- * inferred most data on the native span; this fills the remaining gap (per-span `sentry.source` on
10
- * child spans, which `applyOtelSpanData` only sets on segment roots). `inferSpanData` is deterministic
11
- * on the same attributes, so re-running it here is a no-op for already-inferred fields.
12
- */
13
- export declare function backfillStreamedSpanDataFromOtel(spanJSON: StreamedSpanJSON, hint?: {
14
- spanKind?: number;
15
- }): void;
16
- //# sourceMappingURL=backfillStreamedSpanData.d.ts.map
@@ -1,12 +0,0 @@
1
- import { Context } from '@opentelemetry/api';
2
- /**
3
- * Merge Sentry scopes into an OpenTelemetry {@link Context} and apply trace-context adjustments
4
- * used by Sentry OpenTelemetry context manager(s).
5
- *
6
- * @param context - Context passed into `ContextManager.with`.
7
- * @param activeContext - Context that was active before entering `with` (e.g. `this.active()`), used
8
- * to restore the parent span when the incoming span is marked ignored for children.
9
- * @returns A new context ready for `super.with` / `AsyncLocalStorage.run`.
10
- */
11
- export declare function buildContextWithSentryScopes(context: Context, activeContext: Context): Context;
12
- //# sourceMappingURL=buildContextWithSentryScopes.d.ts.map
@@ -1,30 +0,0 @@
1
- import { Context } from '@opentelemetry/api';
2
- import { Scope } from '@sentry/core';
3
- import { CurrentScopes } from '../types';
4
- /**
5
- * Try to get the current scopes from the given OTEL context.
6
- * This requires a Context Manager that was wrapped with getWrappedContextManager.
7
- */
8
- export declare function getScopesFromContext(context: Context): CurrentScopes | undefined;
9
- /**
10
- * Set the current scopes on an OTEL context.
11
- * This will return a forked context with the Propagation Context set.
12
- */
13
- export declare function setScopesOnContext(context: Context, scopes: CurrentScopes): Context;
14
- /**
15
- * Set the context on the scope so we can later look it up.
16
- * We need this to get the context from the scope in the `trace` functions.
17
- *
18
- * We use WeakRef to avoid a circular reference between the scope and the context.
19
- * The context holds scopes (via SENTRY_SCOPES_CONTEXT_KEY), and if the scope held
20
- * a strong reference back to the context, neither could be garbage collected even
21
- * when the context is no longer reachable from application code (e.g., after a
22
- * request completes but pooled connections retain patched callbacks).
23
- */
24
- export declare function setContextOnScope(scope: Scope, context: Context): void;
25
- /**
26
- * Get the context related to a scope.
27
- * Returns undefined if the context has been garbage collected (when WeakRef is used).
28
- */
29
- export declare function getContextFromScope(scope: Scope): Context | undefined;
30
- //# sourceMappingURL=contextData.d.ts.map
@@ -1,7 +0,0 @@
1
- import { Client } from '@sentry/core';
2
- /**
3
- * Setup a DSC handler on the passed client,
4
- * ensuring that the transaction name is inferred from the span correctly.
5
- */
6
- export declare function enhanceDscWithOpenTelemetryRootSpanName(client: Client): void;
7
- //# sourceMappingURL=enhanceDscWithOpenTelemetryRootSpanName.d.ts.map
@@ -1,6 +0,0 @@
1
- import { Span } from '@opentelemetry/api';
2
- /**
3
- * Returns the currently active span.
4
- */
5
- export declare function getActiveSpan(): Span | undefined;
6
- //# sourceMappingURL=getActiveSpan.d.ts.map
@@ -1,8 +0,0 @@
1
- import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
2
- /**
3
- * Get the parent span id from a span.
4
- * In OTel v1, the parent span id is accessed as `parentSpanId`
5
- * In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext`
6
- */
7
- export declare function getParentSpanId(span: ReadableSpan): string | undefined;
8
- //# sourceMappingURL=getParentSpanId.d.ts.map
@@ -1,8 +0,0 @@
1
- import { Span } from '@opentelemetry/api';
2
- import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
3
- import { SanitizedRequestData } from '@sentry/core';
4
- /**
5
- * Get sanitizied request data from an OTEL span.
6
- */
7
- export declare function getRequestSpanData(span: Span | ReadableSpan): Partial<SanitizedRequestData>;
8
- //# sourceMappingURL=getRequestSpanData.d.ts.map
@@ -1,27 +0,0 @@
1
- import { SpanContext } from '@opentelemetry/api';
2
- import { Client, Span } from '@sentry/core';
3
- /**
4
- * OpenTelemetry only knows about SAMPLED or NONE decision,
5
- * but for us it is important to differentiate between unset and unsampled.
6
- *
7
- * Both of these are identified as `traceFlags === TracegFlags.NONE`,
8
- * but we additionally look at a special trace state to differentiate between them.
9
- */
10
- export declare function getSamplingDecision(spanContext: SpanContext): boolean | undefined;
11
- /**
12
- * Resolve a span's sampling decision for trace propagation, also handling native Sentry spans.
13
- *
14
- * Prefer the OpenTelemetry trace state via {@link getSamplingDecision}. Native Sentry spans (created
15
- * by the `SentryTracerProvider`) don't carry that trace state, so when it's absent we fall back to the
16
- * span's own decision via `spanIsSampled` — but only for an *explicit* decision. An explicit decision
17
- * originates at a real `SentrySpan` root (a negatively sampled root, or a child of one) or an ignored
18
- * segment root. Other non-recording placeholder roots (orphan/suppressed spans or TwP placeholders)
19
- * and remote spans have a *deferred* decision that lives elsewhere (the scope, or the incoming trace
20
- * state), so we return `undefined` rather than wrongly asserting `-0`.
21
- *
22
- * TODO(v11): Once the OTel SDK provider is gone and every local span is a native Sentry span, the
23
- * trace-state lookup only matters for remote (incoming) spans; the local path always reads the span's
24
- * own decision, so the "native-vs-OTel-SDK span" framing can be dropped (local → span, remote → trace state).
25
- */
26
- export declare function getSampledForPropagation(span: Span, client: Client | undefined): boolean | undefined;
27
- //# sourceMappingURL=getSamplingDecision.d.ts.map
@@ -1,10 +0,0 @@
1
- import { SpanKind } from '@opentelemetry/api';
2
- import { AbstractSpan } from '../types';
3
- /**
4
- * Get the span kind from a span.
5
- * For whatever reason, this is not public API on the generic "Span" type,
6
- * so we need to check if we actually have a `SDKTraceBaseSpan` where we can fetch this from.
7
- * Otherwise, we fall back to `SpanKind.INTERNAL`.
8
- */
9
- export declare function getSpanKind(span: AbstractSpan): SpanKind;
10
- //# sourceMappingURL=getSpanKind.d.ts.map
@@ -1,12 +0,0 @@
1
- import { Client, Scope, SerializedTraceData, Span } from '@sentry/core';
2
- /**
3
- * Otel-specific implementation of `getTraceData`.
4
- * @see `@sentry/core` version of `getTraceData` for more information
5
- */
6
- export declare function getTraceData({ span, scope, client, propagateTraceparent, }?: {
7
- span?: Span;
8
- scope?: Scope;
9
- client?: Client;
10
- propagateTraceparent?: boolean;
11
- }): SerializedTraceData;
12
- //# sourceMappingURL=getTraceData.d.ts.map
@@ -1,17 +0,0 @@
1
- import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
2
- export interface SpanNode {
3
- id: string;
4
- span?: ReadableSpan;
5
- parentNode?: SpanNode | undefined;
6
- children: SpanNode[];
7
- }
8
- /**
9
- * This function runs through a list of OTEL Spans, and wraps them in an `SpanNode`
10
- * where each node holds a reference to their parent node.
11
- */
12
- export declare function groupSpansWithParents(spans: ReadableSpan[]): SpanNode[];
13
- /**
14
- * This returns the _local_ parent ID - `parentId` on the span may point to a remote span.
15
- */
16
- export declare function getLocalParentId(span: ReadableSpan): string | undefined;
17
- //# sourceMappingURL=groupSpansWithParents.d.ts.map
@@ -1,8 +0,0 @@
1
- import { AbstractSpan } from '../types';
2
- /**
3
- *
4
- * @param otelSpan Checks whether a given OTEL Span is an http request to sentry.
5
- * @returns boolean
6
- */
7
- export declare function isSentryRequestSpan(span: AbstractSpan): boolean;
8
- //# sourceMappingURL=isSentryRequest.d.ts.map
@@ -1,10 +0,0 @@
1
- import { DynamicSamplingContext } from '@sentry/core';
2
- import { TraceState } from './TraceState';
3
- /**
4
- * Generate a TraceState for the given data.
5
- */
6
- export declare function makeTraceState({ dsc, sampled, }: {
7
- dsc?: Partial<DynamicSamplingContext>;
8
- sampled?: boolean;
9
- }): TraceState;
10
- //# sourceMappingURL=makeTraceState.d.ts.map
@@ -1,9 +0,0 @@
1
- import { SpanAttributes, SpanStatus } from '@sentry/core';
2
- import { AbstractSpan } from '../types';
3
- export declare const isStatusErrorMessageValid: (message: string) => boolean;
4
- /**
5
- * Get a Sentry span status from an otel span.
6
- */
7
- export declare function mapStatus(span: AbstractSpan): SpanStatus;
8
- export declare function inferStatusFromAttributes(attributes: SpanAttributes): SpanStatus | undefined;
9
- //# sourceMappingURL=mapStatus.d.ts.map
@@ -1,56 +0,0 @@
1
- import { Attributes, AttributeValue } from '@opentelemetry/api';
2
- import { SpanKind } from '@opentelemetry/api';
3
- import { SpanAttributes, TransactionSource } from '@sentry/core';
4
- import { AbstractSpan } from '../types';
5
- interface SpanDescription {
6
- op: string | undefined;
7
- description: string;
8
- source: TransactionSource;
9
- data?: Record<string, string | undefined>;
10
- }
11
- /**
12
- * Infer the op & description for a set of name, attributes and kind of a span.
13
- */
14
- export declare function inferSpanData(spanName: string, attributes: SpanAttributes, kind: SpanKind): SpanDescription;
15
- /**
16
- * Extract better op/description from an otel span.
17
- *
18
- * Does not overwrite the span name if the source is already set to custom to ensure
19
- * that user-updated span names are preserved. In this case, we only adjust the op but
20
- * leave span description and source unchanged.
21
- *
22
- * Based on https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7422ce2a06337f68a59b552b8c5a2ac125d6bae5/exporter/sentryexporter/sentry_exporter.go#L306
23
- */
24
- export declare function parseSpanDescription(span: AbstractSpan): SpanDescription;
25
- /** Only exported for tests. */
26
- export declare function descriptionForHttpMethod({ name, kind, attributes }: {
27
- name: string;
28
- attributes: Attributes;
29
- kind: SpanKind;
30
- }, httpMethod: AttributeValue): SpanDescription;
31
- /** Exported for tests only */
32
- export declare function getSanitizedUrl(attributes: Attributes, kind: SpanKind): {
33
- url: string | undefined;
34
- urlPath: string | undefined;
35
- query: string | undefined;
36
- fragment: string | undefined;
37
- hasRoute: boolean;
38
- };
39
- /**
40
- * Because Otel instrumentation sometimes mutates span names via `span.updateName`, the only way
41
- * to ensure that a user-set span name is preserved is to store it as a tmp attribute on the span.
42
- * We delete this attribute once we're done with it when preparing the event envelope.
43
- *
44
- * This temp attribute always takes precedence over the original name.
45
- *
46
- * We also need to take care of setting the correct source. Users can always update the source
47
- * after updating the name, so we need to respect that.
48
- *
49
- * @internal exported only for testing
50
- */
51
- export declare function getUserUpdatedNameAndSource(originalName: string, attributes: Attributes, fallbackSource?: TransactionSource): {
52
- description: string;
53
- source: TransactionSource;
54
- };
55
- export {};
56
- //# sourceMappingURL=parseSpanDescription.d.ts.map
@@ -1,9 +0,0 @@
1
- type OpenTelemetryElement = 'SentrySpanProcessor' | 'SentryContextManager' | 'SentryPropagator' | 'SentrySampler' | 'SentryTracerProvider';
2
- /** Get all the OpenTelemetry elements that have been set up. */
3
- export declare function openTelemetrySetupCheck(): OpenTelemetryElement[];
4
- /** Mark an OpenTelemetry element as setup. */
5
- export declare function setIsSetup(element: OpenTelemetryElement): void;
6
- /** Only exported for tests. */
7
- export declare function clearOpenTelemetrySetupCheck(): void;
8
- export {};
9
- //# sourceMappingURL=setupCheck.d.ts.map
@@ -1,52 +0,0 @@
1
- import { SpanKind, SpanStatus } from '@opentelemetry/api';
2
- import { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';
3
- import { AbstractSpan } from '../types';
4
- /**
5
- * Check if a given span has attributes.
6
- * This is necessary because the base `Span` type does not have attributes,
7
- * so in places where we are passed a generic span, we need to check if we want to access them.
8
- */
9
- export declare function spanHasAttributes<SpanType extends AbstractSpan>(span: SpanType): span is SpanType & {
10
- attributes: ReadableSpan['attributes'];
11
- };
12
- /**
13
- * Check if a given span has a kind.
14
- * This is necessary because the base `Span` type does not have a kind,
15
- * so in places where we are passed a generic span, we need to check if we want to access it.
16
- */
17
- export declare function spanHasKind<SpanType extends AbstractSpan>(span: SpanType): span is SpanType & {
18
- kind: SpanKind;
19
- };
20
- /**
21
- * Check if a given span has a status.
22
- * This is necessary because the base `Span` type does not have a status,
23
- * so in places where we are passed a generic span, we need to check if we want to access it.
24
- */
25
- export declare function spanHasStatus<SpanType extends AbstractSpan>(span: SpanType): span is SpanType & {
26
- status: SpanStatus;
27
- };
28
- /**
29
- * Check if a given span has a name.
30
- * This is necessary because the base `Span` type does not have a name,
31
- * so in places where we are passed a generic span, we need to check if we want to access it.
32
- */
33
- export declare function spanHasName<SpanType extends AbstractSpan>(span: SpanType): span is SpanType & {
34
- name: string;
35
- };
36
- /**
37
- * Check if a given span has a kind.
38
- * This is necessary because the base `Span` type does not have a kind,
39
- * so in places where we are passed a generic span, we need to check if we want to access it.
40
- */
41
- export declare function spanHasParentId<SpanType extends AbstractSpan>(span: SpanType): span is SpanType & {
42
- parentSpanId: string;
43
- };
44
- /**
45
- * Check if a given span has events.
46
- * This is necessary because the base `Span` type does not have events,
47
- * so in places where we are passed a generic span, we need to check if we want to access it.
48
- */
49
- export declare function spanHasEvents<SpanType extends AbstractSpan>(span: SpanType): span is SpanType & {
50
- events: TimedEvent[];
51
- };
52
- //# sourceMappingURL=spanTypes.d.ts.map