-
-
Notifications
You must be signed in to change notification settings - Fork 47
Add trace propagation #631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
712b19f
a0cc5da
2ab5836
8fc10ee
e4b3cde
6852d4a
2bc44ef
36bdcd5
177d8e2
bd599fd
3933fd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,6 @@ void SentrySubsystemApple::InitWithSettings(const USentrySettings* settings, USe | |
[options addInAppExclude:it->GetNSString()]; | ||
} | ||
options.enableAppHangTracking = settings->EnableAppNotRespondingTracking; | ||
options.enableTracing = settings->EnableTracing; | ||
bitsandfoxes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if(settings->EnableTracing && settings->SamplingType == ESentryTracesSamplingType::UniformSampleRate) | ||
{ | ||
options.tracesSampleRate = [NSNumber numberWithFloat:settings->TracesSampleRate]; | ||
|
@@ -303,3 +302,38 @@ USentryTransaction* SentrySubsystemApple::StartTransactionWithContextAndOptions( | |
|
||
return SentryConvertorsApple::SentryTransactionToUnreal(transaction); | ||
} | ||
|
||
USentryTransactionContext* SentrySubsystemApple::ContinueTrace(const FString& sentryTrace, const TArray<FString>& baggageHeaders) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add some tests for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I've added a basic one. The existing |
||
{ | ||
TArray<FString> traceParts; | ||
sentryTrace.ParseIntoArray(traceParts, TEXT("-")); | ||
|
||
if (traceParts.Num() < 2) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
SentrySampleDecision sampleDecision = kSentrySampleDecisionUndecided; | ||
if (traceParts.Num() == 3) | ||
{ | ||
sampleDecision = traceParts[2].Equals(TEXT("1")) ? kSentrySampleDecisionYes : kSentrySampleDecisionNo; | ||
} | ||
|
||
// `SentryId` definition was moved to Swift so its name that can be recognized by UE should be taken from "Sentry-Swift.h" to successfully load class on Mac | ||
|
||
#if PLATFORM_MAC | ||
SentryId* traceId = [[SENTRY_APPLE_CLASS(_TtC6Sentry8SentryId) alloc] initWithUUIDString:traceParts[0].GetNSString()]; | ||
#elif PLATFORM_IOS | ||
SentryId* traceId = [[SENTRY_APPLE_CLASS(SentryId) alloc] initWithUUIDString:traceParts[0].GetNSString()]; | ||
#endif | ||
|
||
SentryTransactionContext* transactionContext = [[SENTRY_APPLE_CLASS(SentryTransactionContext) alloc] initWithName:@"<unlabeled transaction>" operation:@"default" | ||
traceId:traceId | ||
spanId:[[SENTRY_APPLE_CLASS(SentrySpanId) alloc] init] | ||
parentSpanId:[[SENTRY_APPLE_CLASS(SentrySpanId) alloc] initWithValue:traceParts[1].GetNSString()] | ||
parentSampled:sampleDecision]; | ||
|
||
// currently `sentry-cocoa` doesn't have API for `SentryTransactionContext` to set `baggageHeaders` | ||
|
||
return SentryConvertorsApple::SentryTransactionContextToUnreal(transactionContext); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.