Skip to content

Commit 4d7e519

Browse files
authored
feat(health): allow clickhouse check bypass (#7600)
We've had a lot of issues over the years with the health check being an issue that takes Snuba API pods down in a way that reduces stability rather than increasing it. Recently, there's an issue where a too-slow health check response, not being caught by our own timeout handling behavior, causes API pods to be taken out of rotation even when we have no evidence that new pods would behave any better. Rather than scale down when we have connection issues to ClickHouse, this essentially adds an option to keep accepting requests on the pod for as long as uwsgi has capacity. This still is some degradation to the customer (at this time, some of their requests will time out) but assuming some kind of network or envoy issue is causing bad behavior that should recover faster than a pod restart. This option (`health_check_ignore_clickhouse`) is going to be disabled by default, but I want to try enabling this behavior in `us` for a while and see how it goes. Internal doc on this: https://www.notion.so/sentry/investigation-pod-availability-drop-2ca8b10e4b5d808796c6ecd2e3ad1700
1 parent 03f8738 commit 4d7e519

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

snuba/utils/health_info.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from snuba.datasets.storage import Storage
2424
from snuba.datasets.storages.factory import get_all_storage_keys, get_storage
2525
from snuba.environment import setup_logging
26-
from snuba.state import get_float_config
26+
from snuba.state import get_float_config, get_int_config
2727
from snuba.utils.metrics.wrapper import MetricsWrapper
2828

2929
metrics = MetricsWrapper(environment.metrics, "api")
@@ -94,11 +94,16 @@ def get_health_info(thorough: Union[bool, str]) -> HealthInfo:
9494
"thorough": str(thorough),
9595
}
9696

97-
clickhouse_health = (
98-
check_all_tables_present(metric_tags=metric_tags)
99-
if thorough
100-
else sanity_check_clickhouse_connections()
101-
)
97+
if get_int_config("health_check_ignore_clickhouse", 0) == 1:
98+
clickhouse_health = True
99+
metric_tags["skipped_clickhouse_check"] = "true"
100+
else:
101+
clickhouse_health = (
102+
check_all_tables_present(metric_tags=metric_tags)
103+
if thorough
104+
else sanity_check_clickhouse_connections()
105+
)
106+
102107
metric_tags["clickhouse_ok"] = str(clickhouse_health)
103108

104109
body: Mapping[str, Union[str, bool]]

0 commit comments

Comments
 (0)