-
Notifications
You must be signed in to change notification settings - Fork 537
expose Event type in package api #4122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Would like to add my support for this, we ended up using the Proper type hinting would have been nice at the time or for those unfamiliar with Sentry. from sentry_sdk.types import Event
def _filter_transactions(event, hint) -> Optional[Event]:
url_string = event["request"]["url"]
parsed_url = urlparse(url_string)
if parsed_url.path == "/health":
# We don't send transactions for health checks, to avoid spamming Sentry
return None
return event
def sentry_initialization():
sentry_sdk.init(
dsn="***",
before_send_transaction=_filter_transactions, |
Hey folks, thanks for raising this.
|
Ok, seems I just missed it then. Perhaps more just a comment on how little the docs encourage usage of the types, I did look around the docs quite a lot and couldn't find examples. (also it seems my IDE couldn't find the imports when recommending imports, but that's unrelated) |
We can definitely make it more discoverable. I imagine if we moved the definition to A mention in the docs is also a great idea, we can do that for sure. Thanks for the great feedback! |
I think just more mentions in the docs would suffice :) |
Hey @fraser-langton we updated our docs to include the types. Thanks again for raising this. We also have a PR merged that makes more types public which will be released soon: #4315 |
Problem Statement
Was wondering by the
Event
type was hidden in a private module_types
, I am writing mybefore_send
function and because I am a good pythonista I wanted to type it :)The type was added in #2753 but maybe it didn't occur to them to add it then?
The same would probably apply to a lot of other types the user might need (
hint
etc...)Here is how I currently do it, which is fine, but it doesn't encourage typing
Solution Brainstorm
Add to init? change submodule to public,
typing
ortypes
?The text was updated successfully, but these errors were encountered: