forked from adfinis/document-merge-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
378 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import logging | ||
|
||
import sentry_sdk | ||
from sentry_sdk.integrations.django import DjangoIntegration | ||
from sentry_sdk.integrations.logging import LoggingIntegration | ||
|
||
|
||
def sentry_init(dsn, env, traces_sample_rate, send_default_pii): | ||
sentry_sdk.init( | ||
dsn=dsn, | ||
environment=env, | ||
send_default_pii=send_default_pii, | ||
traces_sample_rate=traces_sample_rate, | ||
integrations=[ | ||
DjangoIntegration(), | ||
LoggingIntegration(level=logging.INFO, event_level=logging.ERROR), | ||
# the `level` kwarg defaults to INFO and instructs sentry to include log messages of that level or higher in | ||
# the message sent to sentry when triggered by an event of level specified in event_level kwarg as | ||
# breadcrumbs. | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sentry_sdk | ||
|
||
|
||
def test_sentry(sentry_mock): | ||
assert len(sentry_mock.method_calls) == 0 | ||
sentry_sdk.capture_exception(Exception("test_sentry_exc")) | ||
assert len(sentry_mock.method_calls) == 1 | ||
sentry_mock.record_lost_event.assert_not_called() | ||
assert ( | ||
sentry_mock.method_calls[0].args[0]["exception"]["values"][0]["value"] | ||
== "test_sentry_exc" | ||
) |
Oops, something went wrong.