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

[coordinator] Only honor default aggregation policies if not matched by mapping rule #2203

Conversation

robskillington
Copy link
Collaborator

What this PR does / why we need it:

After seeing mapping rules in use, it's become obvious that default aggregations should not honored if a matching mapping rule already specifies an aggregation for the same storage policy (retention + resolution). Letting both apply will cause race conditions on which aggregated value makes it to storage with the same metric name and tags.

This keeps the current behavior as is however will remove any applicable default aggregations for aggregated namespaces defined if a mapping rule has already been applied for the given storage policy (retention + resolution).

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:

NONE

Does this PR require updating code package or user-facing documentation?:

NONE

Copy link
Collaborator

@martin-mao martin-mao left a comment

Choose a reason for hiding this comment

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

LGTM with couple of spelling errors.

@codecov
Copy link

codecov bot commented Mar 11, 2020

Codecov Report

Merging #2203 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2203   +/-   ##
======================================
  Coverage    71.5%   71.5%           
======================================
  Files        1022    1022           
  Lines       88961   88961           
======================================
  Hits        63693   63693           
  Misses      20908   20908           
  Partials     4360    4360
Flag Coverage Δ
#aggregator 82.1% <0%> (ø) ⬆️
#cluster 85.3% <0%> (ø) ⬆️
#collector 82.8% <0%> (ø) ⬆️
#dbnode 77% <0%> (ø) ⬆️
#m3em 74.4% <0%> (ø) ⬆️
#m3ninx 74.4% <0%> (ø) ⬆️
#m3nsch 51.1% <0%> (ø) ⬆️
#metrics 17.7% <0%> (ø) ⬆️
#msg 31.9% <0%> (ø) ⬆️
#query 68.9% <0%> (ø) ⬆️
#x 83.2% <0%> (ø) ⬆️

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 cbb8109...342dea9. Read the comment docs.

// NB(r): First apply mapping rules to see which storage policies
// have been applied, any that have been applied as part of
// mapping rules that exact match a default storage policy will
// skipped when applying default rules so to avoid storing
Copy link
Collaborator

@arnikola arnikola Mar 11, 2020

Choose a reason for hiding this comment

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

nit; be skipped, rules, so as

debugLogMatchOptions{Meta: stagedMetadatas})

// Only sample if going to actually aggregate
stagedMetadatsBeforeFilter := stagedMetadatas[:]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: stagedMetadataBeforeFilter

for _, existing := range a.mappingRuleStoragePolicies {
if sp.Equivalent(existing) {
matchedByMappingRule = true
a.debugLogMatch("downsampler skipping default mapping rule storage policy",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this also log exactly which rule was skipped?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Might get confusing since it could be a subsection of it - thankfully we print that out just as we start matching it (so its contextually close in the logs)

			a.debugLogMatch("downsampler applying default mapping rule",
				debugLogMatchOptions{Meta: stagedMetadatas})

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair

Copy link
Collaborator

@arnikola arnikola left a comment

Choose a reason for hiding this comment

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

approved w/nits

@notbdu notbdu merged commit 8ddd8ea into master Mar 16, 2020
@notbdu notbdu deleted the r/skip-applying-default-mapping-rules-if-match-configured-mapping-rules branch March 16, 2020 19:02
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