-
Notifications
You must be signed in to change notification settings - Fork 329
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
Add query percentile support to stats #1112
Merged
Merged
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
MarinPostma
approved these changes
Mar 1, 2024
* Add expires_at to control when QueriesStats should be reset * Add query count and elapsed sum to query stats response Also group all latency aggregations together under the elapsed key * Remove option sprawl on QueriesStats fields By making the whole struct optional where it is used * Add created_at to stats queries responde object * Set queries stats to none when stats is created This will make the API response the same when no queries have been recorded on the queries stats struct. This can happen right after: - the stats struct initialization - the stats queries object expiration Example of stats API response when no queries have been recorded: { ... "queries": null } * Use if else instead of early return from stats to response
athoscouto
added a commit
that referenced
this pull request
Mar 1, 2024
* Record query latency percentiles with hdrhistogram * Expose queries percentiles through stats response * Simplify QueriesStats transformation to QueriesStatsResponse * Reset query stats at the beginning of every hour (#1118) * Add expires_at to control when QueriesStats should be reset * Add query count and elapsed sum to query stats response Also group all latency aggregations together under the elapsed key * Remove option sprawl on QueriesStats fields By making the whole struct optional where it is used * Add created_at to stats queries responde object * Set queries stats to none when stats is created This will make the API response the same when no queries have been recorded on the queries stats struct. This can happen right after: - the stats struct initialization - the stats queries object expiration Example of stats API response when no queries have been recorded: { ... "queries": null } * Use if else instead of early return from stats to response
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 1, 2024
* Aggregated stats for queries with most elapsed_time * Add query percentile support to stats (#1112) * Record query latency percentiles with hdrhistogram * Expose queries percentiles through stats response * Simplify QueriesStats transformation to QueriesStatsResponse * Reset query stats at the beginning of every hour (#1118) * Add expires_at to control when QueriesStats should be reset * Add query count and elapsed sum to query stats response Also group all latency aggregations together under the elapsed key * Remove option sprawl on QueriesStats fields By making the whole struct optional where it is used * Add created_at to stats queries responde object * Set queries stats to none when stats is created This will make the API response the same when no queries have been recorded on the queries stats struct. This can happen right after: - the stats struct initialization - the stats queries object expiration Example of stats API response when no queries have been recorded: { ... "queries": null } * Use if else instead of early return from stats to response
athoscouto
added a commit
that referenced
this pull request
Mar 4, 2024
athoscouto
added a commit
that referenced
this pull request
Mar 4, 2024
athoscouto
added a commit
that referenced
this pull request
Mar 4, 2024
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.
This uses
hdrhistogram
to recordp50
,p75
,p90
,p95
,p99
, andp99.9
of query latency.If it works well, we may decide to add it per query too.
hdrhistogram
uses constant memory given its range andsigfig
parameter.So usage does not go up as we add more records.
I've decided not to use the bounded version of the histogram because even though our latency should be below hundreds of thousands of milliseconds, I didn't want to risk an error or panic.
Some benchmarks around memory usage:
We should see an 8~16kb overhead per namespace in most cases.
I think that is acceptable, but let me know if it isn't.