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(ops): allow disabled entities for storage sets that are not in use #3572

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

onewland
Copy link
Contributor

@onewland onewland commented Jan 5, 2023

Add a new config that lets us disable entity loading when we want to disable storage sets temporarily.

We want to remove the cdc and sessions storage sets for ops changes, but that causes the validation on EntityFactory loading to fail

 File "/Users/oliver/workplace/snuba/snuba/datasets/schemas/tables.py", line 92, in get_table_name
    if get_cluster(self.__storage_set_key).is_single_node()
  File "/Users/oliver/workplace/snuba/snuba/clusters/cluster.py", line 482, in get_cluster
    raise UndefinedClickhouseCluster(
snuba.clusters.cluster.UndefinedClickhouseCluster: StorageSetKey.CDC is not defined in the CLUSTERS setting for this environment

even if the dataset is in DISABLED_DATASETS. This is because initialize_snuba is loading entities first:

def initialize_snuba() -> None:
logger.info("Initializing Snuba...")
# The order of the functions matters The reference direction is
#
# datasets -> entities -> storages
#
# The initialization goes bottom up, starting from the
# lowest-level concept (storage) to the highest (dataset).
_load_storages()
_load_entities()
_load_datasets()

EntityKey.GROUPASSIGNEE: GroupAssigneeEntity(),
EntityKey.GROUPEDMESSAGE: GroupedMessageEntity(),
EntityKey.OUTCOMES: OutcomesEntity(),
EntityKey.OUTCOMES_RAW: OutcomesRawEntity(),
EntityKey.SESSIONS: SessionsEntity(),
EntityKey.ORG_SESSIONS: OrgSessionsEntity(),

I tested locally that with the relevant entities disabled we can remove the storage sets cdc and sessions and snuba api will start without the above error

@onewland onewland requested a review from a team as a code owner January 5, 2023 17:53
@codecov-commenter
Copy link

Codecov Report

Base: 92.25% // Head: 21.96% // Decreases project coverage by -70.29% ⚠️

Coverage data is based on head (afcfb2a) compared to base (a6a41ef).
Patch coverage: 50.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3572       +/-   ##
===========================================
- Coverage   92.25%   21.96%   -70.30%     
===========================================
  Files         725      682       -43     
  Lines       33828    32434     -1394     
===========================================
- Hits        31207     7123    -24084     
- Misses       2621    25311    +22690     
Impacted Files Coverage Δ
snuba/datasets/entities/factory.py 0.00% <0.00%> (-92.11%) ⬇️
snuba/settings/__init__.py 94.90% <100.00%> (+0.03%) ⬆️
tests/base.py 0.00% <0.00%> (-100.00%) ⬇️
tests/helpers.py 0.00% <0.00%> (-100.00%) ⬇️
tests/conftest.py 0.00% <0.00%> (-100.00%) ⬇️
tests/fixtures.py 0.00% <0.00%> (-100.00%) ⬇️
tests/test_cli.py 0.00% <0.00%> (-100.00%) ⬇️
tests/test_util.py 0.00% <0.00%> (-100.00%) ⬇️
snuba/admin/user.py 0.00% <0.00%> (-100.00%) ⬇️
tests/assertions.py 0.00% <0.00%> (-100.00%) ⬇️
... and 636 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@onewland onewland merged commit 54262ea into master Jan 5, 2023
@onewland onewland deleted the feat/disabled-entities branch January 5, 2023 18:15
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