druid
druid copied to clipboard
Groupby Metrics
Attempt at #18781 .
Description
Metrics Reporting via GroupByQueryMetrics
- Remove method signatures in codebase which rely on using PerQueryStats to retrieve metrics, and retrieve query stats via the
GroupByQueryMetricsinstead. - Wrap a
FinalizingResultsQueryRunnerin aMetricsEmittingQueryRunnerto emit the reported GroupByQueryMetrics. - Update all method signatures in the codebase which rely on
GroupByStatsProviderorPerQueryStats. - Update
GroupByStatsProviderTest.
Pass metrics via ResponseContext among the runners
- Passing groupBy metrics via
ResponseContext, which collates and stores the information in theSequenceobjects.
Why Response Context?
- In consideration of concurrency,
QueryPlusmay not have metrics, for example seeGroupByMergingQueryRunner. - It is also hard to create
QueryMetricsobjects in classes working on layers lower than theGroupByQueryQueryToolChestsuch asGroupByMergingQueryRunner, as creating the query metrics in a QueryPlus requires the toolChest.
Future Tasks
- Come up with new metric names, current metrics names clash with
GroupByStatsMonitor. To be continued after agreeing about the logic of this PR with reviewers. - Documentations on new metrics names.
- Documentation differentiating the use of
GroupByStatsMonitorvsGroupByQueryMetrics.
Release note
Druid emits per-query GroupBy metrics by default.
Key changed/added classes in this PR
Metrics-related classes
-
GroupByQueryMetrics -
GroupByStatsProvider
Segment Walkers
-
SinkQuerySegmentWalker -
ClientQuerySegmentWalker -
LocalQuerySegmentWalker -
ServerManager
Query Runner Level
-
GroupByQueryQueryToolChest -
GroupByMergingQueryRunner -
GroupByRowProcessor -
GroupByResponseContextKeys -
ConcurrentGrouper -
SpillingGrouper -
LimitedTemporaryStorage
Others
- Test files
- Classes affected by method signature changes
This PR has:
- [x] been self-reviewed.
- [ ] added documentation for new or modified features or behaviors.
- [x] a release note entry in the PR description.
- [x] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [x] added or updated version, license, or notice information in licenses.yaml
- [x] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [x] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
- [ ] added integration tests.
- [x] been tested in a test Druid cluster.