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

ref(subscriptions): Decouple subscription logic from datasets [INGEST-627] #2258

Merged
merged 4 commits into from
Dec 15, 2021

Conversation

ahmedetefy
Copy link
Contributor

@ahmedetefy ahmedetefy commented Dec 7, 2021

Replica of #2244
Re-opening because I accidentally merged it into the main branch

@ahmedetefy ahmedetefy requested review from fpacifici and evanh December 7, 2021 08:38
@ahmedetefy ahmedetefy requested a review from a team as a code owner December 7, 2021 08:38
@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2021

Codecov Report

Merging #2258 (1ca7c85) into cra-metrics/add-metrics-counters-entity-subscription (fc58934) will decrease coverage by 0.00%.
The diff coverage is 89.88%.

Impacted file tree graph

@@                                   Coverage Diff                                    @@
##           cra-metrics/add-metrics-counters-entity-subscription    #2258      +/-   ##
========================================================================================
- Coverage                                                 93.19%   93.18%   -0.01%     
========================================================================================
  Files                                                       552      552              
  Lines                                                     25106    25150      +44     
========================================================================================
+ Hits                                                      23397    23437      +40     
- Misses                                                     1709     1713       +4     
Impacted Files Coverage Δ
snuba/datasets/factory.py 85.36% <ø> (-1.60%) ⬇️
snuba/cli/subscriptions.py 62.96% <36.36%> (-1.52%) ⬇️
snuba/web/views.py 67.27% <89.47%> (+0.71%) ⬆️
snuba/datasets/entities/factory.py 94.11% <100.00%> (+1.01%) ⬆️
snuba/subscriptions/subscription.py 100.00% <100.00%> (ø)
tests/subscriptions/test_subscription.py 100.00% <100.00%> (ø)
tests/test_api.py 99.41% <100.00%> (+0.03%) ⬆️
tests/test_sessions_api.py 100.00% <100.00%> (ø)
tests/test_writer.py 100.00% <100.00%> (ø)
snuba/web/converters.py 87.50% <0.00%> (+6.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc58934...1ca7c85. Read the comment docs.

@@ -435,25 +438,49 @@ def handle_subscription_error(exception: InvalidSubscriptionError) -> Response:
)


@application.route("/<dataset:dataset>/<entity:entity>/subscriptions", methods=["POST"])
@application.route("/<dataset:dataset>/subscriptions", methods=["POST"])
Copy link
Member

Choose a reason for hiding this comment

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

Are you planning to remove this one as a follow up? I think we should

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep that's the plan, I am planning to remove line 442 and 470 i.e. for creation and deletion as a follow up

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, it could be useful to mark or comment these in code so it's clear what will happen to the old routes

Comment on lines 469 to 498
@application.route(
"/<dataset:dataset>/subscriptions/<int:partition>/<key>", methods=["DELETE"]
)
Copy link
Member

Choose a reason for hiding this comment

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

Same here, let's deprecate this one once it is no longer being used?

@lynnagara
Copy link
Member

Just some questions about which endpoints we'll be deprecating, otherwise LGTM

@ahmedetefy ahmedetefy force-pushed the cra-metrics/add-metrics-counters-entity-subscription branch 3 times, most recently from c07e832 to efab254 Compare December 9, 2021 13:14
@ahmedetefy ahmedetefy force-pushed the cra-metrics/decouple-dataset-subscriptions branch from 0873d16 to 3dc8290 Compare December 9, 2021 13:22
@ahmedetefy ahmedetefy force-pushed the cra-metrics/add-metrics-counters-entity-subscription branch from efab254 to 26ac38c Compare December 9, 2021 13:42
@ahmedetefy ahmedetefy force-pushed the cra-metrics/decouple-dataset-subscriptions branch 2 times, most recently from 701f26f to 60a874f Compare December 14, 2021 17:14
@ahmedetefy ahmedetefy force-pushed the cra-metrics/add-metrics-counters-entity-subscription branch from 3fa7c5f to fc58934 Compare December 15, 2021 09:21
@ahmedetefy ahmedetefy force-pushed the cra-metrics/decouple-dataset-subscriptions branch from 60a874f to 1ca7c85 Compare December 15, 2021 10:15
Base automatically changed from cra-metrics/add-metrics-counters-entity-subscription to master December 15, 2021 14:36
…-627] (#2244)

* ref(subscriptions): Decouple subscription logic from datasets

Decouples subscription creation and deletion logic
from datasets to also consider entities since
dataset to entity is not a 1-to-1 relation

* Add test that ensures selected dataset is actually being used
@ahmedetefy ahmedetefy force-pushed the cra-metrics/decouple-dataset-subscriptions branch from 1ca7c85 to a01c23c Compare December 15, 2021 14:39
@ahmedetefy ahmedetefy merged commit f92156e into master Dec 15, 2021
@ahmedetefy ahmedetefy deleted the cra-metrics/decouple-dataset-subscriptions branch December 15, 2021 15:01
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.

3 participants