@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/cjs/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const api = require('@opentelemetry/api');
|
|
|
10
10
|
const core = require('@sentry/core');
|
|
11
11
|
const core$1 = require('@opentelemetry/core');
|
|
12
12
|
const sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
13
|
+
const instrumentation = require('@opentelemetry/instrumentation');
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Check if a given span has attributes.
|
|
@@ -1088,15 +1089,6 @@ function suppressTracing(callback) {
|
|
|
1088
1089
|
return api.context.with(ctx, callback);
|
|
1089
1090
|
}
|
|
1090
1091
|
|
|
1091
|
-
/**
|
|
1092
|
-
* Ensure the global hub is setup.
|
|
1093
|
-
*
|
|
1094
|
-
* @deprecated This will be removed in the next major version.
|
|
1095
|
-
*/
|
|
1096
|
-
function setupGlobalHub() {
|
|
1097
|
-
// noop
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
1092
|
/** Ensure the `trace` context is set on all events. */
|
|
1101
1093
|
function setupEventContextTrace(client) {
|
|
1102
1094
|
client.on('preprocessEvent', event => {
|
|
@@ -1119,12 +1111,13 @@ function setupEventContextTrace(client) {
|
|
|
1119
1111
|
...event.contexts,
|
|
1120
1112
|
};
|
|
1121
1113
|
|
|
1114
|
+
const rootSpan = core.getRootSpan(span);
|
|
1115
|
+
|
|
1122
1116
|
event.sdkProcessingMetadata = {
|
|
1123
|
-
dynamicSamplingContext: getDynamicSamplingContextFromSpan(
|
|
1117
|
+
dynamicSamplingContext: getDynamicSamplingContextFromSpan(rootSpan),
|
|
1124
1118
|
...event.sdkProcessingMetadata,
|
|
1125
1119
|
};
|
|
1126
1120
|
|
|
1127
|
-
const rootSpan = core.getRootSpan(span);
|
|
1128
1121
|
const transactionName = spanHasName(rootSpan) ? rootSpan.name : undefined;
|
|
1129
1122
|
if (transactionName && !event.transaction) {
|
|
1130
1123
|
event.transaction = transactionName;
|
|
@@ -1902,8 +1895,8 @@ class SentrySampler {
|
|
|
1902
1895
|
// If we encounter a span emitted by Next.js, we do not want to sample it
|
|
1903
1896
|
// The reason for this is that the data quality of the spans varies, it is different per version of Next,
|
|
1904
1897
|
// and we need to keep our manual instrumentation around for the edge runtime anyhow.
|
|
1905
|
-
// BUT we only do this if we don't have a parent span with a sampling decision yet
|
|
1906
|
-
if (spanAttributes['next.span_type'] && typeof parentSampled !== 'boolean') {
|
|
1898
|
+
// BUT we only do this if we don't have a parent span with a sampling decision yet (or if the parent is remote)
|
|
1899
|
+
if (spanAttributes['next.span_type'] && (typeof parentSampled !== 'boolean' || _optionalChain([parentContext, 'optionalAccess', _5 => _5.isRemote]))) {
|
|
1907
1900
|
return { decision: sdkTraceBase.SamplingDecision.NOT_RECORD, traceState: traceState };
|
|
1908
1901
|
}
|
|
1909
1902
|
|
|
@@ -1981,11 +1974,24 @@ function getParentSampled(parentSpan, traceId, spanName) {
|
|
|
1981
1974
|
return undefined;
|
|
1982
1975
|
}
|
|
1983
1976
|
|
|
1977
|
+
/**
|
|
1978
|
+
* This method takes an OpenTelemetry instrumentation or
|
|
1979
|
+
* array of instrumentations and registers them with OpenTelemetry.
|
|
1980
|
+
*/
|
|
1981
|
+
function addOpenTelemetryInstrumentation(
|
|
1982
|
+
instrumentation$1,
|
|
1983
|
+
) {
|
|
1984
|
+
instrumentation.registerInstrumentations({
|
|
1985
|
+
instrumentations: Array.isArray(instrumentation$1) ? instrumentation$1 : [instrumentation$1],
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1984
1989
|
exports.getClient = core.getClient;
|
|
1985
1990
|
exports.getCurrentHubShim = core.getCurrentHubShim;
|
|
1986
1991
|
exports.SentryPropagator = SentryPropagator;
|
|
1987
1992
|
exports.SentrySampler = SentrySampler;
|
|
1988
1993
|
exports.SentrySpanProcessor = SentrySpanProcessor;
|
|
1994
|
+
exports.addOpenTelemetryInstrumentation = addOpenTelemetryInstrumentation;
|
|
1989
1995
|
exports.continueTrace = continueTrace;
|
|
1990
1996
|
exports.getActiveSpan = getActiveSpan;
|
|
1991
1997
|
exports.getDynamicSamplingContextFromSpan = getDynamicSamplingContextFromSpan;
|
|
@@ -1996,7 +2002,6 @@ exports.isSentryRequestSpan = isSentryRequestSpan;
|
|
|
1996
2002
|
exports.openTelemetrySetupCheck = openTelemetrySetupCheck;
|
|
1997
2003
|
exports.setOpenTelemetryContextAsyncContextStrategy = setOpenTelemetryContextAsyncContextStrategy;
|
|
1998
2004
|
exports.setupEventContextTrace = setupEventContextTrace;
|
|
1999
|
-
exports.setupGlobalHub = setupGlobalHub;
|
|
2000
2005
|
exports.spanHasAttributes = spanHasAttributes;
|
|
2001
2006
|
exports.spanHasEvents = spanHasEvents;
|
|
2002
2007
|
exports.spanHasKind = spanHasKind;
|