Skip to content
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

[dbnode] Emit aggregate usage metrics #3123

Merged
merged 12 commits into from
Jan 27, 2021
Merged

[dbnode] Emit aggregate usage metrics #3123

merged 12 commits into from
Jan 27, 2021

Conversation

arnikola
Copy link
Collaborator

Emits additional aggregate metrics around fields and terms used; also reduces change that made aggregate query doc limit too aggressive

Copy link
Collaborator

@wesleyk wesleyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any tests we can update to ensure the global limit revert works as expected?

@@ -1933,6 +1947,12 @@ func TestBlockAggregate(t *testing.T) {
spans := mtr.FinishedSpans()
require.Len(t, spans, 2)
require.Equal(t, tracepoint.BlockAggregate, spans[0].OperationName)

for _, v := range scope.Snapshot().Counters() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use tallytest.AssertCounterValue

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice, did not know about this one

func (*noopCounter) Inc(_ int64) {}

func newUsageMetrics(ns ident.ID, iOpts instrument.Options) usageMetrics {
if ns == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm can we have a catch-all metric tag for these instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that, but figured that potentially having a bunch of metrics under namespace="undefined" would end up kinda confusing and not add much additional information; can add it if you think it would be worth having though 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, when is ns not set? Mostly curious if we want to account for these or not

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly when we clear out or finalize the results, or if incorrectly initializing when taking an AggregateResults out of the pool, also happened a lot in tests so had to have some sensible defaults for it without updating all the tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rather not drop metrics. I don't think an undefined namespace is that confusing. it would allow you to sum across the metrics without namespace, which is probably the common case.

dedupedFields tally.Counter
}

func newUsageMetrics(ns ident.ID, iOpts instrument.Options) usageMetrics {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to reset this with every aggregate result? Is the namespace important enough?

@codecov
Copy link

codecov bot commented Jan 27, 2021

Codecov Report

Merging #3123 (5c1b8d7) into master (827796c) will decrease coverage by 0.0%.
The diff coverage is 91.8%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #3123     +/-   ##
=========================================
- Coverage    72.2%    72.2%   -0.1%     
=========================================
  Files        1084     1084             
  Lines      100219   100251     +32     
=========================================
+ Hits        72397    72420     +23     
- Misses      22774    22781      +7     
- Partials     5048     5050      +2     
Flag Coverage Δ
aggregator 75.8% <ø> (ø)
cluster 84.8% <ø> (-0.1%) ⬇️
collector 84.3% <ø> (ø)
dbnode 78.6% <91.8%> (-0.1%) ⬇️
m3em 74.4% <ø> (ø)
m3ninx 73.1% <ø> (ø)
metrics 20.0% <ø> (ø)
msg 74.1% <ø> (-0.2%) ⬇️
query 67.2% <ø> (ø)
x 80.3% <ø> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 827796c...4561410. Read the comment docs.

func (*noopCounter) Inc(_ int64) {}

func newUsageMetrics(ns ident.ID, iOpts instrument.Options) usageMetrics {
if ns == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rather not drop metrics. I don't think an undefined namespace is that confusing. it would allow you to sum across the metrics without namespace, which is probably the common case.

// will have one field.
totalCount := len(batch)
for idx := 0; idx < len(batch); idx++ {
totalCount += len(batch[idx].Terms)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is total different than total terms?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this

Copy link
Collaborator

@ryanhall07 ryanhall07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd personally drop the total, or make term/field a label so you can sum across. not a fan of composite metrics that might skew in the future.

@wesleyk wesleyk merged commit eb5dfac into master Jan 27, 2021
@wesleyk wesleyk deleted the arnikola/limit-metrics branch January 27, 2021 19:36
soundvibe added a commit that referenced this pull request Jan 29, 2021
* master:
  [dbnode] Add aggregate term limit regression test (#3135)
  [DOCS] Adding Prometheus steps to quickstart (#3043)
  [dbnode] Revert AggregateQuery changes (#3133)
  Fix TestSessionFetchIDs flaky test (#3132)
  [dbnode] Alter multi-segments builder to order by size before processing (#3128)
  [dbnode] Emit aggregate usage metrics (#3123)
  [dbnode] Add Shard.OpenStreamingReader method (#3119)
  [dtests] Docker tests integration with docker-compose (#3031)
  [dbnode] Comments / remove unused var (#3124)
  [query] Handle context.Canceled and map to 499 http status (#3069)
  [dbnode] Use StreamingReadMetadata for bootstrapping (#2938)
  [dbnode] Use DefaultTestOptions in test code (#3113)

# Conflicts:
#	src/dbnode/storage/bootstrap/bootstrapper/fs/source.go
soundvibe added a commit that referenced this pull request Feb 1, 2021
* master:
  [dtest] endpoint to fetch tagged (#3138)
  Refactor FetchTagged to return an Iterator of results (#3141)
  [dbnode] Add aggregate term limit regression test (#3135)
  [DOCS] Adding Prometheus steps to quickstart (#3043)
  [dbnode] Revert AggregateQuery changes (#3133)
  Fix TestSessionFetchIDs flaky test (#3132)
  [dbnode] Alter multi-segments builder to order by size before processing (#3128)
  [dbnode] Emit aggregate usage metrics (#3123)
  [dbnode] Add Shard.OpenStreamingReader method (#3119)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants