|
1 | | -from typing import Any |
2 | | - |
3 | 1 | from sentry_sdk import init as initialize_sentry |
4 | 2 | from sentry_sdk.integrations.fastapi import FastApiIntegration |
5 | 3 | from sentry_sdk.integrations.logging import LoggingIntegration |
6 | 4 | from sentry_sdk.integrations.starlette import StarletteIntegration |
7 | 5 |
|
8 | | - |
9 | | -def improve_fingerprint(event: dict[str, Any], hint: dict[str, Any]) -> dict[str, Any]: |
10 | | - if "exc_info" not in hint: |
11 | | - return event |
12 | | - |
13 | | - _, e, _ = hint["exc_info"] |
14 | | - |
15 | | - return event |
16 | | - |
17 | | - |
18 | | -def before_send(event: dict[str, Any], hint: dict[str, Any]) -> dict[str, Any]: |
19 | | - return improve_fingerprint(event, hint) |
| 6 | +import brigid |
20 | 7 |
|
21 | 8 |
|
22 | | -def initialize( |
23 | | - dsn: str, sample_rate: float, enable_tracing: bool, traces_sample_rate: float, environment: str |
24 | | -) -> None: |
| 9 | +def initialize(dsn: str, sample_rate: float, environment: str) -> None: |
25 | 10 | initialize_sentry( |
26 | 11 | dsn=dsn, |
27 | | - enable_tracing=enable_tracing, |
28 | 12 | sample_rate=sample_rate, |
29 | | - traces_sample_rate=traces_sample_rate, |
| 13 | + traces_sample_rate=None, |
| 14 | + max_breadcrumbs=0, |
| 15 | + # Without this config Sentry miss important frames from stacktraces |
| 16 | + add_full_stack=True, |
30 | 17 | attach_stacktrace=True, |
31 | | - before_send=before_send, |
32 | 18 | environment=environment, |
33 | | - include_source_context=True, |
| 19 | + # set the correct project root directory |
| 20 | + project_root=brigid.__path__[0], |
| 21 | + # disable ALL automatically enabled integrations, because they periodically cause issues |
| 22 | + auto_enabling_integrations=False, |
34 | 23 | integrations=[ |
35 | | - # disable default logging integration to use specialized structlog-sentry processor |
36 | | - LoggingIntegration(event_level=None, level=None), |
37 | 24 | StarletteIntegration(transaction_style="endpoint"), |
38 | 25 | FastApiIntegration(transaction_style="endpoint"), |
39 | 26 | ], |
| 27 | + disabled_integrations=[ |
| 28 | + # disable default logging integration to use specialized structlog-sentry processor |
| 29 | + LoggingIntegration(event_level=None, level=None), |
| 30 | + ], |
40 | 31 | ) |
0 commit comments