Skip to content

fix(discover) Add missing event fields#820

Merged
evanh merged 14 commits into
masterfrom
evanh/fix/device_charging_field
Apr 2, 2020
Merged

fix(discover) Add missing event fields#820
evanh merged 14 commits into
masterfrom
evanh/fix/device_charging_field

Conversation

@evanh

@evanh evanh commented Mar 5, 2020

Copy link
Copy Markdown
Member

Now if one of these fields is used in a query against the transactions table,
they will get properly NULL'd out instead of being passed through unchanged.

@evanh evanh requested review from a team and markstory March 5, 2020 21:23
Now if one of these fields is used in a query against the transactions table,
they will get properly NULL'd out instead of being passed through unchanged.
@evanh evanh force-pushed the evanh/fix/device_charging_field branch from 89013e7 to 9a97ec0 Compare March 5, 2020 21:24
evanh added a commit to getsentry/sentry that referenced this pull request Mar 5, 2020
We have this field in the front end but it wasn't here so it wouldn't return
results correctly. Also note that all these device and os fields will error
out if transactions are selected until this snuba PR is merged:
getsentry/snuba#820
Comment thread snuba/datasets/discover.py Outdated
evanh added a commit to getsentry/sentry that referenced this pull request Mar 6, 2020
We have this field in the front end but it wasn't here so it wouldn't return
results correctly. Also note that all these device and os fields will error
out if transactions are selected until this snuba PR is merged:
getsentry/snuba#820
evanh added 3 commits March 9, 2020 14:16
When we were checking to see if a column should be promoted, we weren't removing
the dots from the column name, which meant we might miss some column conversions
@evanh evanh force-pushed the evanh/fix/device_charging_field branch from f522603 to 64d191a Compare March 9, 2020 20:53
Comment thread snuba/datasets/discover.py Outdated
Comment thread snuba/datasets/tags_column_processor.py Outdated
@evanh evanh requested a review from fpacifici March 12, 2020 17:53

@fpacifici fpacifici left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok, just one last clarification, this will return wrong types till I don't fix the type casting in the tags processor. Are we on the same page on this?
I'd rather have that done first so we are never inconsistent in the response. I will try to do that today, should I not manage to do that I will accept this.

@evanh

evanh commented Mar 17, 2020

Copy link
Copy Markdown
Member Author

@fpacifici Yes I understand that this doesn't fix the incorrect typing issue. Doing that fix first makes sense to me.

fpacifici added a commit that referenced this pull request Mar 23, 2020
PR #820 uncovered that if we return promoted contexts through the contexts[...] syntax we have an inconsistency between errors and transactions, and this basically breaks discover, since the common columns should behave consistently there.
Specifically contexts[device.simulator] would return 'True' from the transactions table and '1' from the events table since the context is promoted in the events table (thus stored in a UInt8) but not in the transactions table where the context is only in the contexts column as a string.
for idx, condition in enumerate(conditions):
if is_condition(condition):
if tuple(condition) == ("type", "!=", "transaction"):
if tuple(condition) == ("type", "=", "error"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are other event types that need to go to the events table (csp, default, etc.) What's the reason for changing this condition ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would either need cases for csp, security and default types or revert this change.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this for two reasons:

  1. The check is broken. We will never match ("type", "!=", "transaction") because the condition sent from sentry looks like [[["isNull",["type"]],"=",1],["type","!=","transaction"]].
  2. It is useful to have some guarantee which dataset discover queries ultimately run against. Right now this works with transactions but not errors, so having this here actually fixes a number of queries that have event.type:error but are not running against the events dataset.

Also, this is a short circuit check for when people specify a specific event. If they specify an event type not in this condition, it will just continue on using the checks below. We don't need new cases here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" this is a short circuit check for when people specify a specific event. If they specify an event type not in this condition, it will just continue on using the checks below"

I don't know whether the intention of this condition is such. There are a few other conditions between this one and the final return EVENTS. That seems fine to me but I'll let @markstory confirm. Anyway, since the condition you mention is actually broken today, I guess this does not matter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this condition is not working, how does the the condition on line 52 work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The != condition works differently from the = condition. We don't add the isNull check to plain = conditions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, this is not going to make things worse or more broken, though I would strongly advise for this logic to be revisited be more robust, either now, based on the old query structure, or after the AST is rolled out.

@fpacifici fpacifici left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back to you to fix the condition

@fpacifici fpacifici left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did not see further comments around the condition issue.
Let's ensure it gets fixed in a different PR

@evanh evanh merged commit 3bd1ba1 into master Apr 2, 2020
@evanh evanh deleted the evanh/fix/device_charging_field branch April 9, 2020 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants