Aggregate counter downsampling preserves resets#143381
Aggregate counter downsampling preserves resets#143381gmarouli merged 38 commits intoelastic:mainfrom
Conversation
.../qa/rest/src/yamlRestTest/resources/rest-api-spec/test/downsample-with-security/10_basic.yml
Show resolved
Hide resolved
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
|
Hi @gmarouli, I've created a changelog YAML for you. |
...ample/qa/mixed-cluster/src/yamlRestTest/resources/rest-api-spec/test/downsample/10_basic.yml
Outdated
Show resolved
Hide resolved
...ample/qa/mixed-cluster/src/yamlRestTest/resources/rest-api-spec/test/downsample/10_basic.yml
Outdated
Show resolved
Hide resolved
...sample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleRateIT.java
Outdated
Show resolved
Hide resolved
...ugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/CounterResetDataPoints.java
Outdated
Show resolved
Hide resolved
| private final ExponentialHistogramFieldDownsampler[] exponentialHistogramDownsamplers; | ||
| private final TDigestHistogramFieldDownsampler[] tDigestHistogramDownsamplers; | ||
| private final NumericMetricFieldDownsampler[] numericDownsamplers; | ||
| private final NumericMetricFieldDownsampler.AggregateCounterFieldDownsampler[] aggregateCounterDownsamplers; |
There was a problem hiding this comment.
Not a big fan of undocumented variables.. maybe add a quick note of what is this tracking?
There was a problem hiding this comment.
Let me know if it's more clear, otherwise I will iterate
| private long timestamp; | ||
| private int docCount; | ||
| private CounterResetDataPoints counterResetDataPoints; | ||
| private final List<AbstractFieldDownsampler<?>> fieldDownsamplers; |
There was a problem hiding this comment.
Nit: it's a bit confusing now, since dimensions and counters are also fields. Let's add comments, or maybe rename the variables to document what each one covers.
There was a problem hiding this comment.
I added comments here too.
|
Buildkite benchmark this with tsdb please |
...wnsample/src/main/java/org/elasticsearch/xpack/downsample/NumericMetricFieldDownsampler.java
Outdated
Show resolved
Hide resolved
|
Buildkite benchmark this with tsdb please |
💚 Build Succeeded
This build ran two tsdb benchmarks to evaluate performance impact of this PR. History
|
|
Aggregate Last value |
...lugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TimestampValueFetcher.java
Outdated
Show resolved
Hide resolved
...ugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/DownsampleShardIndexer.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Martijn van Groningen <martijn.v.groningen@gmail.com>
|
Aggregate Last value |
In this PR we aim to improve the accuracy of the aggregate counter by the following changes: - The downsampled document will record the first and not the last value of the counter. This should improve accuracy because the first value is closer to the start of the bucket than the last value. - If we detect a reset, we track extra documents, the last value before the reset and, optionally, the value after the reset. These documents will preserve the original timestamps. Our hypothesis is that with these two changes, we can have a more accurate counter estimation without a big performance regression (vefiried in elastic#142280), assuming that reset events are rare and usually affect all counters at the same moment. Closes elastic#136178
|
The changelog has been updated with #145740 |
In this PR we aim to improve the accuracy of the aggregate counter by the following changes:
Our hypothesis is that with these two changes, we can have a more accurate counter estimation without a big performance regression (vefiried in #142280), assuming that reset events are rare and usually affect all counters at the same moment.
Closes #136178