You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project aims to provide dynamic sampling without relying on Sentry own's Dynamic Sampling.
11
+
This libs works by adding a `traces_sampler` callback to sentry.
12
+
In the background a thread fetch the data from the [controller](https://github.com/SpikeeLabs/sentry-dynamic-sampling-controller)
13
+
It's also able to ignore WSGI route an Celery task set in controller.
5
14
6
-
It work by installing the library [sentry-dynamic-sampling-lib](https://github.com/SpikeeLabs/sentry-dynamic-sampling-lib) on each project that use sentry. This lib hooks into the sentry callback to change the sampling rate. to get the rate the lib calls this service.
7
15
8
16
9
17
10
18
11
-
## Install
12
-
```bash
13
-
# install deps
14
-
poetry install
19
+
## Usage
20
+
```python
21
+
import sentry_sdk
22
+
from sentry_dynamic_sampling_lib import init_wrapper
15
23
16
-
# pre-commit
17
-
poetry run pre-commit install --install-hook
18
-
poetry run pre-commit install --install-hooks --hook-type commit-msg
24
+
# init sentry as usual
25
+
# without traces_sampler and sample_rate param
26
+
sentry_sdk.init( # pylint: disable=E0110
27
+
dsn=SENTRY_DSN,
28
+
integrations=[],
29
+
environment=ENVIRONMENT,
30
+
release=SENTRY_RELEASE,
31
+
)
32
+
33
+
# hook sentry_dynamic_sampling_lib into sentry
34
+
init_wrapper()
19
35
```
20
36
21
37
22
-
## Run
38
+
## Configuration
39
+
The following environment variables can be used to configure the lib
40
+
23
41
```bash
24
-
poetry shell
42
+
SENTRY_CONTROLLER_HOST=none # (required, no default)
43
+
SENTRY_CONTROLLER_PATH="/sentry/apps/{}/"# (optional, default to example)
44
+
SENTRY_CONTROLLER_METRIC_PATH="/sentry/apps/{}/metrics/{}/"# (optional, default to example)
45
+
SENTRY_CONTROLLER_POLL_INTERVAL=60 # (optional, default to example)
46
+
SENTRY_CONTROLLER_METRIC_INTERVAL=600 # (optional, default to example)
47
+
```
25
48
26
-
# add user
27
-
python manage.py createsuperuser
28
49
29
-
# run server
30
-
# admin @ http://localhost:8000/admin/
31
-
python manage.py runserver
32
50
51
+
52
+
## Development
53
+
```bash
54
+
# install deps
55
+
poetry install
56
+
57
+
# pre-commit
58
+
poetry run pre-commit install --install-hook
59
+
poetry run pre-commit install --install-hooks --hook-type commit-msg
0 commit comments