2026-07-25 08:10:48 +00:00
// Module ID: 6316
2026-07-27 11:26:19 +00:00
// Function ID: 56772
2026-07-20 16:05:17 +00:00
// Name: spanTimeInputToSeconds
2026-07-25 08:10:48 +00:00
// Dependencies: [77, 6317, 6321, 6323, 6325, 6326, 6327, 6328, 6329, 6330, 6333, 6338, 6311]
2026-07-20 16:05:17 +00:00
// Exports: addChildSpanToSpan, getRootSpan, getSpanDescendants, removeChildSpanFromSpan, showSpanDropWarning, spanToTraceContext, spanToTraceHeader, spanToTransactionTraceContext, updateMetricSummaryOnActiveSpan, updateSpanName
2026-07-25 08:10:48 +00:00
// Module 6316 (spanTimeInputToSeconds)
2026-07-23 10:11:24 +00:00
import _defineProperty from "_defineProperty" ;
2026-07-20 16:05:17 +00:00
function spanTimeInputToSeconds ( getTime ) {
if ( "number" === typeof getTime ) {
let sum = ensureTimestampInSeconds ( getTime ) ;
} else {
const _Array = Array ;
if ( Array . isArray ( getTime ) ) {
sum = getTime [ 0 ] + getTime [ 1 ] / 1000000000 ;
} else {
const _Date = Date ;
if ( getTime instanceof Date ) {
sum = ensureTimestampInSeconds ( getTime . getTime ( ) ) ;
} else {
2026-07-25 08:10:48 +00:00
sum = require ( 6325 ) /* dateTimestampInSeconds */ . timestampInSeconds ( ) ;
const obj = require ( 6325 ) /* dateTimestampInSeconds */ ;
2026-07-20 16:05:17 +00:00
}
}
}
return sum ;
}
function ensureTimestampInSeconds ( arg0 ) {
let result = arg0 ;
if ( arg0 > 9999999999 ) {
result = arg0 / 1000 ;
}
return result ;
}
function spanToJSON ( getSpanJSON ) {
let endTime ;
let name ;
let parentSpanId ;
let spanId ;
let startTime ;
let status ;
let traceId ;
let obj = getSpanJSON ;
if ( "function" === typeof getSpanJSON . getSpanJSON ) {
return obj . getSpanJSON ( ) ;
} else {
( { spanId , traceId } = obj . spanContext ( ) ) ;
if ( ! tmp ) {
obj = { span _id : spanId , trace _id : traceId } ;
return obj ;
} else {
const attributes = obj . attributes ;
( { startTime , name , endTime , parentSpanId , status } = obj ) ;
obj = { span _id : spanId , trace _id : traceId , data : attributes , description : name , parent _span _id : parentSpanId , start _timestamp : spanTimeInputToSeconds ( startTime ) } ;
const tmp9 = spanTimeInputToSeconds ( endTime ) ;
obj . timestamp = tmp9 ;
obj . status = getStatusMessage ( status ) ;
2026-07-25 08:10:48 +00:00
obj . op = attributes [ require ( undefined , 6326 ) . SEMANTIC _ATTRIBUTE _SENTRY _OP ] ;
obj . origin = attributes [ require ( undefined , 6326 ) . SEMANTIC _ATTRIBUTE _SENTRY _ORIGIN ] ;
const obj2 = require ( 6317 ) /* addNonEnumerableProperty */ ;
2026-07-20 16:05:17 +00:00
const tmp10 = tmp9 ;
2026-07-25 08:10:48 +00:00
obj . _metrics _summary = require ( 6327 ) /* getMetricSummaryJsonForSpan */ . getMetricSummaryJsonForSpan ( obj ) ;
2026-07-20 16:05:17 +00:00
return obj2 . dropUndefinedKeys ( obj ) ;
}
const spanContextResult = obj . spanContext ( ) ;
2026-07-23 10:11:24 +00:00
tmp = obj . attributes && obj . startTime && obj . name && obj . endTime && obj . status ;
2026-07-20 16:05:17 +00:00
}
}
function spanIsSampled ( spanContext ) {
return 1 === spanContext . spanContext ( ) . traceFlags ;
}
function getStatusMessage ( code ) {
if ( code ) {
2026-07-25 08:10:48 +00:00
if ( code . code !== require ( 6328 ) /* getSpanStatusFromHttpCode */ . SPAN _STATUS _UNSET ) {
2026-07-20 16:05:17 +00:00
let str = "ok" ;
2026-07-25 08:10:48 +00:00
if ( code . code !== require ( 6328 ) /* getSpanStatusFromHttpCode */ . SPAN _STATUS _OK ) {
2026-07-20 16:05:17 +00:00
str = code . message || "unknown_error" ;
const tmp5 = code . message || "unknown_error" ;
}
return str ;
}
}
}
function getActiveSpan ( ) {
2026-07-25 08:10:48 +00:00
const mainCarrier = require ( 6329 ) /* getSentryCarrier */ . getMainCarrier ( ) ;
const obj = require ( 6329 ) /* getSentryCarrier */ ;
const asyncContextStrategy = require ( 6330 ) /* getAsyncContextStrategy */ . getAsyncContextStrategy ( mainCarrier ) ;
2026-07-20 16:05:17 +00:00
if ( asyncContextStrategy . getActiveSpan ) {
let activeSpan = asyncContextStrategy . getActiveSpan ( ) ;
} else {
2026-07-25 08:10:48 +00:00
const obj4 = require ( 6333 ) /* _getSpanForScope */ ;
activeSpan = obj4 . _getSpanForScope ( require ( 6338 ) /* getCurrentScope */ . getCurrentScope ( ) ) ;
const obj5 = require ( 6338 ) /* getCurrentScope */ ;
2026-07-20 16:05:17 +00:00
}
return activeSpan ;
}
2026-07-23 10:11:24 +00:00
let c3 = false ;
2026-07-20 16:05:17 +00:00
export const TRACE _FLAG _NONE = 0 ;
export const TRACE _FLAG _SAMPLED = 1 ;
export const addChildSpanToSpan = function addChildSpanToSpan ( _sentryRootSpan ) {
2026-07-25 08:10:48 +00:00
const result = require ( 6317 ) /* addNonEnumerableProperty */ . addNonEnumerableProperty ( arg1 , "_sentryRootSpan" , _sentryRootSpan . _sentryRootSpan || _sentryRootSpan ) ;
2026-07-20 16:05:17 +00:00
if ( _sentryRootSpan . _sentryChildSpans ) {
const _sentryChildSpans = _sentryRootSpan . _sentryChildSpans ;
_sentryChildSpans . add ( arg1 ) ;
} else {
const _Set = Set ;
const items = [ arg1 ] ;
const set = new Set ( items ) ;
2026-07-25 08:10:48 +00:00
const result1 = require ( 6317 ) /* addNonEnumerableProperty */ . addNonEnumerableProperty ( _sentryRootSpan , "_sentryChildSpans" , set ) ;
const obj2 = require ( 6317 ) /* addNonEnumerableProperty */ ;
2026-07-20 16:05:17 +00:00
}
} ;
export { getActiveSpan } ;
export const getRootSpan = function getRootSpan ( _sentryRootSpan ) {
return _sentryRootSpan . _sentryRootSpan || _sentryRootSpan ;
} ;
export const getSpanDescendants = function getSpanDescendants ( arg0 ) {
const set = new Set ( ) ;
function addSpanChildren ( arg0 ) {
let tmp = arg0 ;
if ( ! set . has ( arg0 ) ) {
2026-07-23 10:11:24 +00:00
if ( outer1 _7 ( tmp ) ) {
2026-07-20 16:05:17 +00:00
set . add ( tmp ) ;
if ( tmp . _sentryChildSpans ) {
const _Array = Array ;
let items = Array . from ( tmp . _sentryChildSpans ) ;
} else {
items = [ ] ;
}
tmp = items ;
items [ Symbol . iterator ] ( ) ;
}
}
}
addSpanChildren ( arg0 ) ;
return Array . from ( set ) ;
} ;
export { getStatusMessage } ;
export const removeChildSpanFromSpan = function removeChildSpanFromSpan ( _sentryChildSpans ) {
if ( _sentryChildSpans . _sentryChildSpans ) {
_sentryChildSpans = _sentryChildSpans . _sentryChildSpans ;
_sentryChildSpans . delete ( arg1 ) ;
}
} ;
export const showSpanDropWarning = function showSpanDropWarning ( ) {
2026-07-23 10:11:24 +00:00
if ( ! c3 ) {
2026-07-25 08:10:48 +00:00
require ( 6311 ) /* consoleSandbox */ . consoleSandbox ( ( ) => {
2026-07-20 16:05:17 +00:00
console . warn ( "[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly." ) ;
} ) ;
2026-07-23 10:11:24 +00:00
c3 = true ;
2026-07-25 08:10:48 +00:00
const obj = require ( 6311 ) /* consoleSandbox */ ;
2026-07-20 16:05:17 +00:00
}
} ;
export { spanIsSampled } ;
export { spanTimeInputToSeconds } ;
export { spanToJSON } ;
export const spanToTraceContext = function spanToTraceContext ( spanContext ) {
let isRemote ;
let spanId ;
const spanContextResult = spanContext . spanContext ( ) ;
( { spanId , isRemote } = spanContextResult ) ;
let parent _span _id = spanId ;
if ( ! isRemote ) {
parent _span _id = spanToJSON ( spanContext ) . parent _span _id ;
}
if ( isRemote ) {
2026-07-25 08:10:48 +00:00
let obj = require ( 6321 ) /* generateTraceId */ ;
2026-07-20 16:05:17 +00:00
spanId = obj . generateSpanId ( ) ;
}
obj = { parent _span _id , span _id : spanId , trace _id : spanContextResult . traceId } ;
2026-07-25 08:10:48 +00:00
return require ( 6317 ) /* addNonEnumerableProperty */ . dropUndefinedKeys ( obj ) ;
2026-07-20 16:05:17 +00:00
} ;
export const spanToTraceHeader = function spanToTraceHeader ( spanContext ) {
let spanId ;
let traceId ;
( { traceId , spanId } = spanContext . spanContext ( ) ) ;
const spanContextResult = spanContext . spanContext ( ) ;
const tmp2 = spanIsSampled ( spanContext ) ;
2026-07-25 08:10:48 +00:00
return require ( 6323 ) /* extractTraceparentData */ . generateSentryTraceHeader ( traceId , spanId , tmp2 ) ;
2026-07-20 16:05:17 +00:00
} ;
export const spanToTransactionTraceContext = function spanToTransactionTraceContext ( spanContext ) {
let data ;
let op ;
let origin ;
let parent _span _id ;
let spanId ;
let status ;
let traceId ;
( { spanId , traceId } = spanContext . spanContext ( ) ) ;
const spanContextResult = spanContext . spanContext ( ) ;
( { data , op , parent _span _id , status , origin } = spanToJSON ( spanContext ) ) ;
const tmp2 = spanToJSON ( spanContext ) ;
2026-07-25 08:10:48 +00:00
return require ( 6317 ) /* addNonEnumerableProperty */ . dropUndefinedKeys ( { parent _span _id , span _id , trace _id , data , op , status , origin } ) ;
2026-07-20 16:05:17 +00:00
} ;
export const updateMetricSummaryOnActiveSpan = function updateMetricSummaryOnActiveSpan ( metricType , sanitizeMetricKeyResult , diff , sanitizeUnitResult , tags , bucketKey ) {
const tmp = getActiveSpan ( ) ;
if ( tmp ) {
2026-07-25 08:10:48 +00:00
const obj = require ( 6327 ) /* getMetricSummaryJsonForSpan */ ;
2026-07-20 16:05:17 +00:00
const result = obj . updateMetricSummaryOnSpan ( tmp , metricType , sanitizeMetricKeyResult , diff , sanitizeUnitResult , tags , bucketKey ) ;
}
} ;
export const updateSpanName = function updateSpanName ( updateName ) {
updateName . updateName ( arg1 ) ;
2026-07-25 08:10:48 +00:00
updateName . setAttributes ( _defineProperty ( _defineProperty ( { } , require ( 6326 ) . SEMANTIC _ATTRIBUTE _SENTRY _SOURCE , "custom" ) , require ( 6326 ) . SEMANTIC _ATTRIBUTE _SENTRY _CUSTOM _SPAN _NAME , arg1 ) ) ;
2026-07-20 16:05:17 +00:00
} ;