-
Notifications
You must be signed in to change notification settings - Fork 510
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
Bring back last_event_id
#3057
Bring back last_event_id
#3057
Changes from all commits
72c08e6
bc11a8e
91afec7
751f6ca
b63d2bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,16 @@ def flush(self, *args, **kwargs): | |
# type: (*Any, **Any) -> None | ||
return None | ||
|
||
def last_event_id(self): | ||
# type: () -> Optional[str] | ||
""" | ||
.. versionadded:: 2.1.2 | ||
|
||
Returns the most recently captured error event's ID. If this client has | ||
not captured an error event yet, returns `None`. | ||
""" | ||
return None | ||
|
||
def __enter__(self): | ||
# type: () -> BaseClient | ||
return self | ||
|
@@ -379,6 +389,8 @@ def _capture_envelope(envelope): | |
except Exception as e: | ||
logger.debug("Can not set up profiler. (%s)", e) | ||
|
||
self._last_event_id = None # type: Optional[str] | ||
|
||
finally: | ||
_client_init_debug.set(old_debug) | ||
|
||
|
@@ -709,6 +721,7 @@ def capture_event( | |
|
||
is_transaction = event_opt.get("type") == "transaction" | ||
is_checkin = event_opt.get("type") == "check_in" | ||
is_error = not is_transaction and not is_checkin | ||
|
||
if ( | ||
not is_transaction | ||
|
@@ -750,6 +763,9 @@ def capture_event( | |
if self.transport is None: | ||
return None | ||
|
||
if is_error: | ||
self._last_event_id = event_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think only errors is fine. Because the error ID is important for user feedback form. |
||
|
||
self.transport.capture_envelope(envelope) | ||
|
||
return event_id | ||
|
@@ -820,6 +836,10 @@ def flush( | |
self.metrics_aggregator.flush() | ||
self.transport.flush(timeout=timeout, callback=callback) | ||
|
||
def last_event_id(self): | ||
# type: () -> Optional[str] | ||
return self._last_event_id | ||
|
||
def __enter__(self): | ||
# type: () -> _Client | ||
return self | ||
|
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.
I guess this would also include profiles? Maybe make a check similar to the one for transaction?