Class QueryGuardBaseline
- Namespace
- QueryGuard
- Assembly
- QueryGuard.Core.dll
What every measured scope cost at a known-good point, so a change can be compared against it.
public sealed class QueryGuardBaseline
- Inheritance
-
QueryGuardBaseline
- Inherited Members
Remarks
A budget asks the user for a number they usually do not have. WithMaxQueries(10) requires
knowing that ten is right, and the honest answer, on an endpoint nobody has measured, is that
nobody knows. So the number gets guessed, set too high to be useful, or set too low and then raised
until the build goes green.
A baseline asks for nothing. It records what the code does today and reports what changed:
GET /api/companies
3 -> 51 queries
That needs no threshold and no judgement to read. It is also the shape of the actual event a user cares about, not "this endpoint is over budget" but "this pull request changed this endpoint".
Committed to the repository as a file, so the comparison happens against the merge base rather than
against a database somebody has to run. See docs/decisions/0013-baseline-storage.md.
Fields
- SchemaVersion
The schema version of the baseline document.
Properties
- Count
Gets how many scopes are recorded.
- Empty
Gets a baseline with no entries recorded.
- Entries
Gets the recorded entries, ordered by scope.
Methods
- Find(string?)
Finds the entry for a scope.
- FromJson(string)
Reads a baseline from JSON.
- Record(QueryGuardBaselineEntry)
Returns a baseline with this entry recorded, replacing any existing entry for its scope.
- Record(QueryGuardResult)
Returns a baseline with this result recorded, replacing any existing entry for its scope.
- ToJson()
Renders the baseline as JSON.