Skip to content
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(discover): Update EAP dataset and entity key for discover builders #78967

Merged

Conversation

edwardgou-sentry
Copy link
Contributor

@edwardgou-sentry edwardgou-sentry commented Oct 10, 2024

Updates EAP dataset to correctly be events_analytics_platform and add entity key for eap_spans.
Also updates discover builders to stop using _get_dataset_name and start using _get_entity_name instead.

This is needed because the AlertRule model obtains and stores it's dataset from the UI via POST api call. We need to use the proper events_analytics_platform dataset string so we can pass validation when creating the snuba subscription. With these changes, we will also be able to pass any discover builder validation when creating the query from the AlertRule.

…ilder logic to get eap dataset and entity name
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 10, 2024
@edwardgou-sentry edwardgou-sentry marked this pull request as ready for review October 10, 2024 20:51
@edwardgou-sentry edwardgou-sentry requested review from a team as code owners October 10, 2024 20:51
@edwardgou-sentry edwardgou-sentry requested a review from a team as a code owner October 11, 2024 00:07
@edwardgou-sentry edwardgou-sentry force-pushed the egou/feat/update-dataset-and-entity-for-discover-eap branch from 1d77d7c to 6e7b059 Compare October 11, 2024 00:08
@edwardgou-sentry edwardgou-sentry marked this pull request as draft October 11, 2024 00:09
@edwardgou-sentry edwardgou-sentry force-pushed the egou/feat/update-dataset-and-entity-for-discover-eap branch from 6e7b059 to 4e188f2 Compare October 11, 2024 00:12
@edwardgou-sentry edwardgou-sentry removed the request for review from a team October 11, 2024 00:13
@edwardgou-sentry edwardgou-sentry marked this pull request as ready for review October 11, 2024 00:13
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/utils/snuba.py 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #78967       +/-   ##
===========================================
+ Coverage   51.13%   78.27%   +27.13%     
===========================================
  Files        7095     7128       +33     
  Lines      312363   313797     +1434     
  Branches    50997    51227      +230     
===========================================
+ Hits       159729   245616    +85887     
+ Misses     151590    61757    -89833     
- Partials     1044     6424     +5380     

Comment on lines +1506 to +1508
def _get_entity_name(self) -> str:
if self.dataset in DATASET_TO_ENTITY_MAP:
return DATASET_TO_ENTITY_MAP[self.dataset].value
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered adding DATASET_TO_ENTITY_MAP to snuba/dataset.py, but this feels more like a discover detail to me. The relationship between dataset to entity isn't actually 1:1 and the dataset name is not always equal to the entity name either. I think this is good enough for now, but we probably want to refactor this part of the builder in the future.

@edwardgou-sentry edwardgou-sentry merged commit a090ad6 into master Oct 15, 2024
49 of 50 checks passed
@edwardgou-sentry edwardgou-sentry deleted the egou/feat/update-dataset-and-entity-for-discover-eap branch October 15, 2024 16:10
cmanallen pushed a commit that referenced this pull request Oct 23, 2024
…rs (#78967)

Updates EAP dataset to correctly be `events_analytics_platform` and add
entity key for `eap_spans`.
Also updates discover builders to stop using `_get_dataset_name` and
start using `_get_entity_name` instead.

This is needed because the AlertRule model obtains and stores it's
`dataset` from the UI via POST api call. We need to use the proper
`events_analytics_platform` dataset string so we can pass validation
when creating the snuba subscription. With these changes, we will also
be able to pass any discover builder validation when creating the query
from the AlertRule.
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants