Skip to content

Conversation

tustanivsky
Copy link
Collaborator

@tustanivsky tustanivsky commented Aug 27, 2025

This PR introduces traces sampling function support for platforms where the Unreal plugin relies on sentry-native (enabled by getsentry/sentry-native#1108)

Key changes:

  • Added traces sampler support for Windows/Linux
  • Introduced FSentryTransactionOptions struct to hold custom sampling context (intended to be extended in future)
  • Breaking: USentrySubsystem::StartTransactionWithContextAndOptions now accepts FSentryTransactionOptions instead of TMap<FString, FString>
  • Breaking: Custom sampling context values now use FSentryVariant instead of FString

Related docs update:

Copy link
Contributor

github-actions bot commented Aug 27, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 6f1dcb8

cursor[bot]

This comment was marked as outdated.

@@ -290,7 +346,7 @@ void FGenericPlatformSentrySubsystem::InitWithSettings(const USentrySettings* se
}
if (settings->EnableTracing && settings->SamplingType == ESentryTracesSamplingType::TracesSampler)
{
UE_LOG(LogSentrySdk, Warning, TEXT("The Native SDK doesn't currently support sampling functions"));
sentry_options_set_traces_sampler(options, HandleTraceSampling);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make HandleTraceSampling non-static and forward "this" here. We could get rid of the static pointer to the class then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike other Native SDK callbacks sentry_options_set_traces_sampler doesn’t provide a user_data parameter which normally acts as a closure allowing access to the subsystem implementation within the handler.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@tustanivsky tustanivsky merged commit 50004e9 into main Aug 28, 2025
3 checks passed
@tustanivsky tustanivsky deleted the feat/trace-sampler-native branch August 28, 2025 14:12
tustanivsky added a commit to getsentry/sentry-docs that referenced this pull request Aug 28, 2025
This PR updates `Sampling` section for Unreal SDK docs:
- Removed notice that trace sampling function is not supported on
Windows and Linux
- Updated custom trace sampler example

Related to:
- getsentry/sentry-unreal#1057
tustanivsky added a commit to getsentry/sentry-docs that referenced this pull request Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants