Repository navigation
ci(tests): Run backend shards without Snuba where tests allow - #131167
Draft
sentry-junior[bot] wants to merge 5 commits into
Draft
sentry-junior[bot] wants to merge 5 commits into
sentry-junior[bot] wants to merge 5 commits into
Conversation
Full backend runs can put test files that never touch Snuba, ClickHouse, Kafka or Symbolicator on lite shards that skip starting them. A pytest plugin records service use per test file on full-service shards and fails any test that tries one on a lite shard, even if the code swallows the connection error. BACKEND_SNUBA_SHARDS=0 for now: every shard keeps every service and records usage, to build the first inventory. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
AdminClient.__init__ calls super(AdminClient, self) through its module global, so replacing that global with a subclass recursed forever. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
backend-test-services.json is the union of the service usage recorded in two full runs. Record per-test usage too, with the thread when it isn't the main one, to debug files that only sometimes use Snuba. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Record mode only saw new connections, so a test reusing the urllib3 pool's connection to Snuba (or a per-process Kafka producer) looked like it never used it. Lite shards caught 407 such files. Count every send on a service socket and every Kafka client call, refresh the inventory with the lite-shard failures, and give Snuba 21 of 30 shards. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Lite shards finished ~80s before Snuba shards with 21 of them. Tests that run pytest-selected.py themselves no longer inherit the shard's service color. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Contributor
Author
MeasurementsAll runs below are full backend suites (
43541416173 had one failure on a lite shard, from a nested Master reference, x64 (43535410847, 30 shards, all services):
43537601902 is similar: median wall 335s, max 406s, pre-test 116s. What needs Snuba
Takeaways
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backend shards spend a large part of their time starting ClickHouse, Kafka and Snuba and waiting for them to be healthy, and ClickHouse keeps using CPU during tests. This lets full runs skip those services on shards whose test files don't use them. Measurements are in the comments.
Design
BACKEND_SNUBA_SHARDS(23) keep devservicesbackend-ci. The rest are "lite": they use the newbackend-ci-litemode (postgres, redis, bigtable, redis-cluster, objectstore) and skip the per-worker Snuba bootstrap.pytest-selected.pyassigns files before any test is imported, usingbackend-test-services.json.# backend-ci: snubaor Relay/Symbolicator hints. Lite shards get the rest.pytest_service_guard.pywatches socket connects and sends to the service ports, so it also sees pooled connections, plus Kafka client calls.Inventory
Guarded full runs upload
backend-service-usage-*artifacts, whichbackend-test-services.pymerges. A file needs Snuba if any shard saw it use a service. A file that ran on a lite shard without failing is Snuba-free, because lite shards enforce. WithBACKEND_SNUBA_SHARDSat 0, every shard keeps every service and only records usage.Known gaps
Open questions
Groupsave looks like the main reason files need Snuba, so skipping that in tests that don't read it could move many files to lite shards.backend-test-durations.json?via @joshuarli.
--
View Session [Sentry]