@sentry/opentelemetry 8.0.0-beta.2 → 8.0.0-beta.3
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/cjs/index.js +19 -14
- package/cjs/index.js.map +1 -1
- package/esm/index.js +19 -14
- package/esm/index.js.map +1 -1
- package/package.json +5 -4
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/instrumentation.d.ts +7 -0
- package/types/instrumentation.d.ts.map +1 -0
- package/types/setupEventContextTrace.d.ts.map +1 -1
- package/types-ts3.8/index.d.ts +1 -1
- package/types-ts3.8/instrumentation.d.ts +7 -0
- package/types/custom/hub.d.ts +0 -7
- package/types/custom/hub.d.ts.map +0 -1
- package/types-ts3.8/custom/hub.d.ts +0 -7
package/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { SDK_VERSION, getClient, getDynamicSamplingContextFromClient, SEMANTIC_A
|
|
|
7
7
|
export { getClient, getCurrentHubShim } from '@sentry/core';
|
|
8
8
|
import { W3CBaggagePropagator, isTracingSuppressed, TraceState, suppressTracing as suppressTracing$1 } from '@opentelemetry/core';
|
|
9
9
|
import { SamplingDecision } from '@opentelemetry/sdk-trace-base';
|
|
10
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Check if a given span has attributes.
|
|
@@ -1085,15 +1086,6 @@ function suppressTracing(callback) {
|
|
|
1085
1086
|
return context.with(ctx, callback);
|
|
1086
1087
|
}
|
|
1087
1088
|
|
|
1088
|
-
/**
|
|
1089
|
-
* Ensure the global hub is setup.
|
|
1090
|
-
*
|
|
1091
|
-
* @deprecated This will be removed in the next major version.
|
|
1092
|
-
*/
|
|
1093
|
-
function setupGlobalHub() {
|
|
1094
|
-
// noop
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
1089
|
/** Ensure the `trace` context is set on all events. */
|
|
1098
1090
|
function setupEventContextTrace(client) {
|
|
1099
1091
|
client.on('preprocessEvent', event => {
|
|
@@ -1116,12 +1108,13 @@ function setupEventContextTrace(client) {
|
|
|
1116
1108
|
...event.contexts,
|
|
1117
1109
|
};
|
|
1118
1110
|
|
|
1111
|
+
const rootSpan = getRootSpan(span);
|
|
1112
|
+
|
|
1119
1113
|
event.sdkProcessingMetadata = {
|
|
1120
|
-
dynamicSamplingContext: getDynamicSamplingContextFromSpan(
|
|
1114
|
+
dynamicSamplingContext: getDynamicSamplingContextFromSpan(rootSpan),
|
|
1121
1115
|
...event.sdkProcessingMetadata,
|
|
1122
1116
|
};
|
|
1123
1117
|
|
|
1124
|
-
const rootSpan = getRootSpan(span);
|
|
1125
1118
|
const transactionName = spanHasName(rootSpan) ? rootSpan.name : undefined;
|
|
1126
1119
|
if (transactionName && !event.transaction) {
|
|
1127
1120
|
event.transaction = transactionName;
|
|
@@ -1899,8 +1892,8 @@ class SentrySampler {
|
|
|
1899
1892
|
// If we encounter a span emitted by Next.js, we do not want to sample it
|
|
1900
1893
|
// The reason for this is that the data quality of the spans varies, it is different per version of Next,
|
|
1901
1894
|
// and we need to keep our manual instrumentation around for the edge runtime anyhow.
|
|
1902
|
-
// BUT we only do this if we don't have a parent span with a sampling decision yet
|
|
1903
|
-
if (spanAttributes['next.span_type'] && typeof parentSampled !== 'boolean') {
|
|
1895
|
+
// BUT we only do this if we don't have a parent span with a sampling decision yet (or if the parent is remote)
|
|
1896
|
+
if (spanAttributes['next.span_type'] && (typeof parentSampled !== 'boolean' || _optionalChain([parentContext, 'optionalAccess', _5 => _5.isRemote]))) {
|
|
1904
1897
|
return { decision: SamplingDecision.NOT_RECORD, traceState: traceState };
|
|
1905
1898
|
}
|
|
1906
1899
|
|
|
@@ -1978,5 +1971,17 @@ function getParentSampled(parentSpan, traceId, spanName) {
|
|
|
1978
1971
|
return undefined;
|
|
1979
1972
|
}
|
|
1980
1973
|
|
|
1981
|
-
|
|
1974
|
+
/**
|
|
1975
|
+
* This method takes an OpenTelemetry instrumentation or
|
|
1976
|
+
* array of instrumentations and registers them with OpenTelemetry.
|
|
1977
|
+
*/
|
|
1978
|
+
function addOpenTelemetryInstrumentation(
|
|
1979
|
+
instrumentation,
|
|
1980
|
+
) {
|
|
1981
|
+
registerInstrumentations({
|
|
1982
|
+
instrumentations: Array.isArray(instrumentation) ? instrumentation : [instrumentation],
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
export { SentryPropagator, SentrySampler, SentrySpanProcessor, addOpenTelemetryInstrumentation, continueTrace, getActiveSpan, getDynamicSamplingContextFromSpan, getRequestSpanData, getScopesFromContext, getSpanKind, isSentryRequestSpan, openTelemetrySetupCheck, setOpenTelemetryContextAsyncContextStrategy, setupEventContextTrace, spanHasAttributes, spanHasEvents, spanHasKind, spanHasName, spanHasParentId, spanHasStatus, startInactiveSpan, startSpan, startSpanManual, suppressTracing, withActiveSpan, wrapClientClass, wrapContextManagerClass };
|
|
1982
1987
|
//# sourceMappingURL=index.js.map
|