-
Notifications
You must be signed in to change notification settings - Fork 14
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
DM-47594: Set up trace telemetry for Butler server #1117
Draft
dhirving
wants to merge
19
commits into
main
Choose a base branch
from
tickets/DM-47594
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
❌ 2 Tests Failed:
View the top 2 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
dhirving
force-pushed
the
tickets/DM-47594
branch
6 times, most recently
from
November 20, 2024 23:32
1a7921f
to
09c1d38
Compare
dhirving
force-pushed
the
tickets/DM-47594
branch
4 times, most recently
from
December 6, 2024 20:13
c6227a8
to
9cb8879
Compare
DatasetTypeCache is only used in a single file with a specific set of types, so it no longer needs to be generic. Upcoming changes to make it thread-safe and cloneable will be easier to reason about with concrete types.
In preparation for sharing DatasetTypeCache between threads, make its inner DynamicTables values immutable. The mutable portion moved to a separate cache inside DatasetTypeCache. As a side effect, this reduces the number of times we go to the DB to check for the existence of tag and calib tables.
This cache is used only by a single manager, and has never participated in the caching enable/disable logic associated with CachingContext. Getting it out of CachingContext encapsulates its creation and use within a single manager class, simplifying upcoming changes. This also removes some unused branches from the code.
Pre-fetch dataset types the first time a repository is accessed in Butler server, to avoid the need to re-fetch them in most later operations.
Trigger dataset type preload the first time a connection is made to the Butler server in each unit test, to better match the conditions that will exist in the actual server.
Fix a bug where loading a dataset type registered externally after the Butler had loaded a "full" dataset type cache would cause an assertion failure "Dataset type cache population is incomplete" due to only filling in one of the two caches.
Copy some notes from the comments on DM-42317, and update them for the changes to dataset type caching.
Set up trace telemetry for Butler server using Sentry, to allow debugging of performance issues in the deployed server.
Avoid cluttering trace logs by not tracking the health check endpoint.
Add manual spans to clarify where time is being used during streaming queries
This would create an excessive number of spans for larger queries. The FastAPI telemetry is already tracking the time spent in sending the results to the client, so we can see it without adding an additional span.
With the cache enabled, every query on the server is pulling and processing 17k rows of dataset summaries because filtering is disabled when the cache is on. (Which is all queries). This is more like 1 or 60 rows if we use the filter. The processing of these rows seems to be taking excessive synchronous CPU time (300ms+ on the server).
This reverts commit 4a95b72.
The FastAPI thread pool size can now be configured by setting the environment variable DAF_BUTLER_SERVER_THREAD_POOL_SIZE. It turns out the default value was 10, which is way too low for an I/O-bound service like Butler server.
This reverts commit eabd6ff.
Wrap all accesses to sqlalchemy.MetaData with a lock to avoid concurrency issues. sqlalchemy.MetaData is documented to be threadsafe for reads, but not with concurrent modifications. We add tables dynamically at runtime, and the MetaData object is shared by all Database instances sharing the same connection pool. Prior to adding the lock, Butler server database calls that added table definitions dynamically were sometimes failing with InvalidRequestError exceptions complaining about inconsistency of table definitions.
dhirving
force-pushed
the
tickets/DM-47594
branch
from
December 10, 2024 22:34
6af7581
to
cd7b3e4
Compare
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.
Set up trace telemetry for Butler server using Sentry, to allow debugging of performance issues in the deployed server.
Checklist
doc/changes
configs/old_dimensions