Skip to content

Commit ac1163b

Browse files
authored
docs(native): clean up deprecated APIs and use native in snippets (#20288)
## DESCRIBE YOUR PR Direct use of `sentry-native` is no longer considered experimental. Replace the experimental notice with the list of downstream SDKs and mention the console SDKs. Drop references to deprecated APIs in favor of their replacements: `sentry_shutdown`, `sentry_regenerate_trace`, `sentry_value_new_user_feedback`, `sentry_capture_user_feedback`, and `sentry_options_add_view_hierarchy`. Use the native backend explicitly in the CMake examples, split the install example into macOS, Linux, and Windows tabs, and replace the unmaintained `exa` with `eza`. Generalize the bundling note to cover both out-of-process backends, and document `sentry-wer.dll` and the handler and database paths for the native backend. Ref: getsentry/sentry-native#2044 Ref: getsentry/sentry-native#2175 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the due date. You can update this information later by editing the PR description. - [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD - [ ] Other deadline: YYYY-MM-DD - [x] No deadline: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've supplied a deadline. Thanks in advance for your help! ## PRE-MERGE CHECKLIST _Make sure you've checked the following before merging your changes:_ - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
1 parent ee268f0 commit ac1163b

9 files changed

Lines changed: 93 additions & 45 deletions

File tree

‎develop-docs/sdk/telemetry/attachments/index.mdx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ SDKs **MAY** attach a `view-hierarchy.json` file following the structure describ
153153
For native SDKs (since 1.4.0), the path to the view hierarchy file **SHOULD** be configurable at SDK initialization. The SDK monitors the file and uploads it along with any event or crash:
154154

155155
```c
156-
sentry_options_add_view_hierarchy(options, "./view-hierarchy.json");
156+
void setup_scope(sentry_scope_t *scope, void *user_data) {
157+
sentry_value_t attachment = sentry_attachment_from_file("./view-hierarchy.json");
158+
sentry_attachment_set_type(attachment, SENTRY_ATTACHMENT_TYPE_VIEW_HIERARCHY);
159+
sentry_scope_add_attachment(scope, attachment);
160+
}
161+
162+
sentry_options_set_initial_scope(options, setup_scope, NULL);
157163
```
158164
159165
<Alert>

‎docs/platforms/native/configuration/backends/native.mdx‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,27 @@ cmake -B build -D SENTRY_BACKEND=native
1515

1616
This builds the `sentry-crash` executable alongside the `sentry` library. Ship
1717
the executable with your application so the SDK can start it during
18-
initialization.
18+
initialization. On Windows, it also builds the `sentry-wer.dll` module for
19+
reporting fast-fail crashes via [Windows Error Reporting](/platforms/native/advanced-usage/windows-error-reporting/).
20+
Ship it in the same directory as `sentry-crash.exe`.
21+
22+
The SDK will automatically look for a `sentry-crash` executable in the same
23+
directory as the running application. It will also use the `.sentry-native`
24+
directory as its database by default, relative to the current working directory
25+
of your application.
26+
This location temporarily hosts crash reports before they are uploaded to Sentry.
27+
28+
Both of these paths can be customized like this:
29+
30+
```c
31+
sentry_options_t *options = sentry_options_new();
32+
sentry_options_set_handler_path(options, "path/to/sentry-crash");
33+
sentry_options_set_database_path(options, "sentry-db-directory");
34+
sentry_init(options);
35+
```
36+
37+
It is advised to specify both the path to the `sentry-crash` executable
38+
as well as the path to the database directory manually.
1939
2040
## Crash Reporting Modes
2141

‎docs/platforms/native/user-feedback/index.mdx‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ Sentry pairs the feedback with the original event, giving you additional insight
1616

1717
<PlatformContent includePath="user-feedback/sdk-api-example/" />
1818

19-
<Alert>
20-
21-
`sentry_value_new_user_feedback` and `sentry_capture_user_feedback` are deprecated. They produce the older User Report envelope item, which doesn't carry scope data or attachments. Use `sentry_value_new_feedback` and `sentry_capture_feedback` instead.
22-
23-
</Alert>
24-
2519
### What Gets Sent With Feedback
2620

2721
<AvailableSince version="0.16.0" />

‎platform-includes/configuration/drain-example/native.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
sentry_close();
55
```
66

7-
Calling `sentry_close()` (formerly `sentry_shutdown()`) before exiting the application is critical to avoid
7+
Calling `sentry_close()` before exiting the application is critical to avoid
88
data loss.
99

1010
After closing, the client cannot be used anymore. It's important to only call

‎platform-includes/getting-started-config/native.qt.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Alternatively, the DSN can be passed as `SENTRY_DSN` environment variable during
2828
2929
<Alert level="warning" title="Warning">
3030
31-
Calling `sentry_close()` (formerly `sentry_shutdown()`) before exiting the application is critical. It
31+
Calling `sentry_close()` before exiting the application is critical. It
3232
ensures that events can be sent to Sentry before execution stops. Otherwise,
3333
event data may be lost.
3434
Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,60 @@
1-
The Native SDK currently supports **Windows**, **macOS**, and **Linux**. The Native SDK also acts as an **Android** NDK support library in downstream SDKs via the [Android SDK](/platforms/android/configuration/using-ndk/), but currently does not directly support the platform.
1+
The Native SDK currently supports **Windows**, **macOS**, and **Linux**. The Native SDK also acts as an **Android** NDK support library in downstream SDKs via the [Android SDK](/platforms/android/configuration/using-ndk/), but currently does not directly support the platform. **Nintendo Switch**, **PlayStation**, and **Xbox** are supported via Sentry's console SDKs. See the [Nintendo Switch](/platforms/nintendo-switch/), [PlayStation](/platforms/playstation/), and [Xbox](/platforms/xbox/) documentation to get access.
22

33
To build the SDK, download the latest sources from the [Releases page](https://github.com/getsentry/sentry-native/releases). The SDK is managed as a [CMake] project, which additionally supports several configuration options, such as the backend to use.
44

5-
For example, `CMake` can be used like this (on macOS):
5+
For example, `CMake` can be used like this:
66

7-
```shell
7+
```shell {tabTitle:macOS} {mdExpandTabs}
88
# When using CMake 4 ensure you have valid SDKROOT defined in your environment.
99
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
10-
# Configure the CMake build into the `build` directory with crashpad (the default
11-
# backend on macOS, thus optional to specify). Specifying `RelWithDebInfo` as the
12-
# `CMAKE_BUILD_TYPE` is also optional because it is the default in sentry-native
13-
# for all generators supporting it.
14-
cmake -B build -D SENTRY_BACKEND=crashpad -D CMAKE_BUILD_TYPE=RelWithDebInfo
10+
# Configure the CMake build into the `build` directory with the desired backend.
11+
# Specifying `RelWithDebInfo` as the `CMAKE_BUILD_TYPE` is optional because it
12+
# is the default in sentry-native for all generators supporting it.
13+
cmake -B build -D SENTRY_BACKEND=native -D CMAKE_BUILD_TYPE=RelWithDebInfo
1514
# build the project
1615
cmake --build build --parallel
1716
# install the resulting artifacts into a specific prefix
1817
cmake --install build --prefix install
19-
# which will result in the following (on macOS):
20-
exa --tree install --level 2
18+
# which will result in the following:
19+
eza --tree install --level 2
2120
install
2221
├── bin
23-
│ └── crashpad_handler
22+
│ └── sentry-crash
2423
├── include
2524
│ └── sentry.h
2625
└── lib
2726
├── cmake
2827
├── libsentry.dylib
2928
└── libsentry.dylib.dSYM
3029
```
31-
(For further details on the `SDKROOT` usage with CMake please consult the [macOS build section in the SDK README](https://github.com/getsentry/sentry-native?tab=readme-ov-file#building-and-installation))
3230

33-
Contrast the above with the build-steps for a typical `msbuild` project on Windows:
31+
```shell {tabTitle:Linux}
32+
# Configure the CMake build into the `build` directory with the desired backend.
33+
# Specifying `RelWithDebInfo` as the `CMAKE_BUILD_TYPE` is optional because it
34+
# is the default in sentry-native for all generators supporting it.
35+
cmake -B build -D SENTRY_BACKEND=native -D CMAKE_BUILD_TYPE=RelWithDebInfo
36+
# build the project
37+
cmake --build build --parallel
38+
# install the resulting artifacts into a specific prefix
39+
cmake --install build --prefix install
40+
# which will result in the following:
41+
tree install -L 2
42+
install
43+
├── bin
44+
│ └── sentry-crash
45+
├── include
46+
│ └── sentry.h
47+
└── lib
48+
├── cmake
49+
└── libsentry.so
50+
51+
5 directories, 3 files
52+
```
3453

35-
```shell
54+
```shell {tabTitle:Windows}
3655
# The msbuild generator ignores the CMAKE_BUILD_TYPE because it contains all
37-
# build-types. Here we leave out the backend specification and rely on CMake
38-
# selecting crashpad as Windows' default backend.
39-
cmake -B build
56+
# build-types.
57+
cmake -B build -D SENTRY_BACKEND=native
4058
# The actual build step then requires we specify which build-type we want
4159
# to apply via the `--config` parameter. Please be aware that in msbuild
4260
# projects, the `--parallel` option has no effect.
@@ -46,8 +64,9 @@ cmake --install build --prefix install --config RelWithDebInfo
4664
# which will result in the following output (ignoring non-essential lines):
4765
tree /f install
4866
├───bin
49-
│ crashpad_handler.exe
50-
│ crashpad_handler.pdb
67+
│ sentry-crash.exe
68+
│ sentry-wer.dll
69+
│ sentry-wer.pdb
5170
│ sentry.dll
5271
│ sentry.pdb
5372
│
@@ -56,12 +75,16 @@ tree /f install
5675
│
5776
└───lib
5877
│ sentry.lib
78+
│
79+
└───cmake
5980
```
6081

82+
(For further details on the `SDKROOT` usage with CMake please consult the [macOS build section in the SDK README](https://github.com/getsentry/sentry-native?tab=readme-ov-file#building-and-installation))
83+
6184
[cmake]: https://cmake.org/cmake/help/latest/
6285

63-
<Alert level="warning" title="Bundling crashpad_handler">
86+
<Alert level="warning" title="Bundling out-of-process backends">
6487

65-
When using the _Crashpad backend_, which is the default on all supported Desktop platforms (Windows, Linux and macOS), the `crashpad_handler` binary has to be shipped alongside the application binary. See the [Crashpad documentation](/platforms/native/configuration/backends/crashpad/) for more information.
88+
The out-of-process _Native_ and _Crashpad_ backends require shipping `sentry-crash` or `crashpad_handler`, respectively, alongside the application binary. See the [Native](/platforms/native/configuration/backends/native/) and [Crashpad](/platforms/native/configuration/backends/crashpad/) backend documentation for more information.
6689

6790
</Alert>

‎platform-includes/getting-started-install/native.qt.mdx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ If the Qt libraries are not installed in one of the predefined `CMake` [system p
1111

1212
</Alert>
1313

14-
For example (on macOS):
14+
For example:
1515

1616
```shell
1717
# Configure the cmake build into the `build` directory,
18-
# with crashpad, and Qt integration (on macOS).
18+
# with the desired backend, and Qt integration.
1919
cmake -B build \
20-
-D SENTRY_BACKEND=crashpad \
20+
-D SENTRY_BACKEND=native \
2121
-D SENTRY_INTEGRATION_QT=YES
2222

2323
# Build the project
@@ -27,10 +27,10 @@ cmake --build build --parallel
2727
cmake --install build --prefix install
2828

2929
# Which will result in the following (on macOS):
30-
exa --tree install --level 2
30+
eza --tree install --level 2
3131
install
3232
├── bin
33-
│ └── crashpad_handler
33+
│ └── sentry-crash
3434
├── include
3535
│ └── sentry.h
3636
└── lib
@@ -43,8 +43,8 @@ You can configure the Qt build for Windows analogous to the [regular build instr
4343

4444
[cmake]: https://cmake.org/cmake/help/latest/
4545

46-
<Alert level="warning" title="Bundling crashpad_handler">
46+
<Alert level="warning" title="Bundling out-of-process backends">
4747

48-
When using the _Crashpad backend_, which is the default on Windows and macOS, the `crashpad_handler` binary has to be shipped alongside the application binary. See the [Crashpad documentation](/platforms/native/configuration/backends/crashpad/) for more information.
48+
The out-of-process _Native_ and _Crashpad_ backends require shipping `sentry-crash` or `crashpad_handler`, respectively, alongside the application binary. See the [Native](/platforms/native/configuration/backends/native/) and [Crashpad](/platforms/native/configuration/backends/crashpad/) backend documentation for more information.
4949

5050
</Alert>

‎platform-includes/getting-started-primer/native.mdx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
The Sentry Native SDK is intended for C and C++. However, since it builds as a dynamic library and exposes C-bindings, it can be used by any language that supports interoperability with C, such as the Foreign Function Interface (FFI).
22

3-
<Alert>
3+
It also provides native crash reporting for other Sentry SDKs:
44

5-
Using the `sentry-native` SDK in a standalone use case is currently an experimental feature. The SDK’s primary function is to fuel our other SDKs, like [`sentry-java`](https://github.com/getsentry/sentry-java) or [`sentry-unreal`](https://github.com/getsentry/sentry-unreal). Support from our side is best effort and we do what we can to respond to issues in a timely fashion, but please understand if we won’t be able to address your issues or feature suggestions.
5+
- [_Android (NDK)_](/platforms/android/configuration/using-ndk/)
6+
- [_Flutter_](/platforms/dart/guides/flutter/)
7+
- [_Godot_](/platforms/godot/)
8+
- [_.NET_](/platforms/dotnet/)
9+
- [_Unity_](/platforms/unity/)
10+
- [_Unreal Engine_](/platforms/unreal/)
611

7-
</Alert>
12+
Sentry's console SDKs also build on the Native SDK. See the [Nintendo Switch](/platforms/nintendo-switch/), [PlayStation](/platforms/playstation/), and [Xbox](/platforms/xbox/) documentation to get access.
813

914
Sentry also offers higher-level SDKs for platforms with built-in support for native crashes:
1015

‎platform-includes/performance/add-spans-example/native.mdx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ perform_checkout();
6161
6262
The SDK will turn off managing automatic trace boundaries via transactions once manual management of trace boundaries
6363
was requested by either a downstream SDK (using `sentry_set_trace(trace_id, parent_span_id)`) or a direct user of the
64-
Native SDK (via `sentry_regenerate_trace()`):
64+
Native SDK (via `sentry_start_new_trace()`):
6565
6666
```C
6767
sentry_options_t *options = sentry_options_new();
@@ -86,10 +86,10 @@ sentry_options_t *options = sentry_options_new();
8686
sentry_init(options);
8787

8888
// Generates a new random trace and span id onto the propagation_context
89-
sentry_regenerate_trace();
89+
sentry_start_new_trace();
9090
authenticate_user();
9191

92-
sentry_regenerate_trace();
92+
sentry_start_new_trace();
9393
// Events, transactions, and spans inside perform_checkout() will be part of
9494
// a different trace than the ones inside authenticate_user()
9595
perform_checkout();
@@ -100,6 +100,6 @@ After the client called either function, the following transactions inherit that
100100
<Alert level="warning" title="Downstream SDK usage">
101101
If you interact with the Native SDK in the context of a downstream SDK (for
102102
instance Android, .NET, Unity, or Unreal), we urge you not to use
103-
`sentry_regenerate_trace()` since it would interfere with the traces managed
103+
`sentry_start_new_trace()` since it would interfere with the traces managed
104104
from those SDKs.
105105
</Alert>

0 commit comments

Comments
 (0)