Skip to content

feat(outcomes) Support key tsdb models#15380

Merged
manuzope merged 1 commit into
masterfrom
feat/outcomes-support-key-tsdb-models
Nov 1, 2019
Merged

feat(outcomes) Support key tsdb models#15380
manuzope merged 1 commit into
masterfrom
feat/outcomes-support-key-tsdb-models

Conversation

@manuzope

Copy link
Copy Markdown
Contributor

In addition to project and organization tsdb models, outcomes should also support the follow project key tsdb models:

  • key_total_received
  • key_total_rejected
  • key_total_blacklisted

I missed this in the initial implementation so adding it now.

Test plan

  • Hitting the key details page locally
  • Unit tests

@manuzope manuzope requested a review from a team October 31, 2019 23:12
Comment thread src/sentry/tsdb/snuba.py
`group_on_time`: whether to add a GROUP BY clause on the 'time' field.
`group_on_model`: whether to add a GROUP BY clause on the primary model.
"""
# XXX: to counteract the hack in project_key_stats.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 throws if the key is a string not containing a number. Are you sure keys are always numbers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yea. The key based models are only ever called from project_key_stats so feel pretty safe about that.

@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.

just one clarification, otherwise it is ok

Comment thread src/sentry/tsdb/snuba.py
`group_on_time`: whether to add a GROUP BY clause on the 'time' field.
`group_on_model`: whether to add a GROUP BY clause on the primary model.
"""
# XXX: to counteract the hack in project_key_stats.py

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 throws if the key is a string not containing a number. Are you sure keys are always numbers?

@manuzope manuzope requested a review from a team November 1, 2019 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.

Please verify my last comment, anyway that would not be dangerous since we are measuring the mismatch still and in the worst case scenario it would restrict the result and not allow to read results the user is not supposed to see.

Comment thread src/sentry/utils/snuba.py
Comment on lines +588 to +589
project_key = ProjectKey.objects.get(pk=key_ids[0])
organization_id = project_key.project.organization_id

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.

Was it possible before to load metrics across organizations ? This one defaults to the organization of the first project.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope. It was always a single organization.

@manuzope manuzope merged commit 47ea20e into master Nov 1, 2019
@manuzope manuzope deleted the feat/outcomes-support-key-tsdb-models branch November 1, 2019 18:42
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants