Skip to content
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

Unreal Engine plugin documentation update #11625

Merged
merged 38 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d1a9b73
Add notice about env variable allowing to enable debug sym upload
tustanivsky Oct 7, 2024
b5d8143
Add tracing
tustanivsky Oct 21, 2024
09ef49a
Add release health + crashed sessions notice
tustanivsky Oct 21, 2024
ff0441a
Add tracing options
tustanivsky Oct 21, 2024
7967ec4
Add automatic breadcrumb options
tustanivsky Oct 21, 2024
8221b06
Add screenshot notice
tustanivsky Oct 21, 2024
66351ef
Update screenshot
tustanivsky Oct 21, 2024
5f8838f
Add Gradle fallback notice
tustanivsky Oct 21, 2024
1f4cb63
Add sampling
tustanivsky Oct 22, 2024
758e0ff
Update docs/platforms/unreal/configuration/options.mdx
tustanivsky Oct 23, 2024
20208f6
Update options.mdx
tustanivsky Oct 23, 2024
072cceb
Update docs/platforms/unreal/configuration/options.mdx
tustanivsky Oct 23, 2024
2c6c3e1
Update docs/platforms/unreal/configuration/debug-symbols/index.mdx
tustanivsky Oct 24, 2024
6c1f3fd
Update docs/platforms/unreal/configuration/debug-symbols/index.mdx
tustanivsky Oct 24, 2024
78f8c3f
Update docs/platforms/unreal/configuration/options.mdx
tustanivsky Oct 24, 2024
3e99d9d
Update docs/platforms/unreal/configuration/options.mdx
tustanivsky Oct 24, 2024
7feeab8
Update docs/platforms/unreal/configuration/options.mdx
tustanivsky Oct 24, 2024
d4eff5f
Update docs/platforms/unreal/tracing/trace-propagation/index.mdx
tustanivsky Oct 24, 2024
ca1ba01
Update docs/platforms/unreal/configuration/sampling.mdx
tustanivsky Oct 24, 2024
90a40fe
Update docs/platforms/unreal/configuration/sampling.mdx
tustanivsky Oct 24, 2024
ff279c0
Update docs/platforms/unreal/configuration/sampling.mdx
tustanivsky Oct 24, 2024
4143733
Update docs/platforms/unreal/configuration/sampling.mdx
tustanivsky Oct 24, 2024
6e77037
Update platform-includes/performance/enable-manual-instrumentation/un…
tustanivsky Oct 24, 2024
33edb5e
Update platform-includes/distributed-tracing/custom-instrumentation/u…
tustanivsky Oct 24, 2024
c46a8f4
Update docs/platforms/unreal/configuration/releases.mdx
tustanivsky Oct 24, 2024
c6d0464
Update docs/platforms/unreal/configuration/releases.mdx
tustanivsky Oct 24, 2024
bc1b35e
Update docs/platforms/unreal/configuration/debug-symbols/index.mdx
tustanivsky Oct 28, 2024
267e87b
Update docs/platforms/unreal/tracing/instrumentation/custom-instrumen…
tustanivsky Oct 28, 2024
c23da73
Update docs/platforms/unreal/tracing/index.mdx
tustanivsky Oct 28, 2024
9172fa0
Update docs/platforms/unreal/configuration/options.mdx
tustanivsky Oct 28, 2024
19236fe
Update docs/platforms/unreal/configuration/sampling.mdx
tustanivsky Oct 28, 2024
058686d
Update platform-includes/performance/sampling-function-intro/unreal.mdx
tustanivsky Oct 28, 2024
f4dae01
Update platform-includes/distributed-tracing/how-to-use/unreal.mdx
tustanivsky Oct 28, 2024
1560516
Update docs/platforms/unreal/configuration/sampling.mdx
tustanivsky Oct 28, 2024
cb7de02
Update platform-includes/performance/default-sampling-context-platfor…
tustanivsky Oct 28, 2024
7b8bce7
Update docs/platforms/unreal/configuration/options.mdx
tustanivsky Oct 28, 2024
60e6702
Remove CORS
tustanivsky Oct 28, 2024
f9155ef
Update sample
tustanivsky Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/platforms/unreal/configuration/debug-symbols/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Sentry requires [debug information files](/platforms/unreal/data-management/debu

<Note>

For Android, debug symbols upload is handled by [Sentry Android Gradle Plugin](/platforms/android/configuration/gradle).
For Android, debug symbols upload is handled by [Sentry Android Gradle Plugin](/platforms/android/configuration/gradle). By default, it bumps Gradle version to 7.5 automatically, however one can fallback to using its legacy version in case compatibility issues with other third-party plugins arise.

</Note>

Expand All @@ -21,6 +21,8 @@ You must configure which build configurations, target types, and platforms Sentr

![The Unreal Engine debug symbols upload configuration](./img/unreal-debug-symbols.png)

Alternatively, debug symbol upload can be enabled by setting the `SENTRY_UPLOAD_SYMBOLS_AUTOMATICALLY` environment variable to `True`. This can be especially helpful in CI/CD environments where manual configuration is impractical.

### Manual Upload Using sentry-cli

To upload debug symbols to Sentry manually, run `sentry-cli` through the command line. You can either use the provided executables from within the package, or follow the [sentry-cli documentation](/product/cli/installation/) to make it available globally. To upload debug symbols run the following command:
Expand Down
38 changes: 38 additions & 0 deletions docs/platforms/unreal/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ This variable controls the total amount of breadcrumbs that should be captured.

</ConfigKey>

<ConfigKey name="automatic-breadcrumbs">

Configures whether to automatically add breadcrumbs on in-game events (i.e. when a game map is loaded or session ID is changed).

</ConfigKey>

<ConfigKey name="automatic-breadcrumbs-for-logs">

Configures whether to automatically add breadcrumbs for log messages with certain keywords (examples: `Fatal`, `Error`, `Warning`, `Log` and `Verbose`).

</ConfigKey>

<ConfigKey name="attach-stacktrace">

When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to exceptions; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages.
Expand All @@ -72,6 +84,12 @@ Grouping in Sentry is different for events with stack traces and without. As a r
Takes a screenshot of the application when an error happens and includes it as an attachment.
Learn more about enriching events with screenshots in our <PlatformLink to="/enriching-events/screenshots/">Screenshots documentation</PlatformLink>.

<Alert level="info">

The support for screenshot attachment on crash events is limited to Windows and Linux.

</Alert>

</ConfigKey>

## Hooks
Expand All @@ -85,3 +103,23 @@ This function is called with an SDK-specific message or error event object, and
By the time <PlatformIdentifier name="before-send" /> is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect.

</ConfigKey>

## Tracing Options

<ConfigKey name="traces-sample-rate">

A number between 0 and 1, controlling the percentage chance a given transaction will be sent to Sentry. (0 represents 0% while 1 represents 100%.) Applies equally to all transactions created in the app. Either this or <PlatformIdentifier name="traces-sampler" /> must be defined to enable tracing.

</ConfigKey>

<ConfigKey name="traces-sampler">

A function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. Either this or <PlatformIdentifier name="traces-sample-rate" /> must be defined to enable tracing.

<Alert level="info">

Currently, there is no support for sampling functions on Windows or Linux (<PlatformIdentifier name="traces-sampler" />).

</Alert>

</ConfigKey>
18 changes: 18 additions & 0 deletions docs/platforms/unreal/configuration/releases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,21 @@ Setting the release name tags each event with that release name. We recommend th
If you don't tell Sentry about a new release, Sentry will automatically create a release entity in the system the first time it sees an event with that release ID.

After configuring your SDK, you can install a repository integration or manually supply Sentry with your own commit metadata. Read our documentation about [setting up releases](/product/releases/setup/) for further information about integrations, associating commits, and telling Sentry when deploying releases.

## Release Health

Monitor the [health of releases](/product/releases/health/) by observing user adoption, usage of the application, percentage of [crashes](/product/releases/health/#crash), and [session data](/product/releases/health/#session). Release health will provide insight into the impact of crashes and bugs as they relate to user experience, and reveal trends with each new issue through the [Release Details](/product/releases/release-details/) graphs and filters.

In order to monitor release health, the SDK sends session data.

### Sessions

A session represents the interaction between the user and the application. Sessions contain a timestamp, a status (if the session was OK or if it crashed), and are always linked to a release. Most Sentry SDKs can manage sessions automatically.

<PlatformContent includePath="configuration/auto-session-tracking" />

<Note>

On Windows, release health support for Unreal Engine is currently limited to games made with UE 5.2 or later. Note, that "Enable automatic crash capturing (Windows, UE 5.2+)" in the plugin settings has to be checked to track crashed sessions properly.

</Note>
103 changes: 103 additions & 0 deletions docs/platforms/unreal/configuration/sampling.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: Sampling
description: "Learn how to configure the volume of error and transaction events sent to Sentry."
sidebar_order: 50
---

Adding Sentry to your app gives you a great deal of very valuable information about errors and performance you wouldn't otherwise get. And lots of information is good -- as long as it's the right information, at a reasonable volume.

## Sampling Error Events

To send a representative sample of your errors to Sentry, set the <PlatformIdentifier name="sample-rate" /> option in your SDK configuration to a number between `0` (0% of errors sent) and `1` (100% of errors sent). This is a static rate, which will apply equally to all errors. For example, to sample 25% of your errors:

<PlatformContent includePath="configuration/sample-rate" />

The error sample rate defaults to `1`, meaning all errors are sent to Sentry.

<Note>

Changing the error sample rate requires re-deployment. In addition, setting an SDK sample rate limits visibility into the source of events. Setting a rate limit for your project (which only drops events when volume is high) may better suit your needs.

</Note>

## Sampling Transaction Events

We recommend sampling your transactions for two reasons:

1. Capturing a single trace involves minimal overhead, but capturing traces for _every_ level loaded or _every_ API request may add an undesirable load to your system.

2. Enabling sampling allows you to better manage the number of events sent to Sentry, so you can tailor your volume to your organization's needs.
tustanivsky marked this conversation as resolved.
Show resolved Hide resolved

Choose a sampling rate with the goal of finding a balance between performance and volume concerns with data accuracy. You don't want to collect _too_ much data, but you want to collect sufficient data from which to draw meaningful conclusions. If you’re not sure what rate to choose, start with a low value and gradually increase it as you learn more about your traffic patterns and volume.

## Configuring the Transaction Sample Rate

The Sentry SDKs have two configuration options to control the volume of transactions sent to Sentry, allowing you to take a representative sample:

1. Uniform sample rate (<PlatformIdentifier name="traces-sample-rate" />):

- Provides an even cross-section of transactions, no matter where in your app or under what circumstances they occur.
- Uses default [inheritance](#inheritance) and [precedence](#precedence) behavior

2. Sampling function (<PlatformIdentifier name="traces-sampler" />) which:
- Samples different transactions at different rates
- <PlatformLink to="/configuration/filtering/">Filters</PlatformLink> out some
transactions entirely
- Modifies default [precedence](#precedence) and [inheritance](#inheritance) behavior

By default, none of these options are set, meaning no transactions will be sent to Sentry. You must set one of the options to start sending transactions.

### Setting a Uniform Sample Rate

<PlatformContent includePath="performance/uniform-sample-rate" />

### Setting a Sampling Function

<PlatformContent includePath="performance/sampling-function-intro" />

## Sampling Context Data

### Default Sampling Context Data

The information contained in the <PlatformIdentifier name="sampling-context" /> object passed to the <PlatformIdentifier name="traces-sampler" /> when a transaction is created varies by platform and integration.

<PlatformContent includePath="performance/default-sampling-context" />

### Custom Sampling Context Data

When using custom instrumentation to create a transaction, you can add data to the <PlatformIdentifier name="sampling-context" /> by passing it as an optional second argument to <PlatformIdentifier name="start-transaction" />. This is useful if there's data you want the sampler to have access to, but you don't want to attach it to the transaction as `tags` or `data`, such as information that's sensitive or that’s too large to send with the transaction. For example:

<PlatformContent includePath="performance/custom-sampling-context" />

## Inheritance

Whatever a transaction's sampling decision, that decision will be passed to its child spans and from there to any transactions they subsequently trigger in other services.

(See <PlatformLink to="/tracing/trace-propagation/">Distributed Tracing</PlatformLink> for more about how that propagation is done.)

If the transaction currently being created is one of those subsequent transactions (in other words, if it has a parent transaction), the upstream (parent) sampling decision will be included in the sampling context data. Your <PlatformIdentifier name="traces-sampler" /> can use this information to choose whether to inherit that decision. In most cases, inheritance is the right choice, to avoid breaking distributed traces. A broken trace will not include all your services.

If you're using a <PlatformIdentifier name="traces-sample-rate" /> rather than a <PlatformIdentifier name="traces-sampler" />, the decision will always be inherited.

## Precedence

There are multiple ways for a transaction to end up with a sampling decision.

- Random sampling according to a static sample rate set in <PlatformIdentifier name="traces-sample-rate" />
- Random sampling according to a sample function rate returned by <PlatformIdentifier name="traces-sampler" />
- Absolute decision (100% chance or 0% chance) returned by <PlatformIdentifier name="traces-sampler" />
- If the transaction has a parent, inheriting its parent's sampling decision
- Absolute decision passed to <PlatformIdentifier name="start-transaction" />

When there's the potential for more than one of these to come into play, the following precedence rules apply:

1. If a sampling decision is passed to <PlatformIdentifier name="start-transaction" />, that decision will be used, overriding everything else.
1. If <PlatformIdentifier name="traces-sampler" /> is defined, its decision will be used. It can choose to keep or ignore any parent sampling decision, use the sampling context data to make its own decision, or choose a sample rate for the transaction. We advise against overriding the parent sampling decision because it will break distributed traces
1. If <PlatformIdentifier name="traces-sampler" /> is not defined, but there's a parent sampling decision, the parent sampling decision will be used.
1. If <PlatformIdentifier name="traces-sampler" /> is not defined and there's no parent sampling decision, <PlatformIdentifier name="traces-sample-rate" /> will be used.

<Alert level="info">

Currently there is no support for forcing a sampling decision by passing it into <PlatformIdentifier name="start-transaction" />.

</Alert>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions docs/platforms/unreal/tracing/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Set Up Tracing
description: "Learn how to enable tracing in your app and discover valuable performance insights of your application."
sidebar_order: 4000
---

With [tracing](/product/performance/), Sentry tracks your software performance, measuring metrics like throughput and latency, and displaying the impact of errors across multiple systems. Sentry captures distributed traces consisting of transactions and spans, which measure individual services and individual operations within those services. Learn more about our model in [Distributed Tracing](/product/sentry-basics/tracing/distributed-tracing/).

<Note>

If you’re adopting Tracing in a high-throughput environment, we recommend testing prior to deployment to ensure that your service’s performance characteristics maintain expectations.

</Note>

## Configure

First, enable tracing and configure the sample rate for transactions. Set the sample rate for your transactions by either:

- Setting a uniform sample rate for all transactions using the <PlatformIdentifier name="traces-sample-rate" /> option in your SDK config to a number between `0` and `1`. (For example, to send 20% of transactions, set <PlatformIdentifier name="traces-sample-rate" /> to `0.2`.)
- Controlling the sample rate based on the transaction itself and the context in which it's captured, by providing a function to the <PlatformIdentifier name="traces-sampler" /> config option.

The two options are meant to be mutually exclusive. If you set both, <PlatformIdentifier name="traces-sampler" /> will take precedence.

<Alert level="info">

Currently there is no support for sampling functions on Windows/Linux (<PlatformIdentifier name="traces-sampler" />).

</Alert>

<PlatformContent includePath="performance/configure-sample-rate" />

Learn more about tracing <PlatformLink to="/configuration/options/#tracing-options">options</PlatformLink>, how to use the <PlatformLink to="/configuration/sampling/#setting-a-sampling-function">TracesSampler</PlatformLink> function, or how to <PlatformLink to="/configuration/sampling/#sampling-transaction-events">sample transactions</PlatformLink>.

## Verify

Test out tracing by starting and finishing a transaction, which you _must_ do so transactions can be sent to Sentry. Learn how in our <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">Custom Instrumentation</PlatformLink> content.

While you're testing, set <PlatformIdentifier name="traces-sample-rate" /> to `1.0`, as that ensures that every transaction will be sent to Sentry. Once testing is complete, you may want to set a lower <PlatformIdentifier name="traces-sample-rate" /> value, or switch to using <PlatformIdentifier name="traces-sampler" /> to selectively sample and filter your transactions, based on contextual data.

## Next Steps

<PageGrid />
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Custom Instrumentation
description: "Learn how to capture performance data on any action in your app."
sidebar_order: 20
---

<Note>

To capture transactions and spans customized to your organization's needs, you must first <PlatformLink to="/tracing/">set up tracing.</PlatformLink>

</Note>

<PlatformContent includePath="performance/enable-manual-instrumentation" />

<PlatformContent includePath="performance/add-spans-example" />

## Distributed Tracing

In order to use distributed tracing, follow the <PlatformLink to="/tracing/trace-propagation/custom-instrumentation/">custom instrumentation</PlatformLink> steps.
7 changes: 7 additions & 0 deletions docs/platforms/unreal/tracing/instrumentation/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Instrumentation
description: "Learn how to instrument tracing in your app."
sidebar_order: 20
---

<PageGrid />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Custom Instrumentation
sidebar_order: 40
---

<PlatformContent includePath="distributed-tracing/custom-instrumentation/" />
34 changes: 34 additions & 0 deletions docs/platforms/unreal/tracing/trace-propagation/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Trace Propagation
description: "Learn how to connect events across applications/services."
sidebar_order: 3000
---

If the overall application landscape that you want to observe with Sentry consists of more than just a single service or application, distributed tracing can add a lot of value.

## What is Distributed Tracing?

In the context of tracing events across a distributed system, distributed tracing acts as a powerful debugging tool. Imagine your application as a vast network of interconnected parts. For example, your system might be spread across different servers or your application might split into different backend and frontend services, each potentially having their own technology stack.

When an error or performance issue occurs, it can be challenging to pinpoint the root cause due to the complexity of such a system. Distributed tracing helps you follow the path of an event as it travels through this intricate web, recording every step it takes. By examining these traces, you can reconstruct the sequence of events leading up to the event of interest, identify the specific components involved, and understand their interactions. This detailed visibility enables you to diagnose and resolve issues more effectively, ultimately improving the reliability and performance of your distributed system.

## Basic Example

Here's an example showing a distributed trace in Sentry:

<Include name="common-imgs/distributed-trace-in-sentry" />

This distributed trace shows a Vue app's `pageload` making a request to a Python backend, which then calls the `/api` endpoint of a Ruby microservice.

What happens in the background is that Sentry uses reads and further propagates two HTTP headers between your applications:

- `sentry-trace`
- `baggage`

If you run any JavaScript applications in your distributed system, make sure that those two headers are added to your CORS allowlist and won't be blocked or stripped by your proxy servers, gateways, or firewalls.
Copy link
Member

Choose a reason for hiding this comment

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

We should prob fix this docs-wide, right? A Flutter/.NET/Kotlin/Rust app running on the browser (e.g: wasm) also has this concern. While a JS app on NodeJS doesn't.

@chargome does my statement check out?

Suggested change
If you run any JavaScript applications in your distributed system, make sure that those two headers are added to your CORS allowlist and won't be blocked or stripped by your proxy servers, gateways, or firewalls.
If you run any browser applications in your distributed system, make sure that those two headers are added to your CORS allowlist and won't be blocked or stripped by your proxy servers, gateways, or firewalls.

Copy link
Member

Choose a reason for hiding this comment

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


## How to Use Distributed Tracing?

<PlatformContent includePath="distributed-tracing/how-to-use/" />

Remember that in order to propagate trace information through your whole distributed system, you have to use Sentry in all of the involved services and applications. Take a look at their respective SDK docs to learn how distributed tracing can be enabled for each platform.
17 changes: 17 additions & 0 deletions platform-includes/configuration/sample-rate/unreal.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```cpp
#include "SentrySettings.h"

FConfigureSettingsDelegate SettingsDelegate;
SettingsDelegate.BindDynamic(this, &USomeClass::ConfigureSettingsDelegate);

void USomeClass::ConfigureSettingsDelegate(USentrySettings* Settings)
{
Settings->SampleRate = 0.25f;
}

...

USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem<USentrySubsystem>();

SentrySubsystem->InitializeWithSettings(SettingsDelegate);
```
Loading
Loading