Skip to content

Commit f7168a8

Browse files
authored
Docs: Update docs for the new native sdk (#1517)
* update docs for the new native sdk * add a notice for on-premise users, clear up other docs
1 parent f64e681 commit f7168a8

File tree

1 file changed

+70
-108
lines changed
  • src/collections/_documentation/platforms/native

1 file changed

+70
-108
lines changed

src/collections/_documentation/platforms/native/index.md

Lines changed: 70 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
title: Native
33
---
44

5+
{% capture __alert_content -%}
6+
Support for `sentry-native` is currently limited to the hosted version on
7+
[`sentry.io`](https://sentry.io). The latest on-premise version of Sentry
8+
(*10.0*) does not provide server-side support for events sent by
9+
`sentry-native`. Full support for `sentry-native` will be made available to all
10+
on-premise customers with the next release.
11+
{%- endcapture -%}
12+
{%- include components/alert.html
13+
title="Sentry On-Premise"
14+
content=__alert_content
15+
level="warning"
16+
%}
17+
518
The Sentry Native SDK is intended for C and C++. However, since it builds as a
619
dynamic library and exposes C-bindings, it can be used by any language that
720
supports interoperability with C, such as the Foreign Function Interface (FFI).
@@ -21,57 +34,37 @@ without using the Native SDK, see the following resources:
2134

2235
## Integrating the SDK
2336

24-
The Native SDK currently supports **Windows, macOS and Linux**. There are three
25-
distribution to choose from:
26-
27-
| Standalone | With Breakpad | With Crashpad |
28-
| :----------------: | :-------------: | :-------------: |
29-
| Custom Messages | Custom Messages | Custom Messages |
30-
| Custom Errors | Custom Errors | Custom Errors |
31-
| Breadcrumbs | Breadcrumbs | Breadcrumbs |
32-
| _Stack Traces*_ | Stack Traces | Stack Traces |
33-
| _Capture Crashes*_ | Capture Crashes | Capture Crashes |
34-
| --- | Minidumps | Minidumps |
35-
| --- | Attachments | Attachments |
36-
37-
\* _Adding stack traces and capturing application crashes requires you to add an
38-
unwind library and hook into signal handlers of your process. The Standalone
39-
distribution currently does not contain integrations that perform this
40-
automatically._
37+
The Native SDK currently supports **Windows, macOS, Linux and Android**.
4138

4239
### Building the SDK
4340

4441
To build the SDK, download the latest release of the SDK from the [Releases
45-
page](https://github.com/getsentry/sentry-native/releases). For each supported
46-
platform, there is a `gen_*` subfolder that contains build files:
47-
48-
**Windows**
49-
50-
: `gen_windows` contains a Microsoft Visual Studio 2017 solution. Open the
51-
solution and add your projects or copy the projects to an existing solution.
52-
Each project supports a debug and release configuration and includes all
53-
sources required for building.
54-
55-
**Linux and macOS**
56-
57-
: `gen_linux` and `gen_macos` contain Makefiles that can be used to produce
58-
dynamic libraries. Run `make help` to see an overview of the available
59-
configurations and target. There are debug and release configurations, that
60-
can be toggled when building:
61-
62-
```bash
63-
make config=release sentry
64-
```
65-
66-
There are multiple available targets to build:
42+
page](https://github.com/getsentry/sentry-native/releases).
43+
The SDK is managed as a [CMake] project, which additionally supports a number
44+
of configuration options, such as the backend to use.
45+
46+
`CMake` can be used for example like this (on macOS):
47+
48+
```sh
49+
# configure the cmake build into the `build` directory, with crashpad (on macOS)
50+
$ cmake -B build -D SENTRY_BACKEND=crashpad
51+
# build the project
52+
$ cmake --build build --parallel
53+
# install the resulting artifacts into a specific prefix
54+
$ cmake --install build --prefix install
55+
# which will result in the following (on macOS):
56+
$ exa --tree install
57+
install
58+
├── bin
59+
│ └── crashpad_handler
60+
├── include
61+
│ └── sentry.h
62+
└── lib
63+
├── libsentry.dylib
64+
└── libsentry.dylib.dSYM
65+
```
6766

68-
- `sentry`: Builds the Native SDK built as a dynamic library.
69-
- `sentry_breakpad`: Builds the Native SDK with Google Breakpad as a dynamic
70-
library.
71-
- `sentry_crashpad`: Builds the Native SDK with Google Crashpad as a dynamic
72-
library.
73-
- `crashpad_*`: Builds crashpad utilities. To run the Crashpad distribution of
74-
the SDK, you must build `crashpad_handler` and ship it with your application.
67+
[cmake]: https://cmake.org/cmake/help/latest/
7568

7669
### Connecting the SDK to Sentry
7770

@@ -365,11 +358,11 @@ transport depends on the target platform:
365358

366359
- **Linux**: Curl
367360
- **macOS**: Curl
368-
- **Windows**: WinHTTP
369361

370362
To specify a custom transport, use the `sentry_options_set_transport` function
371-
and supply a transport that conforms to the `sentry_transport_function_t`
372-
signature:
363+
and supply a transport that implements the `sentry_transport_t` interface.
364+
To simplify using a single function, one might use the
365+
`sentry_new_function_transport` function:
373366

374367
```c
375368
#include <sentry.h>
@@ -387,7 +380,8 @@ int main(void) {
387380
void *transport_data = 0;
388381

389382
sentry_options_t *options = sentry_options_new();
390-
sentry_options_set_transport(options, custom_transport, transport_data);
383+
sentry_options_set_transport(options,
384+
sentry_new_function_transport(custom_transport, transport_data));
391385
sentry_init(options);
392386

393387
/* ... */
@@ -402,38 +396,14 @@ background thread or thread pool to avoid blocking execution.
402396
403397
*Integrations* extend the functionality of the SDK for some common frameworks
404398
and libraries. Similar to plugins, they extend the functionality of the Sentry
405-
SDK. The Native SDK comes in two additional distributions that include
406-
integrations into the Breakpad and Crashpad libraries, respectively.
407-
408-
### Google Breakpad
399+
SDK.
409400
410-
[Breakpad](https://chromium.googlesource.com/breakpad/breakpad/) is an
411-
open-source multiplatform crash reporting system written in C++ by Google and
412-
the predecessor of Crashpad. It supports macOS, Windows, and Linux, and features
413-
an uploader to submit minidumps to a configured URL right when the process
414-
crashes.
415-
416-
To use the Breakpad integration with the Native SDK, build and link the
417-
`sentry_breakpad` dynamic library. Then, configure a path at which Breakpad can
418-
store its database. This location temporarily hosts Minidumps before they are
419-
uploaded to Sentry.
420-
421-
```c
422-
sentry_options_t *options = sentry_options_new();
423-
sentry_options_set_database_path(options, "sentry-db");
424-
sentry_init(options);
425-
```
401+
The Native SDK can use different backends that are responsible to capture
402+
crashes. The backend is configured at build-time, using the `SENTRY_BACKEND`
403+
CMake option.
426404
427-
{% capture __alert_content -%}
428-
Breakpad on macOS has been deprecated. If you are setting up a new project,
429-
consider to use the [Crashpad distribution](#google-crashpad) instead. The
430-
Sentry SDK is subject to limitations of Breakpad.
431-
{%- endcapture -%}
432-
{%- include components/alert.html
433-
title="Warning"
434-
content=__alert_content
435-
level="warning"
436-
%}
405+
The `crashpad` backend is used by default on Windows and macOS, whereas Linux
406+
and Android use the `inproc` in-process backend by default.
437407
438408
### Google Crashpad
439409
@@ -442,51 +412,43 @@ is an open-source multiplatform crash reporting system written in C++ by Google.
442412
It supports macOS, Windows, and Linux (limited), and features an uploader to
443413
submit minidumps to a configured URL right when the process crashes.
444414
445-
To use the Crashpad integration with the Native SDK, build and link the
446-
`sentry_crashpad` dynamic library. Additonally, build the standalone
447-
`crashpad_handler` application. Then, configure a path at which Crashpad can
448-
store its database. This location temporarily hosts Minidumps before they are
449-
uploaded to Sentry.
415+
To use the Crashpad backend with the Native SDK, configure the CMake build
416+
with the `SENTRY_BACKEND=crashpad` option. This will automatically create a
417+
`crashpad_handler` executable alongside the `sentry` library.
418+
419+
```sh
420+
$ cmake -B build -D SENTRY_BACKEND=crashpad
421+
```
422+
423+
The SDK will automatically look for a `crashpad_handler` executable in the same
424+
directory as the running application. It will also use the `.sentry-native`
425+
directory as its database by default, relative to the current working directory
426+
of your application.
427+
This location temporarily hosts Minidumps before they are uploaded to Sentry.
428+
429+
Both of these paths can be customized like this:
450430

451431
```c
452432
sentry_options_t *options = sentry_options_new();
453433
sentry_options_set_handler_path(options, "path/to/crashpad_handler");
454-
sentry_options_set_database_path(options, "sentry-db");
434+
sentry_options_set_database_path(options, "sentry-db-directory");
455435
sentry_init(options);
456436
```
457437
458438
The crashpad handler executable must be shipped alongside your application so
459439
that it can be launched when initializing the SDK. The path is evaluated
460440
relative to the current working directory at runtime.
461441
462-
{% capture __alert_content -%}
463-
We do not recommend to run Crashpad on Linux as development of the Crashpad
464-
library for Linux has not been completed. The Sentry SDK is subject to
465-
limitations of Crashpad, which on Linux include:
466-
467-
- No support for HTTPs uploads. Crash reports can only be uploaded to Sentry
468-
using insecure HTTP connections.
469-
- Limited crash handler support. In some cases, the crash handler may be
470-
unstable or not capture the process state correctly.
471-
472-
Consider to use the [Breakpad distribution](#google-breakpad) instead.
473-
{%- endcapture -%}
474-
{%- include components/alert.html
475-
title="Warning"
476-
content=__alert_content
477-
level="warning"
478-
%}
479-
480-
### Event Attachments (Preview)
442+
## Event Attachments (Preview)
481443
482444
Besides the Minidump file, Sentry can optionally store additional files uploaded
483445
in the same request, such as log files.
484446
485447
{% include platforms/event-attachments.md %}
486448
487-
Attachments require the _Crashpad_ distribution of the SDK. To add an
488-
attachment, the path to the file has to be configured when initializing the SDK.
489-
It will monitor the file and add it to any Minidump that is sent to Sentry:
449+
To add an attachment, the path to the file has to be configured when
450+
initializing the SDK. It will monitor the file and upload it along any event
451+
or crash that is sent to Sentry:
490452
491453
```c
492454
sentry_options_add_attachment(options, "log", "/var/server.log");

0 commit comments

Comments
 (0)