Add /v1/usage endpoint and scheduler toggle - #286
Merged
Conversation
nsheff
force-pushed
the
feat/usage-endpoint
branch
from
August 22, 2026 20:19
4a8c93a to
4a91b5d
Compare
Change async def to def so FastAPI runs the blocking DB call in a threadpool; cap limit at 1000 to bound response size.
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.
What this does
Adds a public read-only endpoint to get BEDbase usage counts by date range, and a switch to run the server without writing usage data.
GET /v1/usageReturns per-item usage counts for one event type (
files,bed_meta,bedset_meta,bed_search,bedset_search), optionally filtered to a date window, with paging. Unlike the existing/detailed-usage(top 20, all-time only), this exposes the full, time-filterable data, which lets the stats site report accurate per-month usage.BEDHOST_DISABLE_USAGE_SCHEDULERNew environment flag. When set, the hourly usage-flush scheduler does not start, so the server can be pointed at a database in read-only mode (useful for local inspection against production data). Default behavior is unchanged (scheduler on).
Depends on
databio/bbconf#126 — this endpoint calls the new
bbagent.get_usageand importsUsageResponsefrom bbconf. Merge and release bbconf first; CI here will pass once bedhost picks up that bbconf version.