-
Notifications
You must be signed in to change notification settings - Fork 454
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
[aggregator] keep metric type during the aggregation #2941
Changes from 7 commits
e260f56
560fdec
abcb9f6
0e7a2f0
3419d12
fdf8c5f
e0d673f
d055c8f
5ec2d44
a0f702a
0bf7d20
30a7407
d7b695f
3678ba6
861c217
de52701
78abe4c
ba439f6
f183803
70972be
79004ca
1069a86
7cbe252
00c00b3
35698d2
2460baf
a73fad5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,3 +80,5 @@ carbon: | |
|
||
tagOptions: | ||
idScheme: quoted | ||
|
||
storeMetricsType: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ carbon: | |
|
||
tagOptions: | ||
idScheme: quoted | ||
|
||
storeMetricsType: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,3 +77,5 @@ ingest: | |
retry: | ||
maxBackoff: 10s | ||
jitter: true | ||
|
||
storeMetricsType: true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -495,14 +495,24 @@ func (d *downsamplerAndWriter) writeAggregatedBatch( | |
} | ||
|
||
for _, dp := range value.Datapoints { | ||
switch value.Attributes.M3Type { | ||
case ts.M3MetricTypeGauge: | ||
err = result.SamplesAppender.AppendGaugeTimedSample(dp.Timestamp, dp.Value) | ||
case ts.M3MetricTypeCounter: | ||
err = result.SamplesAppender.AppendCounterTimedSample(dp.Timestamp, int64(dp.Value)) | ||
case ts.M3MetricTypeTimer: | ||
err = result.SamplesAppender.AppendTimerTimedSample(dp.Timestamp, dp.Value) | ||
if value.Attributes.PromType != ts.PromMetricTypeUnknown { | ||
switch value.Attributes.PromType { | ||
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. prom does not have timer types? 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. That's correct: https://prometheus.io/docs/concepts/metric_types/ |
||
case ts.PromMetricTypeCounter: | ||
err = result.SamplesAppender.AppendCounterTimedSample(dp.Timestamp, int64(dp.Value)) | ||
default: | ||
gediminasgu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
err = result.SamplesAppender.AppendGaugeTimedSample(dp.Timestamp, dp.Value) | ||
} | ||
} else { | ||
switch value.Attributes.M3Type { | ||
case ts.M3MetricTypeGauge: | ||
err = result.SamplesAppender.AppendGaugeTimedSample(dp.Timestamp, dp.Value) | ||
case ts.M3MetricTypeCounter: | ||
err = result.SamplesAppender.AppendCounterTimedSample(dp.Timestamp, int64(dp.Value)) | ||
case ts.M3MetricTypeTimer: | ||
err = result.SamplesAppender.AppendTimerTimedSample(dp.Timestamp, dp.Value) | ||
gediminasgu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
||
if err != nil { | ||
// If we see an error break out so we can try processing the | ||
// next datapoint. | ||
|
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.
Why is it a
Gauge
? Is the type not available here? If so, some comment might be useful.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 is a base code for the code generation. By default, we set metric-type to Gauge (as most of them are) and just for Counters we replace it to Counter: https://github.com/m3db/m3/blob/gg/aggregator-keep-metric-type/src/aggregator/generated-source-files.mk#L16