From 493186a2ed90e9d1824a872739ed8c5b575f780b Mon Sep 17 00:00:00 2001 From: Yousif Ahmed Date: Mon, 23 Dec 2024 15:14:01 +0000 Subject: [PATCH] add some logging --- packages/core/lib/span.ts | 9 ++++++++- packages/platforms/react-native/lib/span-factory.ts | 2 ++ .../scenarios/NativeIntegrationScenario.js | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/core/lib/span.ts b/packages/core/lib/span.ts index ff4f2497c..031d3655d 100644 --- a/packages/core/lib/span.ts +++ b/packages/core/lib/span.ts @@ -89,7 +89,11 @@ export function spanEndedToSpan (span: SpanEnded): Span { } export async function runSpanEndCallbacks (spanEnded: SpanEnded, logger: Logger, callbacks?: OnSpanEndCallbacks) { - if (!callbacks) return true + console.log(`[BugsnagPerformance] runSpanEndCallbacks for span: ${spanEnded.name}`) + if (!callbacks) { + console.log('[BugsnagPerformance] no callbacks to run') + return true + } const span = spanEndedToSpan(spanEnded) const callbackStartTime = performance.now() @@ -103,6 +107,7 @@ export async function runSpanEndCallbacks (spanEnded: SpanEnded, logger: Logger, result = await result } + console.log('[BugsnagPerformance] callback result:', result) if (result === false) { shouldSample = false break @@ -115,6 +120,8 @@ export async function runSpanEndCallbacks (spanEnded: SpanEnded, logger: Logger, const duration = millisecondsToNanoseconds(performance.now() - callbackStartTime) span.setAttribute('bugsnag.span.callbacks_duration', duration) } + + console.log('[BugsnagPerformance] callbacks complete, shouldSample:', shouldSample) return shouldSample } diff --git a/packages/platforms/react-native/lib/span-factory.ts b/packages/platforms/react-native/lib/span-factory.ts index 70d999426..47884dbf9 100644 --- a/packages/platforms/react-native/lib/span-factory.ts +++ b/packages/platforms/react-native/lib/span-factory.ts @@ -40,12 +40,14 @@ export class ReactNativeSpanFactory extends SpanFactory { const onSpanEnd = [ async (span) => { + console.log('[BugsnagPerformance] NativeIntegrationScenario onSpanEnd') if (span.name === 'JS parent span') { + console.log('[BugsnagPerformance] setting custom attribute on JS parent span') span.setAttribute('custom.js.attribute', 'JS span attribute') } else if (span.name === 'Native child span') { + console.log('[BugsnagPerformance] setting custom attribute on Native child span') span.setAttribute('custom.native.attribute', 'Native span attribute') } return true