-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamic error sampling Python (#8314)
* Dynamic error sampling Python * Apply suggestions from code review Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com> * Remove extra closing parenthesis * Added error-sampler to basic options * Bullet points for valid values * [getsentry/action-github-commit] Auto commit --------- Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com> Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7222a0b
commit 2796cef
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/platform-includes/configuration/error-sampler/python.mdx
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,20 @@ | ||
```python | ||
import sentry_sdk | ||
|
||
def my_sampler(_, hint): | ||
exception_sampler_values = { | ||
MyException: 0.5, | ||
MyIgnoredException: 0.0, # or equivalently, False | ||
} | ||
|
||
try: | ||
return exception_sampler_values[hint["exc_info"][0]] | ||
except (IndexError, KeyError, TypeError): | ||
return 1.0 # or equivalently, True | ||
|
||
sentry_sdk.init( | ||
# ... | ||
|
||
error_sampler=my_sampler, | ||
) | ||
``` |
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
2796cef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sentry-docs – ./
docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev