@sentry/opentelemetry 10.52.0 → 10.53.1
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.browser.js +1 -1
- package/build/cjs/index.js +1 -1
- package/build/cjs/{resource-C7SKXNJp.js → resource-CD6NEt3L.js} +25 -5
- package/build/cjs/resource-CD6NEt3L.js.map +1 -0
- package/build/esm/index.browser.js +1 -1
- package/build/esm/index.js +2 -2
- package/build/esm/package.json +1 -1
- package/build/esm/{resource-Bhpm2sLf.js → resource-BDW0nlGH.js} +25 -5
- package/build/esm/{resource-Bhpm2sLf.js.map → resource-BDW0nlGH.js.map} +1 -1
- package/build/types/spanExporter.d.ts.map +1 -1
- package/package.json +2 -2
- package/build/cjs/resource-C7SKXNJp.js.map +0 -1
|
@@ -1876,8 +1876,11 @@ class SentrySpanExporter {
|
|
|
1876
1876
|
// We'll recursively add all the child spans to this array
|
|
1877
1877
|
const spans = transactionEvent.spans || [];
|
|
1878
1878
|
|
|
1879
|
+
let hasGenAiSpans = false;
|
|
1879
1880
|
for (const child of root.children) {
|
|
1880
|
-
createAndFinishSpanForOtelSpan(child, spans, sentSpans)
|
|
1881
|
+
if (createAndFinishSpanForOtelSpan(child, spans, sentSpans)) {
|
|
1882
|
+
hasGenAiSpans = true;
|
|
1883
|
+
}
|
|
1881
1884
|
}
|
|
1882
1885
|
|
|
1883
1886
|
// spans.sort() mutates the array, but we do not use this anymore after this point
|
|
@@ -1887,6 +1890,13 @@ class SentrySpanExporter {
|
|
|
1887
1890
|
? spans.sort((a, b) => a.start_timestamp - b.start_timestamp).slice(0, MAX_SPAN_COUNT)
|
|
1888
1891
|
: spans;
|
|
1889
1892
|
|
|
1893
|
+
if (hasGenAiSpans) {
|
|
1894
|
+
transactionEvent.sdkProcessingMetadata = {
|
|
1895
|
+
...transactionEvent.sdkProcessingMetadata,
|
|
1896
|
+
hasGenAiSpans: true,
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1890
1900
|
const measurements = timedEventsToMeasurements(span.events);
|
|
1891
1901
|
if (measurements) {
|
|
1892
1902
|
transactionEvent.measurements = measurements;
|
|
@@ -2003,6 +2013,9 @@ function createTransactionForOtelSpan(span) {
|
|
|
2003
2013
|
return transactionEvent;
|
|
2004
2014
|
}
|
|
2005
2015
|
|
|
2016
|
+
/**
|
|
2017
|
+
* Returns `true` if this span or any descendant is a gen_ai span.
|
|
2018
|
+
*/
|
|
2006
2019
|
function createAndFinishSpanForOtelSpan(node, spans, sentSpans) {
|
|
2007
2020
|
const span = node.span;
|
|
2008
2021
|
|
|
@@ -2014,10 +2027,13 @@ function createAndFinishSpanForOtelSpan(node, spans, sentSpans) {
|
|
|
2014
2027
|
|
|
2015
2028
|
// If this span should be dropped, we still want to create spans for the children of this
|
|
2016
2029
|
if (shouldDrop) {
|
|
2030
|
+
let hasGenAiSpans = false;
|
|
2017
2031
|
node.children.forEach(child => {
|
|
2018
|
-
createAndFinishSpanForOtelSpan(child, spans, sentSpans)
|
|
2032
|
+
if (createAndFinishSpanForOtelSpan(child, spans, sentSpans)) {
|
|
2033
|
+
hasGenAiSpans = true;
|
|
2034
|
+
}
|
|
2019
2035
|
});
|
|
2020
|
-
return;
|
|
2036
|
+
return hasGenAiSpans;
|
|
2021
2037
|
}
|
|
2022
2038
|
|
|
2023
2039
|
const span_id = span.spanContext().spanId;
|
|
@@ -2054,9 +2070,13 @@ function createAndFinishSpanForOtelSpan(node, spans, sentSpans) {
|
|
|
2054
2070
|
|
|
2055
2071
|
spans.push(spanJSON);
|
|
2056
2072
|
|
|
2073
|
+
let hasGenAiSpans = !!op?.startsWith('gen_ai.');
|
|
2057
2074
|
node.children.forEach(child => {
|
|
2058
|
-
createAndFinishSpanForOtelSpan(child, spans, sentSpans)
|
|
2075
|
+
if (createAndFinishSpanForOtelSpan(child, spans, sentSpans)) {
|
|
2076
|
+
hasGenAiSpans = true;
|
|
2077
|
+
}
|
|
2059
2078
|
});
|
|
2079
|
+
return hasGenAiSpans;
|
|
2060
2080
|
}
|
|
2061
2081
|
|
|
2062
2082
|
function getSpanData(span)
|
|
@@ -2593,4 +2613,4 @@ function getSentryResource(serviceNameFallback) {
|
|
|
2593
2613
|
}
|
|
2594
2614
|
|
|
2595
2615
|
export { startSpanManual as A, suppressTracing as B, withActiveSpan as C, wrapClientClass as D, wrapContextManagerClass as E, wrapSamplingDecision as F, SENTRY_SCOPES_CONTEXT_KEY as S, SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION as a, buildContextWithSentryScopes as b, SentryPropagator as c, SentrySampler as d, SentrySpanProcessor as e, continueTrace as f, enhanceDscWithOpenTelemetryRootSpanName as g, getActiveSpan as h, getRequestSpanData as i, getScopesFromContext as j, getSentryResource as k, getSpanKind as l, getTraceContextForScope as m, isSentryRequestSpan as n, openTelemetrySetupCheck as o, setOpenTelemetryContextAsyncContextStrategy as p, setupEventContextTrace as q, spanHasAttributes as r, setIsSetup as s, spanHasEvents as t, spanHasKind as u, spanHasName as v, spanHasParentId as w, spanHasStatus as x, startInactiveSpan as y, startSpan as z };
|
|
2596
|
-
//# sourceMappingURL=resource-
|
|
2616
|
+
//# sourceMappingURL=resource-BDW0nlGH.js.map
|