Repository navigation
Conversation
Add BackWaveMonitor.GetJobCountAsync. It returns the number of jobs that match the scope filters of a JobQuery: state, queue, wire name, schedule id, and tag predicates. It ignores the paging fields (AfterSequence, SortDirection, MaxResults), and the monitor page size does not cap it. Add IJobStore.CountMatchingJobsAsync as a default interface method. The default pages through ListJobsAsync, so a custom store keeps compiling and gives the correct count. InMemory, SQLite, Postgres, SQL Server, and Oracle override it with one COUNT(*) that uses the same scope conditions as the listing. Every forwarding store wrapper in the tests forwards the new member. Add three conformance facts: the count equals the listing for each filter kind, the count ignores the paging fields, and an empty store gives 0. Add the read-only MCP tool count_jobs. It takes the same filters as search_jobs and uses the view gate. Add GET /monitor/jobs/count to the sample.
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.
Summary
The Monitor API can now count the jobs that match a filter. Before this change, a caller had to page through
ListJobsAsyncto get a total, and the page size capped each page.Rules of the count:
MaxMonitorPageSizedoes not cap it.The store method has its own name,
CountMatchingJobsAsync. The nameCountJobsAsyncalready returns the queue depths, and two return shapes under one name would confuse callers. The dashboard does not change: a count on each Jobs page view would scan the table on a large store.Evidence
Before: no count API.
GET /monitor/jobs?state=Succeededreturns 200 rows (the page cap), and there is no total.After: a real Sample.Api on SQLite (verify-backwave run). The store has 1,519 jobs from
/demo/seedand/jobs/tagged-report:GET /monitor/jobs/countcount_jobscount(*)= 1519state=Succeededstate = 3= 356queue=criticalqueue = 'critical'= 349tenant=acmequeue=nowhereThe listing with
state=Succeededreturns 200 rows. The count returns 356.New tests:
Local runs (
dotnet buildgives 0 warnings and 0 errors):Merge Danger
Door: two-way
The change adds members and changes no schema. A revert removes the members.
Blast Radius: small
IJobStoregets a new member with a default body, so a custom store still compiles. It gets the paging default until it overrides the method.