Skip to content

Commit 5dd09d7

Browse files
authored
Merge pull request #545 from TeskaLabs/docs/sentry-2401
Sentry documentation improvements
2 parents 5246749 + f7447e5 commit 5dd09d7

File tree

1 file changed

+43
-13
lines changed

1 file changed

+43
-13
lines changed

docs/reference/services/sentry.md

+43-13
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,62 @@ Sentry sends **events** (errors or transactions) to sentry.io together with addi
99

1010
**Transactions** are used for performance monitoring. A transaction represents the operation you want to measure or track, like a page load, page navigation, or asynchronous task. Transaction events are grouped by the transaction name. Moreover, you can monitor child tasks within a single transaction by creating child **spans**.
1111

12+
## Configuration
1213

13-
## Setup
14-
15-
First, install the Python Sentry SDK:
16-
17-
```
18-
pip install sentry-sdk
19-
```
14+
When the [Sentry Service](#integration) is integrated to the ASAB microservice, it can be configured to send events to Sentry.io workspace.
2015

2116
After you create a new project in Sentry.io, [DSN (data source name)](https://docs.sentry.io/product/sentry-basics/dsn-explainer/?original_referrer=https%3A%2F%2Fduckduckgo.com%2F) is generated. You can either set the environment variable or fulfill DSN in the configuration.
2217

2318

24-
=== "Configuration"
19+
=== "DSN in Configuration"
20+
You can set DSN in the configuration directly:
2521

2622
```ini title='configuration file'
2723
[sentry]
28-
data_source_name=https://<public key>@o<secret key>.ingest.sentry.io/<project id>
24+
data_source_name=https://<public key>@<secret key>.ingest.sentry.io/<project id>
25+
```
26+
27+
=== "DSN as environment variable"
28+
You can provide DSN as environment variable (which is safer, in general) in a `.env` file.
29+
30+
``` shell title='.env'
31+
export SENTRY_DSN=https://<public key>@<secret key>.ingest.sentry.io/<project id>
2932
```
3033

31-
=== "Environment variable"
34+
Then use this variable in `docker-compose.yaml` file.
3235

33-
``` shell title='shell'
34-
export SENTRY_SDK=https://<public key>@o<secret key>.ingest.sentry.io/<project id>
36+
```yaml title="docker-compose.yaml"
37+
my-asab-service:
38+
image: my.asab.based.microservice
39+
...
40+
environment:
41+
- SENTRY_DSN=${SENTRY_DSN}
3542
```
3643

37-
Then you can initialize the Sentry Service:
44+
In the configuration file, `[sentry]` section may be empty, but it has to be there.
45+
46+
```ini title='configuration file'
47+
[sentry]
48+
```
49+
50+
Other options available for sentry:
51+
52+
```ini
53+
[sentry]
54+
environment=production_hogwarts # will be visible as a tag 'environment'
55+
56+
[sentry:logging]
57+
breadcrumbs=info # logging level for capturing breadcrumbs
58+
events=notice # logging level for capturing events
59+
```
60+
61+
!!! tip
62+
If the application is properly containerized, other tags for Sentry.io are created automatically (using Manifest), such as:
63+
`appclass`, `release`, `server_name`, `service_id`, `instance_id`, `node_id`.
64+
65+
## Integration
66+
67+
Sentry service is dependent on Python `sentry_sdk` library.
3868

3969
```python title='my_app.py'
4070
import asab

0 commit comments

Comments
 (0)