@sentry/opentelemetry 7.74.2-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.
- package/LICENSE +14 -0
- package/README.md +98 -0
- package/cjs/asyncContextStrategy.js +46 -0
- package/cjs/asyncContextStrategy.js.map +1 -0
- package/cjs/constants.js +18 -0
- package/cjs/constants.js.map +1 -0
- package/cjs/contextManager.js +59 -0
- package/cjs/contextManager.js.map +1 -0
- package/cjs/custom/client.js +81 -0
- package/cjs/custom/client.js.map +1 -0
- package/cjs/custom/hub.js +165 -0
- package/cjs/custom/hub.js.map +1 -0
- package/cjs/custom/hubextensions.js +34 -0
- package/cjs/custom/hubextensions.js.map +1 -0
- package/cjs/custom/scope.js +181 -0
- package/cjs/custom/scope.js.map +1 -0
- package/cjs/custom/transaction.js +52 -0
- package/cjs/custom/transaction.js.map +1 -0
- package/cjs/index.js +63 -0
- package/cjs/index.js.map +1 -0
- package/cjs/propagator.js +132 -0
- package/cjs/propagator.js.map +1 -0
- package/cjs/sampler.js +185 -0
- package/cjs/sampler.js.map +1 -0
- package/cjs/semanticAttributes.js +21 -0
- package/cjs/semanticAttributes.js.map +1 -0
- package/cjs/setupEventContextTrace.js +35 -0
- package/cjs/setupEventContextTrace.js.map +1 -0
- package/cjs/spanExporter.js +302 -0
- package/cjs/spanExporter.js.map +1 -0
- package/cjs/spanProcessor.js +88 -0
- package/cjs/spanProcessor.js.map +1 -0
- package/cjs/trace.js +107 -0
- package/cjs/trace.js.map +1 -0
- package/cjs/utils/addOriginToSpan.js +11 -0
- package/cjs/utils/addOriginToSpan.js.map +1 -0
- package/cjs/utils/captureExceptionForTimedEvent.js +58 -0
- package/cjs/utils/captureExceptionForTimedEvent.js.map +1 -0
- package/cjs/utils/contextData.js +41 -0
- package/cjs/utils/contextData.js.map +1 -0
- package/cjs/utils/convertOtelTimeToSeconds.js +9 -0
- package/cjs/utils/convertOtelTimeToSeconds.js.map +1 -0
- package/cjs/utils/getActiveSpan.js +29 -0
- package/cjs/utils/getActiveSpan.js.map +1 -0
- package/cjs/utils/getRequestSpanData.js +48 -0
- package/cjs/utils/getRequestSpanData.js.map +1 -0
- package/cjs/utils/getSpanKind.js +21 -0
- package/cjs/utils/getSpanKind.js.map +1 -0
- package/cjs/utils/groupSpansWithParents.js +74 -0
- package/cjs/utils/groupSpansWithParents.js.map +1 -0
- package/cjs/utils/isSentryRequest.js +29 -0
- package/cjs/utils/isSentryRequest.js.map +1 -0
- package/cjs/utils/mapStatus.js +76 -0
- package/cjs/utils/mapStatus.js.map +1 -0
- package/cjs/utils/parseSpanDescription.js +158 -0
- package/cjs/utils/parseSpanDescription.js.map +1 -0
- package/cjs/utils/spanData.js +59 -0
- package/cjs/utils/spanData.js.map +1 -0
- package/cjs/utils/spanTypes.js +77 -0
- package/cjs/utils/spanTypes.js.map +1 -0
- package/esm/asyncContextStrategy.js +41 -0
- package/esm/asyncContextStrategy.js.map +1 -0
- package/esm/constants.js +13 -0
- package/esm/constants.js.map +1 -0
- package/esm/contextManager.js +57 -0
- package/esm/contextManager.js.map +1 -0
- package/esm/custom/client.js +76 -0
- package/esm/custom/client.js.map +1 -0
- package/esm/custom/hub.js +159 -0
- package/esm/custom/hub.js.map +1 -0
- package/esm/custom/hubextensions.js +32 -0
- package/esm/custom/hubextensions.js.map +1 -0
- package/esm/custom/scope.js +179 -0
- package/esm/custom/scope.js.map +1 -0
- package/esm/custom/transaction.js +49 -0
- package/esm/custom/transaction.js.map +1 -0
- package/esm/index.js +32 -0
- package/esm/index.js.map +1 -0
- package/esm/propagator.js +127 -0
- package/esm/propagator.js.map +1 -0
- package/esm/sampler.js +183 -0
- package/esm/sampler.js.map +1 -0
- package/esm/semanticAttributes.js +19 -0
- package/esm/semanticAttributes.js.map +1 -0
- package/esm/setupEventContextTrace.js +33 -0
- package/esm/setupEventContextTrace.js.map +1 -0
- package/esm/spanExporter.js +300 -0
- package/esm/spanExporter.js.map +1 -0
- package/esm/spanProcessor.js +86 -0
- package/esm/spanProcessor.js.map +1 -0
- package/esm/trace.js +104 -0
- package/esm/trace.js.map +1 -0
- package/esm/utils/addOriginToSpan.js +9 -0
- package/esm/utils/addOriginToSpan.js.map +1 -0
- package/esm/utils/captureExceptionForTimedEvent.js +56 -0
- package/esm/utils/captureExceptionForTimedEvent.js.map +1 -0
- package/esm/utils/contextData.js +36 -0
- package/esm/utils/contextData.js.map +1 -0
- package/esm/utils/convertOtelTimeToSeconds.js +7 -0
- package/esm/utils/convertOtelTimeToSeconds.js.map +1 -0
- package/esm/utils/getActiveSpan.js +26 -0
- package/esm/utils/getActiveSpan.js.map +1 -0
- package/esm/utils/getRequestSpanData.js +46 -0
- package/esm/utils/getRequestSpanData.js.map +1 -0
- package/esm/utils/getSpanKind.js +19 -0
- package/esm/utils/getSpanKind.js.map +1 -0
- package/esm/utils/groupSpansWithParents.js +72 -0
- package/esm/utils/groupSpansWithParents.js.map +1 -0
- package/esm/utils/isSentryRequest.js +27 -0
- package/esm/utils/isSentryRequest.js.map +1 -0
- package/esm/utils/mapStatus.js +74 -0
- package/esm/utils/mapStatus.js.map +1 -0
- package/esm/utils/parseSpanDescription.js +154 -0
- package/esm/utils/parseSpanDescription.js.map +1 -0
- package/esm/utils/spanData.js +50 -0
- package/esm/utils/spanData.js.map +1 -0
- package/esm/utils/spanTypes.js +70 -0
- package/esm/utils/spanTypes.js.map +1 -0
- package/package.json +45 -0
- package/types/asyncContextStrategy.d.ts +6 -0
- package/types/asyncContextStrategy.d.ts.map +1 -0
- package/types/constants.d.ts +7 -0
- package/types/constants.d.ts.map +1 -0
- package/types/contextManager.d.ts +11 -0
- package/types/contextManager.d.ts.map +1 -0
- package/types/custom/client.d.ts +12 -0
- package/types/custom/client.d.ts.map +1 -0
- package/types/custom/hub.d.ts +40 -0
- package/types/custom/hub.d.ts.map +1 -0
- package/types/custom/hubextensions.d.ts +5 -0
- package/types/custom/hubextensions.d.ts.map +1 -0
- package/types/custom/scope.d.ts +34 -0
- package/types/custom/scope.d.ts.map +1 -0
- package/types/custom/transaction.d.ts +17 -0
- package/types/custom/transaction.d.ts.map +1 -0
- package/types/index.d.ts +31 -0
- package/types/index.d.ts.map +1 -0
- package/types/propagator.d.ts +20 -0
- package/types/propagator.d.ts.map +1 -0
- package/types/sampler.d.ts +15 -0
- package/types/sampler.d.ts.map +1 -0
- package/types/semanticAttributes.d.ts +17 -0
- package/types/semanticAttributes.d.ts.map +1 -0
- package/types/setupEventContextTrace.d.ts +4 -0
- package/types/setupEventContextTrace.d.ts.map +1 -0
- package/types/spanExporter.d.ts +17 -0
- package/types/spanExporter.d.ts.map +1 -0
- package/types/spanProcessor.d.ts +22 -0
- package/types/spanProcessor.d.ts.map +1 -0
- package/types/trace.d.ts +28 -0
- package/types/trace.d.ts.map +1 -0
- package/types/types.d.ts +26 -0
- package/types/types.d.ts.map +1 -0
- package/types/utils/addOriginToSpan.d.ts +5 -0
- package/types/utils/addOriginToSpan.d.ts.map +1 -0
- package/types/utils/captureExceptionForTimedEvent.d.ts +8 -0
- package/types/utils/captureExceptionForTimedEvent.d.ts.map +1 -0
- package/types/utils/contextData.d.ts +23 -0
- package/types/utils/contextData.d.ts.map +1 -0
- package/types/utils/convertOtelTimeToSeconds.d.ts +3 -0
- package/types/utils/convertOtelTimeToSeconds.d.ts.map +1 -0
- package/types/utils/getActiveSpan.d.ts +11 -0
- package/types/utils/getActiveSpan.d.ts.map +1 -0
- package/types/utils/getRequestSpanData.d.ts +8 -0
- package/types/utils/getRequestSpanData.d.ts.map +1 -0
- package/types/utils/getSpanKind.d.ts +10 -0
- package/types/utils/getSpanKind.d.ts.map +1 -0
- package/types/utils/groupSpansWithParents.d.ts +13 -0
- package/types/utils/groupSpansWithParents.d.ts.map +1 -0
- package/types/utils/isSentryRequest.d.ts +8 -0
- package/types/utils/isSentryRequest.d.ts.map +1 -0
- package/types/utils/mapStatus.d.ts +7 -0
- package/types/utils/mapStatus.d.ts.map +1 -0
- package/types/utils/parseSpanDescription.d.ts +32 -0
- package/types/utils/parseSpanDescription.d.ts.map +1 -0
- package/types/utils/spanData.d.ts +20 -0
- package/types/utils/spanData.d.ts.map +1 -0
- package/types/utils/spanTypes.d.ts +52 -0
- package/types/utils/spanTypes.d.ts.map +1 -0
- package/types-ts3.8/asyncContextStrategy.d.ts +6 -0
- package/types-ts3.8/constants.d.ts +7 -0
- package/types-ts3.8/contextManager.d.ts +11 -0
- package/types-ts3.8/custom/client.d.ts +12 -0
- package/types-ts3.8/custom/hub.d.ts +40 -0
- package/types-ts3.8/custom/hubextensions.d.ts +5 -0
- package/types-ts3.8/custom/scope.d.ts +34 -0
- package/types-ts3.8/custom/transaction.d.ts +17 -0
- package/types-ts3.8/index.d.ts +31 -0
- package/types-ts3.8/propagator.d.ts +20 -0
- package/types-ts3.8/sampler.d.ts +15 -0
- package/types-ts3.8/semanticAttributes.d.ts +17 -0
- package/types-ts3.8/setupEventContextTrace.d.ts +4 -0
- package/types-ts3.8/spanExporter.d.ts +17 -0
- package/types-ts3.8/spanProcessor.d.ts +22 -0
- package/types-ts3.8/trace.d.ts +28 -0
- package/types-ts3.8/types.d.ts +26 -0
- package/types-ts3.8/utils/addOriginToSpan.d.ts +5 -0
- package/types-ts3.8/utils/captureExceptionForTimedEvent.d.ts +8 -0
- package/types-ts3.8/utils/contextData.d.ts +23 -0
- package/types-ts3.8/utils/convertOtelTimeToSeconds.d.ts +6 -0
- package/types-ts3.8/utils/getActiveSpan.d.ts +11 -0
- package/types-ts3.8/utils/getRequestSpanData.d.ts +8 -0
- package/types-ts3.8/utils/getSpanKind.d.ts +10 -0
- package/types-ts3.8/utils/groupSpansWithParents.d.ts +13 -0
- package/types-ts3.8/utils/isSentryRequest.d.ts +8 -0
- package/types-ts3.8/utils/mapStatus.d.ts +7 -0
- package/types-ts3.8/utils/parseSpanDescription.d.ts +32 -0
- package/types-ts3.8/utils/spanData.d.ts +20 -0
- package/types-ts3.8/utils/spanTypes.d.ts +52 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SpanKind } from '@opentelemetry/api';
|
|
2
|
+
import type { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSpanKind.d.ts","sourceRoot":"","sources":["../../../src/utils/getSpanKind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAMxD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { 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
|
+
//# sourceMappingURL=groupSpansWithParents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupSpansWithParents.d.ts","sourceRoot":"","sources":["../../../src/utils/groupSpansWithParents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAIlE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,CAUvE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AbstractSpan } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param otelSpan Checks wheter 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSentryRequest.d.ts","sourceRoot":"","sources":["../../../src/utils/isSentryRequest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAc/D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SpanStatusType as SentryStatus } from '@sentry/core';
|
|
2
|
+
import type { AbstractSpan } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Get a Sentry span status from an otel span.
|
|
5
|
+
*/
|
|
6
|
+
export declare function mapStatus(span: AbstractSpan): SentryStatus;
|
|
7
|
+
//# sourceMappingURL=mapStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapStatus.d.ts","sourceRoot":"","sources":["../../../src/utils/mapStatus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAsC7C;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CA4B1D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Attributes, AttributeValue } from '@opentelemetry/api';
|
|
2
|
+
import { SpanKind } from '@opentelemetry/api';
|
|
3
|
+
import type { TransactionSource } from '@sentry/types';
|
|
4
|
+
import type { AbstractSpan } from '../types';
|
|
5
|
+
interface SpanDescription {
|
|
6
|
+
op: string | undefined;
|
|
7
|
+
description: string;
|
|
8
|
+
source: TransactionSource;
|
|
9
|
+
data?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Extract better op/description from an otel span.
|
|
13
|
+
*
|
|
14
|
+
* Based on https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7422ce2a06337f68a59b552b8c5a2ac125d6bae5/exporter/sentryexporter/sentry_exporter.go#L306
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseSpanDescription(span: AbstractSpan): SpanDescription;
|
|
17
|
+
/** Only exported for tests. */
|
|
18
|
+
export declare function descriptionForHttpMethod({ name, kind, attributes }: {
|
|
19
|
+
name: string;
|
|
20
|
+
attributes: Attributes;
|
|
21
|
+
kind: SpanKind;
|
|
22
|
+
}, httpMethod: AttributeValue): SpanDescription;
|
|
23
|
+
/** Exported for tests only */
|
|
24
|
+
export declare function getSanitizedUrl(attributes: Attributes, kind: SpanKind): {
|
|
25
|
+
url: string | undefined;
|
|
26
|
+
urlPath: string | undefined;
|
|
27
|
+
query: string | undefined;
|
|
28
|
+
fragment: string | undefined;
|
|
29
|
+
hasRoute: boolean;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=parseSpanDescription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseSpanDescription.d.ts","sourceRoot":"","sources":["../../../src/utils/parseSpanDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,eAAe,CA2CxE;AAWD,+BAA+B;AAC/B,wBAAgB,wBAAwB,CACtC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,EACpF,UAAU,EAAE,cAAc,GACzB,eAAe,CA0CjB;AAED,8BAA8B;AAC9B,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,QAAQ,GACb;IACD,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB,CA+BA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import type { Hub, Scope, TransactionMetadata } from '@sentry/types';
|
|
3
|
+
import type { AbstractSpan } from '../types';
|
|
4
|
+
/** Set the Sentry scope on an OTEL span. */
|
|
5
|
+
export declare function setSpanScope(span: AbstractSpan, scope: Scope): void;
|
|
6
|
+
/** Get the Sentry scope of an OTEL span. */
|
|
7
|
+
export declare function getSpanScope(span: AbstractSpan): Scope | undefined;
|
|
8
|
+
/** Set the Sentry hub on an OTEL span. */
|
|
9
|
+
export declare function setSpanHub(span: AbstractSpan, hub: Hub): void;
|
|
10
|
+
/** Get the Sentry hub of an OTEL span. */
|
|
11
|
+
export declare function getSpanHub(span: AbstractSpan): Hub | undefined;
|
|
12
|
+
/** Set the parent OTEL span on an OTEL span. */
|
|
13
|
+
export declare function setSpanParent(span: AbstractSpan, parentSpan: Span): void;
|
|
14
|
+
/** Get the parent OTEL span of an OTEL span. */
|
|
15
|
+
export declare function getSpanParent(span: AbstractSpan): Span | undefined;
|
|
16
|
+
/** Set metadata for an OTEL span. */
|
|
17
|
+
export declare function setSpanMetadata(span: AbstractSpan, metadata: Partial<TransactionMetadata>): void;
|
|
18
|
+
/** Get metadata for an OTEL span. */
|
|
19
|
+
export declare function getSpanMetadata(span: AbstractSpan): Partial<TransactionMetadata> | undefined;
|
|
20
|
+
//# sourceMappingURL=spanData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spanData.d.ts","sourceRoot":"","sources":["../../../src/utils/spanData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAU7C,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAEnE;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,KAAK,GAAG,SAAS,CAElE;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAE7D;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,GAAG,GAAG,SAAS,CAE9D;AAED,gDAAgD;AAChD,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,GAAG,IAAI,CAExE;AAED,gDAAgD;AAChD,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,CAElE;AAED,qCAAqC;AACrC,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAEhG;AAED,qCAAqC;AACrC,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAE5F"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { SpanKind, SpanStatus } from '@opentelemetry/api';
|
|
2
|
+
import type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import type { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spanTypes.d.ts","sourceRoot":"","sources":["../../../src/utils/spanTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,YAAY,EAC7D,IAAI,EAAE,QAAQ,GACb,IAAI,IAAI,QAAQ,GAAG;IAAE,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;CAAE,CAG/D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,QAAQ,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAGhH;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,YAAY,EACzD,IAAI,EAAE,QAAQ,GACb,IAAI,IAAI,QAAQ,GAAG;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,CAG3C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAG9G;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,YAAY,EAC3D,IAAI,EAAE,QAAQ,GACb,IAAI,IAAI,QAAQ,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAG7C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,YAAY,EACzD,IAAI,EAAE,QAAQ,GACb,IAAI,IAAI,QAAQ,GAAG;IAAE,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAG7C"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets the async context strategy to use follow the OTEL context under the hood.
|
|
3
|
+
* We handle forking a hub inside of our custom OTEL Context Manager (./otelContextManager.ts)
|
|
4
|
+
*/
|
|
5
|
+
export declare function setOpenTelemetryContextAsyncContextStrategy(): void;
|
|
6
|
+
//# sourceMappingURL=asyncContextStrategy.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const SENTRY_TRACE_HEADER = "sentry-trace";
|
|
2
|
+
export declare const SENTRY_BAGGAGE_HEADER = "baggage";
|
|
3
|
+
/** Context Key to hold a PropagationContext. */
|
|
4
|
+
export declare const SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY: symbol;
|
|
5
|
+
/** Context Key to hold a Hub. */
|
|
6
|
+
export declare const SENTRY_HUB_CONTEXT_KEY: symbol;
|
|
7
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ContextManager } from '@opentelemetry/api';
|
|
2
|
+
/**
|
|
3
|
+
* Wrap an OpenTelemetry ContextManager in a way that ensures the context is kept in sync with the Sentry Hub.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';
|
|
7
|
+
* const SentryContextManager = wrapContextManagerClass(AsyncLocalStorageContextManager);
|
|
8
|
+
* const contextManager = new SentryContextManager();
|
|
9
|
+
*/
|
|
10
|
+
export declare function wrapContextManagerClass<ContextManagerInstance extends ContextManager>(ContextManagerClass: new (...args: any[]) => ContextManagerInstance): typeof ContextManagerClass;
|
|
11
|
+
//# sourceMappingURL=contextManager.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseClient } from '@sentry/core';
|
|
2
|
+
import { Client } from '@sentry/types';
|
|
3
|
+
import { OpenTelemetryClient as OpenTelemetryClientInterface } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Wrap an Client with things we need for OpenTelemetry support.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const OpenTelemetryClient = getWrappedClientClass(NodeClient);
|
|
9
|
+
* const client = new OpenTelemetryClient(options);
|
|
10
|
+
*/
|
|
11
|
+
export declare function wrapClientClass<ClassConstructor extends new (...args: any[]) => Client & BaseClient<any>, WrappedClassConstructor extends new (...args: any[]) => Client & BaseClient<any> & OpenTelemetryClientInterface>(ClientClass: ClassConstructor): WrappedClassConstructor;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Carrier, Scope } from '@sentry/core';
|
|
2
|
+
import { Hub } from '@sentry/core';
|
|
3
|
+
import { Client } from '@sentry/types';
|
|
4
|
+
/**
|
|
5
|
+
* A custom hub that ensures we always creat an OTEL scope.
|
|
6
|
+
* Exported only for testing
|
|
7
|
+
*/
|
|
8
|
+
export declare class OpenTelemetryHub extends Hub {
|
|
9
|
+
constructor(client?: Client, scope?: Scope);
|
|
10
|
+
/**
|
|
11
|
+
* @inheritDoc
|
|
12
|
+
*/
|
|
13
|
+
pushScope(): Scope;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the default hub instance.
|
|
17
|
+
*
|
|
18
|
+
* If a hub is already registered in the global carrier but this module
|
|
19
|
+
* contains a more recent version, it replaces the registered version.
|
|
20
|
+
* Otherwise, the currently registered hub will be returned.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getCurrentHub(): Hub;
|
|
23
|
+
/**
|
|
24
|
+
* Ensure the global hub is an OpenTelemetryHub.
|
|
25
|
+
*/
|
|
26
|
+
export declare function setupGlobalHub(): void;
|
|
27
|
+
/**
|
|
28
|
+
* This will create a new {@link Hub} and add to the passed object on
|
|
29
|
+
* __SENTRY__.hub.
|
|
30
|
+
* @param carrier object
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
export declare function getHubFromCarrier(carrier: Carrier): Hub;
|
|
34
|
+
/**
|
|
35
|
+
* @private Private API with no semver guarantees!
|
|
36
|
+
*
|
|
37
|
+
* If the carrier does not contain a hub, a new hub is created with the global hub client and scope.
|
|
38
|
+
*/
|
|
39
|
+
export declare function ensureHubOnCarrier(carrier: Carrier, parent?: Hub): void;
|
|
40
|
+
//# sourceMappingURL=hub.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Span } from '@opentelemetry/api';
|
|
2
|
+
import { Scope } from '@sentry/core';
|
|
3
|
+
import { Breadcrumb, Span as SentrySpan } from '@sentry/types';
|
|
4
|
+
/** A fork of the classic scope with some otel specific stuff. */
|
|
5
|
+
export declare class OpenTelemetryScope extends Scope {
|
|
6
|
+
/**
|
|
7
|
+
* This can be set to ensure the scope uses _this_ span as the active one,
|
|
8
|
+
* instead of using getActiveSpan().
|
|
9
|
+
*/
|
|
10
|
+
activeSpan: Span | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
static clone(scope?: Scope): Scope;
|
|
15
|
+
/**
|
|
16
|
+
* In node-experimental, scope.getSpan() always returns undefined.
|
|
17
|
+
* Instead, use the global `getActiveSpan()`.
|
|
18
|
+
*/
|
|
19
|
+
getSpan(): undefined;
|
|
20
|
+
/**
|
|
21
|
+
* In node-experimental, scope.setSpan() is a noop.
|
|
22
|
+
* Instead, use the global `startSpan()` to define the active span.
|
|
23
|
+
*/
|
|
24
|
+
setSpan(_span: SentrySpan): this;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
protected _getBreadcrumbs(): Breadcrumb[];
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Transaction } from '@sentry/core';
|
|
2
|
+
import { Hub as HubInterface, Scope, TransactionContext } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* This is a fork of core's tracing/hubextensions.ts _startTransaction,
|
|
5
|
+
* with some OTEL specifics.
|
|
6
|
+
*/
|
|
7
|
+
export declare function startTransaction(hub: HubInterface, transactionContext: TransactionContext): Transaction;
|
|
8
|
+
/**
|
|
9
|
+
* This is a fork of the base Transaction with OTEL specific stuff added.
|
|
10
|
+
*/
|
|
11
|
+
export declare class OpenTelemetryTransaction extends Transaction {
|
|
12
|
+
/**
|
|
13
|
+
* Finish the transaction, but apply the given scope instead of the current one.
|
|
14
|
+
*/
|
|
15
|
+
finishWithScope(endTimestamp?: number, scope?: Scope): string | undefined;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { addOriginToSpan } from './utils/addOriginToSpan';
|
|
2
|
+
import { maybeCaptureExceptionForTimedEvent } from './utils/captureExceptionForTimedEvent';
|
|
3
|
+
import { getRequestSpanData } from './utils/getRequestSpanData';
|
|
4
|
+
export { OpenTelemetryClient } from './types';
|
|
5
|
+
export { wrapClientClass } from './custom/client';
|
|
6
|
+
export { getSpanKind } from './utils/getSpanKind';
|
|
7
|
+
export { getSpanHub, getSpanMetadata, getSpanParent, getSpanScope, setSpanMetadata } from './utils/spanData';
|
|
8
|
+
export { getPropagationContextFromContext, setPropagationContextOnContext } from './utils/contextData';
|
|
9
|
+
export { spanHasAttributes, spanHasEvents, spanHasKind, spanHasName, spanHasParentId, spanHasStatus, } from './utils/spanTypes';
|
|
10
|
+
export { isSentryRequestSpan } from './utils/isSentryRequest';
|
|
11
|
+
export { getActiveSpan, getRootSpan } from './utils/getActiveSpan';
|
|
12
|
+
export { startSpan, startInactiveSpan } from './trace';
|
|
13
|
+
export { getCurrentHub, setupGlobalHub } from './custom/hub';
|
|
14
|
+
export { addTracingExtensions } from './custom/hubextensions';
|
|
15
|
+
export { setupEventContextTrace } from './setupEventContextTrace';
|
|
16
|
+
export { setOpenTelemetryContextAsyncContextStrategy } from './asyncContextStrategy';
|
|
17
|
+
export { wrapContextManagerClass } from './contextManager';
|
|
18
|
+
export { SentryPropagator } from './propagator';
|
|
19
|
+
export { SentrySpanProcessor } from './spanProcessor';
|
|
20
|
+
export { SentrySampler } from './sampler';
|
|
21
|
+
/**
|
|
22
|
+
* The following internal utils are not considered public API and are subject to change.
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
declare const _INTERNAL: {
|
|
26
|
+
readonly addOriginToSpan: typeof addOriginToSpan;
|
|
27
|
+
readonly maybeCaptureExceptionForTimedEvent: typeof maybeCaptureExceptionForTimedEvent;
|
|
28
|
+
readonly getRequestSpanData: typeof getRequestSpanData;
|
|
29
|
+
};
|
|
30
|
+
export { _INTERNAL };
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context, TextMapGetter, TextMapSetter } from '@opentelemetry/api';
|
|
2
|
+
import { W3CBaggagePropagator } from '@opentelemetry/core';
|
|
3
|
+
/**
|
|
4
|
+
* Injects and extracts `sentry-trace` and `baggage` headers from carriers.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SentryPropagator extends W3CBaggagePropagator {
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
|
+
inject(context: Context, carrier: unknown, setter: TextMapSetter): void;
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
extract(context: Context, carrier: unknown, getter: TextMapGetter): Context;
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
fields(): string[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=propagator.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Context } from '@opentelemetry/api';
|
|
2
|
+
import { Sampler, SamplingResult } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { Client } from '@sentry/types';
|
|
4
|
+
/**
|
|
5
|
+
* A custom OTEL sampler that uses Sentry sampling rates to make it's decision
|
|
6
|
+
*/
|
|
7
|
+
export declare class SentrySampler implements Sampler {
|
|
8
|
+
private _client;
|
|
9
|
+
constructor(client: Client);
|
|
10
|
+
/** @inheritDoc */
|
|
11
|
+
shouldSample(context: Context, traceId: string, spanName: string, _spanKind: unknown, _attributes: unknown, _links: unknown): SamplingResult;
|
|
12
|
+
/** Returns the sampler name or short description with the configuration. */
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=sampler.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These are internal and are not supposed to be used/depended on by external parties.
|
|
3
|
+
* No guarantees apply to these attributes, and the may change/disappear at any time.
|
|
4
|
+
*/
|
|
5
|
+
export declare const InternalSentrySemanticAttributes: {
|
|
6
|
+
readonly ORIGIN: "sentry.origin";
|
|
7
|
+
readonly OP: "sentry.op";
|
|
8
|
+
readonly SOURCE: "sentry.source";
|
|
9
|
+
readonly SAMPLE_RATE: "sentry.sample_rate";
|
|
10
|
+
readonly PARENT_SAMPLED: "sentry.parentSampled";
|
|
11
|
+
readonly BREADCRUMB_TYPE: "sentry.breadcrumb.type";
|
|
12
|
+
readonly BREADCRUMB_LEVEL: "sentry.breadcrumb.level";
|
|
13
|
+
readonly BREADCRUMB_EVENT_ID: "sentry.breadcrumb.event_id";
|
|
14
|
+
readonly BREADCRUMB_CATEGORY: "sentry.breadcrumb.category";
|
|
15
|
+
readonly BREADCRUMB_DATA: "sentry.breadcrumb.data";
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=semanticAttributes.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
2
|
+
import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
/**
|
|
4
|
+
* A Sentry-specific exporter that converts OpenTelemetry Spans to Sentry Spans & Transactions.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SentrySpanExporter implements SpanExporter {
|
|
7
|
+
private _finishedSpans;
|
|
8
|
+
private _stopped;
|
|
9
|
+
constructor();
|
|
10
|
+
/** @inheritDoc */
|
|
11
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
12
|
+
/** @inheritDoc */
|
|
13
|
+
shutdown(): Promise<void>;
|
|
14
|
+
/** @inheritDoc */
|
|
15
|
+
forceFlush(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=spanExporter.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Context } from '@opentelemetry/api';
|
|
2
|
+
import { Span, SpanProcessor as SpanProcessorInterface } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
4
|
+
/**
|
|
5
|
+
* Converts OpenTelemetry Spans to Sentry Spans and sends them to Sentry via
|
|
6
|
+
* the Sentry SDK.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SentrySpanProcessor extends BatchSpanProcessor implements SpanProcessorInterface {
|
|
9
|
+
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* @inheritDoc
|
|
12
|
+
*/
|
|
13
|
+
onStart(span: Span, parentContext: Context): void;
|
|
14
|
+
/** @inheritDoc */
|
|
15
|
+
onEnd(span: Span): void;
|
|
16
|
+
/**
|
|
17
|
+
* You can overwrite this in a sub class to implement custom behavior for dropping spans.
|
|
18
|
+
* If you return `false` here, the span will not be passed to the exporter and thus not be sent.
|
|
19
|
+
*/
|
|
20
|
+
protected _shouldSendSpanToSentry(_span: Span): boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=spanProcessor.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Span } from '@opentelemetry/api';
|
|
2
|
+
import { OpenTelemetrySpanContext } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a function with a transaction/span and finishes the span after the function is done.
|
|
5
|
+
* The created span is the active span and will be used as parent by other spans created inside the function
|
|
6
|
+
* and can be accessed via `Sentry.getSpan()`, as long as the function is executed while the scope is active.
|
|
7
|
+
*
|
|
8
|
+
* If you want to create a span that is not set as active, use {@link startInactiveSpan}.
|
|
9
|
+
*
|
|
10
|
+
* Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
|
|
11
|
+
*/
|
|
12
|
+
export declare function startSpan<T>(spanContext: OpenTelemetrySpanContext, callback: (span: Span) => T): T;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use {@link startSpan} instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare const startActiveSpan: typeof startSpan;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a span. This span is not set as active, so will not get automatic instrumentation spans
|
|
19
|
+
* as children or be able to be accessed via `Sentry.getSpan()`.
|
|
20
|
+
*
|
|
21
|
+
* If you want to create a span that is set as active, use {@link startSpan}.
|
|
22
|
+
*
|
|
23
|
+
* Note that if you have not enabled tracing extensions via `addTracingExtensions`
|
|
24
|
+
* or you didn't set `tracesSampleRate` or `tracesSampler`, this function will not generate spans
|
|
25
|
+
* and the `span` returned from the callback will be undefined.
|
|
26
|
+
*/
|
|
27
|
+
export declare function startInactiveSpan(spanContext: OpenTelemetrySpanContext): Span;
|
|
28
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Span as WriteableSpan, Tracer } from '@opentelemetry/api';
|
|
2
|
+
import { BasicTracerProvider, ReadableSpan, Span } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { SpanOrigin, TransactionMetadata, TransactionSource } from '@sentry/types';
|
|
4
|
+
export interface OpenTelemetryClient {
|
|
5
|
+
tracer: Tracer;
|
|
6
|
+
traceProvider: BasicTracerProvider | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface OpenTelemetrySpanContext {
|
|
9
|
+
name: string;
|
|
10
|
+
op?: string;
|
|
11
|
+
metadata?: Partial<TransactionMetadata>;
|
|
12
|
+
origin?: SpanOrigin;
|
|
13
|
+
source?: TransactionSource;
|
|
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 `@opentelemwetry/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;
|
|
25
|
+
export { Span };
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Span as OtelSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import { Hub } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* Maybe capture a Sentry exception for an OTEL timed event.
|
|
5
|
+
* This will check if the event is exception-like and in that case capture it as an exception.
|
|
6
|
+
*/
|
|
7
|
+
export declare function maybeCaptureExceptionForTimedEvent(hub: Hub, event: TimedEvent, otelSpan?: OtelSpan): void;
|
|
8
|
+
//# sourceMappingURL=captureExceptionForTimedEvent.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context } from '@opentelemetry/api';
|
|
2
|
+
import { Hub, PropagationContext } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* Try to get the Propagation Context from the given OTEL context.
|
|
5
|
+
* This requires the SentryPropagator to be registered.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPropagationContextFromContext(context: Context): PropagationContext | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Set a Propagation Context on an OTEL context..
|
|
10
|
+
* This will return a forked context with the Propagation Context set.
|
|
11
|
+
*/
|
|
12
|
+
export declare function setPropagationContextOnContext(context: Context, propagationContext: PropagationContext): Context;
|
|
13
|
+
/**
|
|
14
|
+
* Try to get the Hub from the given OTEL context.
|
|
15
|
+
* This requires a Context Manager that was wrapped with getWrappedContextManager.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getHubFromContext(context: Context): Hub | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Set a Hub on an OTEL context..
|
|
20
|
+
* This will return a forked context with the Propagation Context set.
|
|
21
|
+
*/
|
|
22
|
+
export declare function setHubOnContext(context: Context, hub: Hub): Context;
|
|
23
|
+
//# sourceMappingURL=contextData.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Span } from '@opentelemetry/api';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the currently active span.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getActiveSpan(): Span | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Get the root span for the given span.
|
|
8
|
+
* The given span may be the root span itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getRootSpan(span: Span): Span;
|
|
11
|
+
//# sourceMappingURL=getActiveSpan.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Span } from '@opentelemetry/api';
|
|
2
|
+
import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { SanitizedRequestData } from '@sentry/types';
|
|
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
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
//# sourceMappingURL=groupSpansWithParents.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AbstractSpan } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param otelSpan Checks wheter 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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SpanStatusType as SentryStatus } from '@sentry/core';
|
|
2
|
+
import { AbstractSpan } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Get a Sentry span status from an otel span.
|
|
5
|
+
*/
|
|
6
|
+
export declare function mapStatus(span: AbstractSpan): SentryStatus;
|
|
7
|
+
//# sourceMappingURL=mapStatus.d.ts.map
|