2026-08-24 06:08:38 +00:00
// Module ID: 7781
// Function ID: 7782
2026-07-29 08:29:29 +00:00
// Name: spanTimeInputToSeconds
2026-08-24 06:08:38 +00:00
// Dependencies: [7782, 7786, 7788, 7790, 7791, 7792, 7793, 7794, 7795, 7798, 7803, 7776]
2026-07-29 08:29:29 +00:00
2026-08-24 06:08:38 +00:00
// Module 7781 (spanTimeInputToSeconds)
import consoleSandbox from "consoleSandbox" /* 7776 */ ;
import addNonEnumerableProperty from "addNonEnumerableProperty" /* 7782 */ ;
import generatePropagationContext from "generatePropagationContext" /* 7786 */ ;
import regExp from "regExp" /* 7788 */ ;
import dateTimestampInSeconds from "dateTimestampInSeconds" /* 7790 */ ;
import _mod7791 from "module_7791" /* 7791 */ ;
import getMetricSummaryJsonForSpan from "getMetricSummaryJsonForSpan" /* 7792 */ ;
import getSpanStatusFromHttpCode from "getSpanStatusFromHttpCode" /* 7793 */ ;
import getMainCarrier from "getMainCarrier" /* 7794 */ ;
import getAsyncContextStrategy from "getAsyncContextStrategy" /* 7795 */ ;
require = arg1 ;
2026-07-29 08:29:29 +00:00
const dependencyMap = arg6 ;
2026-08-04 21:03:28 +00:00
function spanTimeInputToSeconds ( num ) {
if ( typeof num === "number" ) {
let result = num ;
if ( num > 9999999999 ) {
result = num / 1000 ;
2026-07-29 08:29:29 +00:00
}
let sum = result ;
} else {
const _Array = Array ;
2026-08-04 21:03:28 +00:00
if ( Array . isArray ( num ) ) {
sum = num [ 0 ] + num [ 1 ] / 1000000000 ;
2026-07-29 08:29:29 +00:00
} else {
const _Date = Date ;
2026-08-04 21:03:28 +00:00
if ( num instanceof Date ) {
const time = num . getTime ( ) ;
2026-07-29 08:29:29 +00:00
let result1 = time ;
if ( time > 9999999999 ) {
result1 = time / 1000 ;
}
sum = result1 ;
} else {
2026-08-24 06:08:38 +00:00
sum = dateTimestampInSeconds . timestampInSeconds ( ) ;
const obj = dateTimestampInSeconds ;
2026-07-29 08:29:29 +00:00
}
}
}
return sum ;
}
function spanToJSON ( getSpanJSON ) {
if ( ( function spanIsSentrySpan ( getSpanJSON ) {
2026-08-04 21:03:28 +00:00
return typeof getSpanJSON . getSpanJSON === "function" ;
2026-07-29 08:29:29 +00:00
} ) ( getSpanJSON ) ) {
return getSpanJSON . getSpanJSON ( ) ;
} else {
try {
( { spanId , traceId } = getSpanJSON . spanContext ( ) ) ;
if ( ( function spanIsOpenTelemetrySdkTraceBaseSpan ( attributes ) {
return attributes . attributes && attributes . startTime && attributes . name && attributes . endTime && attributes . status ;
} ) ( getSpanJSON ) ) {
const attributes = getSpanJSON . attributes ;
( { startTime , name , endTime , parentSpanId , status } = getSpanJSON ) ;
let obj = { span _id : null , trace _id : null , data : null , description : null , parent _span _id : null , start _timestamp : null , timestamp : null , status : null , op : null , origin : null , _metrics _summary : null } ;
obj [ 0 ] = spanId ;
obj [ 1 ] = traceId ;
obj [ 2 ] = attributes ;
obj [ 3 ] = name ;
obj [ 4 ] = parentSpanId ;
obj [ 5 ] = spanTimeInputToSeconds ( startTime ) ;
const tmp8 = spanTimeInputToSeconds ( endTime ) ;
obj [ 6 ] = tmp8 ;
obj [ 7 ] = getStatusMessage ( status ) ;
2026-08-24 06:08:38 +00:00
obj [ 8 ] = attributes [ _mod7791 . SEMANTIC _ATTRIBUTE _SENTRY _OP ] ;
obj [ 9 ] = attributes [ _mod7791 . SEMANTIC _ATTRIBUTE _SENTRY _ORIGIN ] ;
const obj2 = addNonEnumerableProperty ;
obj [ 10 ] = getMetricSummaryJsonForSpan . getMetricSummaryJsonForSpan ( getSpanJSON ) ;
2026-07-29 08:29:29 +00:00
return obj2 . dropUndefinedKeys ( obj ) ;
} else {
obj = { span _id : null , trace _id : null } ;
obj [ 0 ] = spanId ;
obj [ 1 ] = traceId ;
return obj ;
}
const spanContextResult = getSpanJSON . spanContext ( ) ;
} catch ( err ) {
return { } ;
}
}
}
function spanIsSampled ( spanContext ) {
return 1 === spanContext . spanContext ( ) . traceFlags ;
}
function getStatusMessage ( code ) {
if ( code ) {
2026-08-24 06:08:38 +00:00
if ( code . code !== getSpanStatusFromHttpCode . SPAN _STATUS _UNSET ) {
2026-07-29 08:29:29 +00:00
let str = "ok" ;
2026-08-24 06:08:38 +00:00
if ( code . code !== tmp ( 7793 ) . SPAN _STATUS _OK ) {
2026-07-29 08:29:29 +00:00
str = code . message || "unknown_error" ;
const tmp3 = code . message || "unknown_error" ;
}
return str ;
}
tmp = require ;
}
}
let c2 = false ;
const _sentryChildSpans = "_sentryChildSpans" ;
const _sentryRootSpan = "_sentryRootSpan" ;
arg5 . TRACE _FLAG _NONE = 0 ;
arg5 . TRACE _FLAG _SAMPLED = 1 ;
arg5 . addChildSpanToSpan = function addChildSpanToSpan ( arg0 , arg1 ) {
let tmp2 = arg0 [ _sentryRootSpan ] ;
if ( ! tmp2 ) {
tmp2 = arg0 ;
}
2026-08-24 06:08:38 +00:00
const result = addNonEnumerableProperty . addNonEnumerableProperty ( arg1 , _sentryRootSpan , tmp2 ) ;
2026-07-29 08:29:29 +00:00
if ( arg0 [ _sentryChildSpans ] ) {
arg0 [ tmp6 ] . add ( arg1 ) ;
const obj3 = arg0 [ tmp6 ] ;
} else {
const _Set = Set ;
const items = [ arg1 ] ;
const set = new Set ( items ) ;
2026-08-24 06:08:38 +00:00
const result1 = addNonEnumerableProperty . addNonEnumerableProperty ( arg0 , tmp6 , set ) ;
const tmp3Result = addNonEnumerableProperty ;
2026-07-29 08:29:29 +00:00
}
} ;
arg5 . getActiveSpan = function getActiveSpan ( ) {
2026-08-24 06:08:38 +00:00
const mainCarrier = getMainCarrier . getMainCarrier ( ) ;
const obj = getMainCarrier ;
const asyncContextStrategy = getAsyncContextStrategy . getAsyncContextStrategy ( mainCarrier ) ;
2026-07-29 08:29:29 +00:00
if ( asyncContextStrategy . getActiveSpan ) {
let activeSpan = asyncContextStrategy . getActiveSpan ( ) ;
} else {
2026-08-24 06:08:38 +00:00
let tmpResult = tmp ( 7798 ) ;
tmpResult = tmp ( 7803 ) ;
2026-07-29 08:29:29 +00:00
activeSpan = tmpResult . _getSpanForScope ( tmpResult . getCurrentScope ( ) ) ;
}
return activeSpan ;
} ;
arg5 . getRootSpan = function getRootSpan ( arg0 ) {
return arg0 [ _sentryRootSpan ] || arg0 ;
} ;
arg5 . getSpanDescendants = function getSpanDescendants ( arg0 ) {
const set = new Set ( ) ;
function addSpanChildren ( arg0 ) {
if ( ! set . has ( arg0 ) ) {
2026-08-24 06:08:38 +00:00
if ( closure _1 _5 ( arg0 ) ) {
2026-07-29 08:29:29 +00:00
set . add ( arg0 ) ;
2026-08-24 06:08:38 +00:00
let tmp3 = closure _1 _7 ;
if ( arg0 [ closure _1 _7 ] ) {
2026-07-29 08:29:29 +00:00
const _Array = Array ;
let items = Array . from ( arg0 [ tmp3 ] ) ;
} else {
items = [ ] ;
}
tmp3 = items ;
items [ Symbol . iterator ] ( ) ;
}
}
}
addSpanChildren ( arg0 ) ;
return Array . from ( set ) ;
} ;
arg5 . getStatusMessage = getStatusMessage ;
arg5 . removeChildSpanFromSpan = function removeChildSpanFromSpan ( arg0 , arg1 ) {
if ( arg0 [ _sentryChildSpans ] ) {
arg0 [ tmp ] . delete ( arg1 ) ;
const obj = arg0 [ tmp ] ;
}
} ;
arg5 . showSpanDropWarning = function showSpanDropWarning ( ) {
if ( ! c2 ) {
2026-08-24 06:08:38 +00:00
consoleSandbox . consoleSandbox ( ( ) => {
2026-07-29 08:29:29 +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." ) ;
} ) ;
c2 = true ;
2026-08-24 06:08:38 +00:00
const obj = consoleSandbox ;
2026-07-29 08:29:29 +00:00
}
} ;
arg5 . spanIsSampled = spanIsSampled ;
arg5 . spanTimeInputToSeconds = spanTimeInputToSeconds ;
arg5 . spanToJSON = spanToJSON ;
arg5 . spanToTraceContext = function spanToTraceContext ( spanContext ) {
const trace _id = spanContext . spanContext ( ) ;
( { spanId , isRemote } = trace _id ) ;
let parent _span _id = span _id ;
if ( ! isRemote ) {
parent _span _id = spanToJSON ( spanContext ) . parent _span _id ;
}
if ( isRemote ) {
2026-08-24 06:08:38 +00:00
span _id = generatePropagationContext . generateSpanId ( ) ;
const obj = generatePropagationContext ;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
return addNonEnumerableProperty . dropUndefinedKeys ( { parent _span _id , span _id , trace _id : trace _id . traceId } ) ;
2026-07-29 08:29:29 +00:00
} ;
arg5 . spanToTraceHeader = function spanToTraceHeader ( spanContext ) {
( { traceId , spanId } = spanContext . spanContext ( ) ) ;
const spanContextResult = spanContext . spanContext ( ) ;
2026-08-24 06:08:38 +00:00
return regExp . generateSentryTraceHeader ( traceId , spanId , 1 === spanContext . spanContext ( ) . traceFlags ) ;
2026-07-29 08:29:29 +00:00
} ;
arg5 . spanToTransactionTraceContext = function spanToTransactionTraceContext ( spanContext ) {
( { spanId , traceId } = spanContext . spanContext ( ) ) ;
const spanContextResult = spanContext . spanContext ( ) ;
( { data , op , parent _span _id , status , origin } = spanToJSON ( spanContext ) ) ;
const tmp2 = spanToJSON ( spanContext ) ;
2026-08-24 06:08:38 +00:00
return addNonEnumerableProperty . dropUndefinedKeys ( { parent _span _id , span _id , trace _id , data , op , status , origin } ) ;
2026-07-29 08:29:29 +00:00
} ;
arg5 . updateMetricSummaryOnActiveSpan = function updateMetricSummaryOnActiveSpan ( arg0 , sanitizeMetricKeyResult , diff , sanitizeUnitResult , arg4 , bucketKey ) {
2026-08-24 06:08:38 +00:00
const mainCarrier = getMainCarrier . getMainCarrier ( ) ;
const obj = getMainCarrier ;
const asyncContextStrategy = getAsyncContextStrategy . getAsyncContextStrategy ( mainCarrier ) ;
2026-07-29 08:29:29 +00:00
if ( asyncContextStrategy . getActiveSpan ) {
let activeSpan = asyncContextStrategy . getActiveSpan ( ) ;
} else {
2026-08-24 06:08:38 +00:00
let tmpResult = tmp ( 7798 ) ;
tmpResult = tmp ( 7803 ) ;
2026-07-29 08:29:29 +00:00
activeSpan = tmpResult . _getSpanForScope ( tmpResult . getCurrentScope ( ) ) ;
}
if ( activeSpan ) {
2026-08-24 06:08:38 +00:00
const tmpResult1 = tmp ( 7792 ) ;
2026-07-29 08:29:29 +00:00
const result = tmpResult1 . updateMetricSummaryOnSpan ( activeSpan , arg0 , sanitizeMetricKeyResult , diff , sanitizeUnitResult , arg4 , bucketKey ) ;
}
} ;
arg5 . updateSpanName = function updateSpanName ( updateName ) {
updateName . updateName ( arg1 ) ;
updateName . setAttributes ( { [ closure _0 ( closure _1 [ 4 ] ) . SEMANTIC _ATTRIBUTE _SENTRY _SOURCE ] : "custom" , [ closure _0 ( closure _1 [ 4 ] ) . SEMANTIC _ATTRIBUTE _SENTRY _CUSTOM _SPAN _NAME ] : arg1 } ) ;
} ;