From be5bbc6bbfe294ca29aaf68a0c8175dee17cbef8 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 19 May 2026 11:27:03 +0200 Subject: [PATCH] settrace --- src/Sentry/Platforms/Android/AndroidScopeObserver.cs | 9 ++++++++- src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Sentry/Platforms/Android/AndroidScopeObserver.cs b/src/Sentry/Platforms/Android/AndroidScopeObserver.cs index a05f09c575..e18b215562 100644 --- a/src/Sentry/Platforms/Android/AndroidScopeObserver.cs +++ b/src/Sentry/Platforms/Android/AndroidScopeObserver.cs @@ -102,7 +102,14 @@ public void SetUser(SentryUser? user) public void SetTrace(SentryId traceId, SpanId parentSpanId) { - // TODO: This requires sentry-java 8.4.0 + try + { + JavaSdk.Android.Core.InternalSentrySdk.SetTrace(traceId.ToString(), parentSpanId.ToString(), null, null); + } + finally + { + _innerObserver?.SetTrace(traceId, parentSpanId); + } } public void AddAttachment(SentryAttachment attachment) diff --git a/src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs b/src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs index d7a790d8ff..f92156a4be 100644 --- a/src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs +++ b/src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs @@ -110,7 +110,14 @@ public void SetUser(SentryUser? user) public void SetTrace(SentryId traceId, SpanId parentSpanId) { - // TODO: Missing corresponding functionality on the Cocoa SDK + try + { + SentryCocoaHybridSdk.SetTrace(traceId.ToCocoaSentryId(), parentSpanId.ToCocoaSpanId()); + } + finally + { + _innerObserver?.SetTrace(traceId, parentSpanId); + } } public void AddAttachment(SentryAttachment attachment)