@sentry/opentelemetry 10.0.0-alpha.2 → 10.0.0-beta.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/build/cjs/index.js +5 -2
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +6 -3
- package/build/esm/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/propagator.d.ts.map +1 -1
- package/build/types/trace.d.ts +1 -1
- package/build/types-ts3.8/trace.d.ts +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ATTR_URL_FULL, SEMATTRS_HTTP_URL, ATTR_HTTP_REQUEST_METHOD, SEMATTRS_HTTP_METHOD, SEMATTRS_DB_SYSTEM, SEMATTRS_RPC_SERVICE, SEMATTRS_MESSAGING_SYSTEM, SEMATTRS_FAAS_TRIGGER, SEMATTRS_DB_STATEMENT, SEMATTRS_HTTP_TARGET, ATTR_HTTP_ROUTE, ATTR_HTTP_RESPONSE_STATUS_CODE, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_RPC_GRPC_STATUS_CODE } from '@opentelemetry/semantic-conventions';
|
|
2
|
-
import { parseUrl, getSanitizedUrlString, SDK_VERSION, addNonEnumerableProperty, isSentryRequestUrl, getClient, baggageHeaderToDynamicSamplingContext, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, stripUrlQueryAndFragment, spanToJSON, hasSpansEnabled, dynamicSamplingContextToSentryBaggageHeader, LRUMap, debug, parseBaggageHeader, SENTRY_BAGGAGE_KEY_PREFIX, generateSentryTraceHeader, stringMatchesSomePattern, getDynamicSamplingContextFromSpan, getCurrentScope, getDynamicSamplingContextFromScope, getIsolationScope, propagationContextFromHeaders, handleCallbackErrors, spanToTraceContext, getTraceContextFromScope, getRootSpan, getCapturedScopesOnSpan, setAsyncContextStrategy, getDefaultIsolationScope, getDefaultCurrentScope, SPAN_STATUS_OK, SPAN_STATUS_ERROR, getSpanStatusFromHttpCode, debounce, timedEventsToMeasurements, captureEvent, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, convertSpanLinksForEnvelope, getStatusMessage, spanTimeInputToSeconds, addChildSpanToSpan, setCapturedScopesOnSpan, logSpanStart, logSpanEnd, parseSampleRate, sampleSpan } from '@sentry/core';
|
|
2
|
+
import { parseUrl, getSanitizedUrlString, SDK_VERSION, addNonEnumerableProperty, isSentryRequestUrl, getClient, baggageHeaderToDynamicSamplingContext, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, stripUrlQueryAndFragment, spanToJSON, hasSpansEnabled, dynamicSamplingContextToSentryBaggageHeader, LRUMap, debug, parseBaggageHeader, SENTRY_BAGGAGE_KEY_PREFIX, generateSentryTraceHeader, stringMatchesSomePattern, getDynamicSamplingContextFromSpan, getCurrentScope, getDynamicSamplingContextFromScope, getIsolationScope, propagationContextFromHeaders, shouldContinueTrace, handleCallbackErrors, spanToTraceContext, getTraceContextFromScope, getRootSpan, getCapturedScopesOnSpan, setAsyncContextStrategy, getDefaultIsolationScope, getDefaultCurrentScope, SPAN_STATUS_OK, SPAN_STATUS_ERROR, getSpanStatusFromHttpCode, debounce, timedEventsToMeasurements, captureEvent, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, convertSpanLinksForEnvelope, getStatusMessage, spanTimeInputToSeconds, addChildSpanToSpan, setCapturedScopesOnSpan, logSpanStart, logSpanEnd, parseSampleRate, sampleSpan } from '@sentry/core';
|
|
3
3
|
export { getClient, getDynamicSamplingContextFromSpan } from '@sentry/core';
|
|
4
4
|
import * as api from '@opentelemetry/api';
|
|
5
5
|
import { trace, SpanKind, createContextKey, TraceFlags, propagation, INVALID_TRACEID, context, SpanStatusCode, ROOT_CONTEXT, isSpanContextValid } from '@opentelemetry/api';
|
|
@@ -853,9 +853,12 @@ function getContextWithRemoteActiveSpan(
|
|
|
853
853
|
|
|
854
854
|
const { traceId, parentSpanId, sampled, dsc } = propagationContext;
|
|
855
855
|
|
|
856
|
+
const client = getClient();
|
|
857
|
+
const incomingDsc = baggageHeaderToDynamicSamplingContext(baggage);
|
|
858
|
+
|
|
856
859
|
// We only want to set the virtual span if we are continuing a concrete trace
|
|
857
860
|
// Otherwise, we ignore the incoming trace here, e.g. if we have no trace headers
|
|
858
|
-
if (!parentSpanId) {
|
|
861
|
+
if (!parentSpanId || (client && !shouldContinueTrace(client, incomingDsc?.org_id))) {
|
|
859
862
|
return ctx;
|
|
860
863
|
}
|
|
861
864
|
|
|
@@ -1189,7 +1192,7 @@ function continueTrace(options, callback) {
|
|
|
1189
1192
|
|
|
1190
1193
|
/**
|
|
1191
1194
|
* Get the trace context for a given scope.
|
|
1192
|
-
* We have a custom
|
|
1195
|
+
* We have a custom implementation here because we need an OTEL-specific way to get the span from a scope.
|
|
1193
1196
|
*/
|
|
1194
1197
|
function getTraceContextForScope(
|
|
1195
1198
|
client,
|