-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
feat(consumer): Add transactions consumer SLO #4442
Changes from 7 commits
a9fd9e3
2cdce7d
1543898
d07d4f0
e542463
264e841
182441f
bf41325
5144969
842557c
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 |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
InsertBatch, | ||
ProcessedMessage, | ||
_as_dict_safe, | ||
_collapse_uint32, | ||
_ensure_valid_date, | ||
_ensure_valid_ip, | ||
_unicodify, | ||
|
@@ -141,6 +142,7 @@ def _process_base_event_values( | |
metrics.increment("group_ids_exceeded_limit") | ||
|
||
processed["group_ids"] = group_ids[:GROUP_IDS_LIMIT] | ||
|
||
return processed | ||
|
||
def _process_tags( | ||
|
@@ -472,4 +474,10 @@ def process_message( | |
# the following operation modifies the event_dict and is therefore *not* order-independent | ||
self._process_contexts_and_user(processed, event_dict) | ||
|
||
return InsertBatch([processed], None) | ||
try: | ||
raw_received = _collapse_uint32(int(event_dict["data"]["received"])) | ||
assert raw_received is not None | ||
received = datetime.utcfromtimestamp(raw_received) | ||
return InsertBatch([processed], received) | ||
except Exception: | ||
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. I would only check if it's
Also, maybe looking into https://docs.python.org/3/tutorial/errors.html#exception-chaining |
||
raise KeyError("Missing received timestamp field in transaction") | ||
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. Wasn't the point of the try/except to fall back to the old behavior in case we hit the KeyError rather than re-raising it? 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. Just to be clear: today, what happens if there is a payload missing the So I guess we can fall back to the old behavior (so that we don't drop the message), but we also want to see the error show up in Sentry so we can know if there were any payloads missing the field. What's the right way of getting that error to show up? 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. I think the point was to log to sentry without throwing the exception, i.e just manually call 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. Alright I can do that then, thanks |
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.
If received is not there, won't you get an AssertionError that isn't being caught?
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.
Right, but wouldn't the first line (which throws KeyError) be thrown and caught first? So we go into the except clause?
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.
But I guess the AssertionError could be even easier, since it'd be guaranteed that it's being thrown at that line