This repository was archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 107
cleanup carbon metrics for out-of-order vs duplicate data points, cleaner names in sync with prom metrics #1288
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
04a3197
Use different metric counts for out-of-order vs duplicate data points:
fkaleo a70bac7
Added new test case
fkaleo ba53077
Updated metrics documentation
fkaleo 549b645
New carbon metric 'tank.discarded.unknown'
fkaleo cfecaa3
Renamed carbon metric 'tank.metrics_too_old' into 'tank.discarded.sa…
fkaleo df1d873
Renamed carbon metric 'tank.discarded.new_value_for_timestamp' into '…
fkaleo 0c2faea
Renamed carbon metric 'tank.add_to_closed_chunk' into 'tank.discarded…
fkaleo f634103
Removed incorrect series from discarded samples dashboard
fkaleo efddb94
Renamed carbon metric 'input.*.*.invalid/unknown' into 'input.*.*.dis…
fkaleo 4e9b1bc
Improved documentation for 'tank.discarded.new-value-for-timestamp'
fkaleo d676e91
Updated metrics.md
fkaleo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import ( | |
"github.com/grafana/metrictank/consolidation" | ||
"github.com/grafana/metrictank/mdata/cache" | ||
"github.com/grafana/metrictank/mdata/chunk" | ||
mdataerrors "github.com/grafana/metrictank/mdata/errors" | ||
"github.com/raintank/schema" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
@@ -421,15 +422,8 @@ func (a *AggMetric) Add(ts uint32, val float64) { | |
} | ||
} | ||
} else { | ||
var reason string | ||
switch err { | ||
case errMetricTooOld: | ||
reason = sampleOutOfOrder | ||
metricsTooOld.Inc() | ||
default: | ||
reason = "unknown" | ||
} | ||
PromDiscardedSamples.WithLabelValues(reason, strconv.Itoa(int(a.key.MKey.Org))).Inc() | ||
log.Debugf("AM: failed to add metric to reorder buffer for %s. %s", a.key, err) | ||
a.discardedMetricsInc(err) | ||
} | ||
} | ||
} | ||
|
@@ -469,15 +463,14 @@ func (a *AggMetric) add(ts uint32, val float64) { | |
if currentChunk.Series.Finished { | ||
// if we've already 'finished' the chunk, it means it has the end-of-stream marker and any new points behind it wouldn't be read by an iterator | ||
// you should monitor this metric closely, it indicates that maybe your GC settings don't match how you actually send data (too late) | ||
addToClosedChunk.Inc() | ||
discardedReceivedTooLate.Inc() | ||
PromDiscardedSamples.WithLabelValues(receivedTooLate, strconv.Itoa(int(a.key.MKey.Org))).Inc() | ||
return | ||
} | ||
|
||
if err := currentChunk.Push(ts, val); err != nil { | ||
log.Debugf("AM: failed to add metric to chunk for %s. %s", a.key, err) | ||
metricsTooOld.Inc() | ||
PromDiscardedSamples.WithLabelValues(sampleOutOfOrder, strconv.Itoa(int(a.key.MKey.Org))).Inc() | ||
a.discardedMetricsInc(err) | ||
return | ||
} | ||
totalPoints.Inc() | ||
|
@@ -488,7 +481,7 @@ func (a *AggMetric) add(ts uint32, val float64) { | |
} | ||
} else if t0 < currentChunk.Series.T0 { | ||
log.Debugf("AM: Point at %d has t0 %d, goes back into previous chunk. CurrentChunk t0: %d, LastTs: %d", ts, t0, currentChunk.Series.T0, currentChunk.Series.T) | ||
metricsTooOld.Inc() | ||
discardedSampleOutOfOrder.Inc() | ||
PromDiscardedSamples.WithLabelValues(sampleOutOfOrder, strconv.Itoa(int(a.key.MKey.Org))).Inc() | ||
return | ||
} else { | ||
|
@@ -631,3 +624,19 @@ func (a *AggMetric) gcAggregators(now, chunkMinTs, metricMinTs uint32) (uint32, | |
} | ||
return points, stale | ||
} | ||
|
||
func (a *AggMetric) discardedMetricsInc(err error) { | ||
var reason string | ||
switch err { | ||
case mdataerrors.ErrMetricTooOld: | ||
reason = sampleOutOfOrder | ||
discardedSampleOutOfOrder.Inc() | ||
case mdataerrors.ErrMetricNewValueForTimestamp: | ||
reason = newValueForTimestamp | ||
discardedNewValueForTimestamp.Inc() | ||
default: | ||
discardedUnknown.Inc() | ||
reason = "unknown" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from #1201 :
thus in the unknown case, we should also increment a carbon counter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we create a new catch-all sort of counter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
PromDiscardedSamples.WithLabelValues(reason, strconv.Itoa(int(a.key.MKey.Org))).Inc() | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package errors | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
var ( | ||
ErrMetricTooOld = errors.New("metric too old") | ||
ErrMetricNewValueForTimestamp = errors.New("new value for existing timestamp") | ||
) |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh.. i love a clean dashboard json diff like this done.
was it a lot of work? I suspect you either did a manual json edit or had to do lots of
git add -p
orgit checkout -p
if you exported out of grafana.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This time I did manual json edit. Last time I did an export of grafana and managed to get a decent diff.