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

[exporter/prometheusremotewrite] Hash labels using xxhash for performance #31385

Merged
merged 22 commits into from Apr 12, 2024

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Feb 22, 2024

Description:
Improve performance in pkg/translator/prometheusremotewrite by using the same xxhash based time series signature algorithm as Prometheus itself (labels.StableHash(), which is guaranteed to not change over time). I became aware of time series signature calculation being a bit of a bottleneck when profiling Grafana Mimir's OTLP endpoint.

This change involves moving from a string hash, to a uint64 one. My thesis is that if Prometheus uses this algorithm to identify time series/label sets, it should be suitable for this translation logic too.

Hash collisions

I've attempted to handle hash collisions in the same way as Prometheus: PrometheusConverter has a unique field, which is its main map from hash to TimeSeries, as well as a conflicts field, being its secondary map from hash to a slice of TimeSeries in case of hash collisions. If a label set should hash to an existing entry in unique, but not be equal to the existing entry's label set, the label set is attempted matched to the conflicts map instead. If its equal is not found among the conflicts for the hash in question either, it's added to the conflicts slice (for the hash).

Link to tracking Issue:

Testing:
I've run make test/make lint and run the BenchmarkFromMetrics benchmark. Benchmark stats included below, they show an average speedup of 3.68% and an average memory reduction of 17.13%.

NB: The benchmark stats reveal performance regressions in a few cases, because of using the prometheusConverter API via the FromMetrics function.

Benchmarks

Benchmark stats
goos: linux
goarch: amd64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite
cpu: AMD Ryzen 9 3950X 16-Core Processor            
                                                                                                                                           │ main-frommetrics.txt │       xxhash-frommetrics.txt        │
                                                                                                                                           │        sec/op        │    sec/op     vs base               │
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                 5.304m ±  4%   5.137m ±  1%   -3.15% (p=0.041 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                 9.362m ± 13%   9.084m ±  4%        ~ (p=0.240 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32                12.52m ±  4%   12.66m ±  3%        ~ (p=0.485 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32                29.50m ±  8%   28.93m ±  5%        ~ (p=0.699 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32                33.77m ±  7%   33.02m ±  3%   -2.23% (p=0.026 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32               36.66m ±  5%   34.27m ±  5%   -6.52% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                 16.07m ±  3%   15.23m ±  6%   -5.18% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                 22.14m ±  3%   21.31m ±  2%   -3.74% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                27.37m ±  4%   26.10m ±  2%   -4.62% (p=0.015 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                52.09m ±  5%   49.00m ±  4%   -5.92% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                58.06m ±  9%   55.13m ±  2%        ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32               63.26m ±  4%   56.88m ±  8%  -10.09% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32              21.35m ±  2%   19.70m ±  7%   -7.75% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32              28.46m ± 10%   27.16m ±  9%        ~ (p=0.310 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32             38.36m ±  8%   36.52m ±  3%        ~ (p=0.093 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32             79.58m ±  7%   73.39m ±  5%   -7.78% (p=0.015 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32             85.43m ± 10%   83.01m ±  3%        ~ (p=0.180 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32            91.64m ±  3%   89.75m ±  3%        ~ (p=0.240 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                    3.622µ ±  4%   4.553µ ±  3%  +25.70% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                    3.657µ ±  3%   4.498µ ±  5%  +23.01% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                   3.619µ ±  3%   4.462µ ±  2%  +23.31% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                   3.620µ ±  3%   4.484µ ±  1%  +23.88% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                   3.648µ ±  4%   4.514µ ±  4%  +23.74% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32                  3.636µ ±  2%   4.409µ ±  6%  +21.26% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                 5.375m ±  2%   5.248m ±  1%   -2.36% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                 9.494m ±  4%   9.173m ±  3%   -3.37% (p=0.015 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32                12.85m ±  3%   12.58m ±  3%        ~ (p=0.093 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32                31.22m ±  3%   29.19m ±  3%   -6.52% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32                34.38m ±  7%   31.87m ±  4%   -7.31% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32               37.51m ±  4%   34.93m ±  3%   -6.88% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                 16.62m ±  7%   15.19m ±  2%   -8.60% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                 23.00m ±  2%   21.59m ±  3%   -6.16% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                27.68m ±  3%   24.43m ± 13%  -11.74% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                51.83m ±  5%   46.10m ±  7%  -11.05% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                55.53m ± 10%   53.55m ±  3%   -3.58% (p=0.041 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32               62.50m ±  9%   57.66m ±  8%   -7.75% (p=0.015 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32              20.95m ±  2%   20.09m ±  3%   -4.11% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32              31.50m ±  2%   28.90m ±  8%   -8.28% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32             38.88m ±  2%   35.93m ±  7%   -7.57% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32             78.77m ± 13%   72.69m ±  6%        ~ (p=0.093 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32             79.26m ±  5%   77.43m ± 14%        ~ (p=0.310 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32            95.29m ± 12%   86.04m ±  4%        ~ (p=0.093 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                   33.77µ ±  5%   31.27µ ±  9%   -7.40% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                   33.58µ ±  2%   31.39µ ±  5%   -6.52% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                  33.88µ ±  5%   32.36µ ± 10%        ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                  33.09µ ±  5%   31.21µ ±  8%   -5.68% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                  33.48µ ±  2%   31.08µ ±  7%   -7.19% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32                 33.27µ ±  2%   31.35µ ±  5%   -5.78% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                5.560m ±  3%   5.339m ±  4%   -3.97% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                9.515m ±  5%   9.140m ±  4%        ~ (p=0.240 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32               12.78m ±  2%   12.41m ±  7%   -2.85% (p=0.026 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32               30.47m ±  2%   27.57m ±  6%   -9.52% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32               34.18m ±  5%   31.20m ± 10%   -8.70% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32              36.59m ±  3%   33.24m ±  8%   -9.14% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                16.62m ±  2%   14.75m ±  2%  -11.26% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                22.61m ±  5%   20.51m ±  8%   -9.28% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32               27.05m ±  2%   24.55m ±  9%   -9.24% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32               52.34m ±  4%   48.22m ±  6%   -7.87% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32               57.75m ± 14%   52.74m ±  5%        ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32              61.06m ±  4%   58.11m ±  6%   -4.83% (p=0.026 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32             21.33m ±  6%   19.97m ±  8%   -6.35% (p=0.015 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32             31.13m ±  5%   27.37m ±  4%  -12.08% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32            38.94m ±  3%   36.79m ±  8%   -5.51% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32            76.13m ±  8%   71.61m ±  7%   -5.93% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32            84.44m ±  5%   79.09m ±  8%        ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32           93.63m ±  7%   82.87m ± 10%  -11.49% (p=0.002 n=6)
geomean                                                                                                                                              7.321m         7.039m         -3.86%

                                                                                                                                           │ main-frommetrics.txt │       xxhash-frommetrics.txt        │
                                                                                                                                           │         B/op         │     B/op      vs base               │
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                 1.586Mi ± 0%   1.501Mi ± 0%   -5.37% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                 3.713Mi ± 0%   3.627Mi ± 0%   -2.31% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32                5.854Mi ± 0%   5.770Mi ± 0%   -1.44% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32               10.503Mi ± 0%   7.133Mi ± 0%  -32.09% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32               12.710Mi ± 0%   9.331Mi ± 0%  -26.58% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32               14.91Mi ± 0%   11.53Mi ± 0%  -22.68% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                 6.588Mi ± 0%   6.830Mi ± 0%   +3.68% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                 9.475Mi ± 0%   9.715Mi ± 0%   +2.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                12.47Mi ± 0%   12.71Mi ± 0%   +1.93% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                25.19Mi ± 0%   20.61Mi ± 0%  -18.18% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                28.13Mi ± 0%   23.55Mi ± 0%  -16.30% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32               31.18Mi ± 0%   26.58Mi ± 0%  -14.75% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32              7.964Mi ± 0%   8.078Mi ± 0%   +1.44% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32              13.03Mi ± 0%   13.14Mi ± 0%   +0.80% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32             18.25Mi ± 0%   18.36Mi ± 0%   +0.58% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32             35.84Mi ± 0%   27.84Mi ± 0%  -22.31% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32             41.15Mi ± 0%   33.17Mi ± 0%  -19.38% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32            46.61Mi ± 0%   38.64Mi ± 0%  -17.09% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                    1.613Ki ± 0%   1.086Ki ± 0%  -32.69% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                    1.613Ki ± 0%   1.086Ki ± 0%  -32.69% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                   1.613Ki ± 0%   1.086Ki ± 0%  -32.69% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                   1.613Ki ± 0%   1.086Ki ± 0%  -32.69% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                   1.613Ki ± 0%   1.086Ki ± 0%  -32.69% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32                  1.613Ki ± 0%   1.086Ki ± 0%  -32.69% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                 1.588Mi ± 0%   1.502Mi ± 0%   -5.42% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                 3.715Mi ± 0%   3.628Mi ± 0%   -2.32% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32                5.857Mi ± 0%   5.771Mi ± 0%   -1.46% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32               10.512Mi ± 0%   7.137Mi ± 0%  -32.10% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32               12.714Mi ± 0%   9.325Mi ± 0%  -26.65% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32               14.92Mi ± 0%   11.55Mi ± 0%  -22.64% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                 6.589Mi ± 0%   6.831Mi ± 0%   +3.67% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                 9.476Mi ± 0%   9.716Mi ± 0%   +2.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                12.47Mi ± 0%   12.71Mi ± 0%   +1.88% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                25.20Mi ± 0%   20.60Mi ± 0%  -18.22% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                28.13Mi ± 0%   23.55Mi ± 0%  -16.28% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32               31.17Mi ± 0%   26.58Mi ± 0%  -14.72% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32              7.964Mi ± 0%   8.079Mi ± 0%   +1.44% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32              13.04Mi ± 0%   13.14Mi ± 0%   +0.76% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32             18.26Mi ± 0%   18.36Mi ± 0%   +0.56% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32             35.86Mi ± 0%   27.89Mi ± 0%  -22.24% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32             41.15Mi ± 0%   33.10Mi ± 0%  -19.55% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32            46.62Mi ± 1%   38.53Mi ± 0%  -17.34% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                  14.199Ki ± 0%   7.797Ki ± 0%  -45.08% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                  14.200Ki ± 0%   7.797Ki ± 0%  -45.09% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                 14.200Ki ± 0%   7.797Ki ± 0%  -45.09% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                 14.199Ki ± 0%   7.797Ki ± 0%  -45.09% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                 14.200Ki ± 0%   7.798Ki ± 0%  -45.09% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32                14.200Ki ± 0%   7.798Ki ± 0%  -45.08% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                1.600Mi ± 0%   1.508Mi ± 0%   -5.74% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                3.728Mi ± 0%   3.635Mi ± 0%   -2.49% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32               5.869Mi ± 0%   5.775Mi ± 0%   -1.60% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32              10.516Mi ± 0%   7.135Mi ± 0%  -32.15% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32              12.723Mi ± 0%   9.318Mi ± 0%  -26.76% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32              14.94Mi ± 0%   11.53Mi ± 1%  -22.80% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                6.602Mi ± 0%   6.837Mi ± 0%   +3.56% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                9.489Mi ± 0%   9.721Mi ± 0%   +2.45% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32               12.48Mi ± 0%   12.72Mi ± 0%   +1.86% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32               25.21Mi ± 0%   20.61Mi ± 0%  -18.22% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32               28.14Mi ± 0%   23.55Mi ± 0%  -16.28% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32              31.18Mi ± 0%   26.59Mi ± 0%  -14.73% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32             7.976Mi ± 0%   8.085Mi ± 0%   +1.36% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32             13.05Mi ± 0%   13.15Mi ± 0%   +0.76% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32            18.26Mi ± 0%   18.36Mi ± 0%   +0.55% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32            35.87Mi ± 0%   27.85Mi ± 0%  -22.37% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32            41.25Mi ± 0%   33.14Mi ± 0%  -19.64% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32           46.63Mi ± 0%   38.49Mi ± 0%  -17.45% (p=0.002 n=6)
geomean                                                                                                                                              3.120Mi        2.586Mi       -17.13%

                                                                                                                                           │ main-frommetrics.txt │       xxhash-frommetrics.txt       │
                                                                                                                                           │      allocs/op       │  allocs/op   vs base               │
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                  22.23k ± 0%   20.12k ± 0%   -9.51% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                  54.50k ± 0%   52.38k ± 0%   -3.90% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32                 84.78k ± 0%   82.67k ± 0%   -2.48% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32                 65.46k ± 0%   63.22k ± 0%   -3.42% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32                 98.86k ± 0%   96.46k ± 1%   -2.43% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32                129.5k ± 1%   127.1k ± 0%   -1.88% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                  73.55k ± 0%   72.38k ± 0%   -1.60% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                  109.8k ± 0%   108.6k ± 0%   -1.10% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                 141.1k ± 0%   139.9k ± 0%   -0.85% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                 96.80k ± 0%   95.27k ± 0%   -1.58% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                 134.0k ± 0%   132.3k ± 0%   -1.26% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32                165.6k ± 0%   163.8k ± 1%   -1.08% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32               96.31k ± 0%   93.13k ± 0%   -3.30% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32               165.5k ± 0%   162.1k ± 0%   -2.02% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32              227.6k ± 0%   224.3k ± 0%   -1.43% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32              172.5k ± 1%   168.7k ± 2%   -2.21% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32              244.8k ± 1%   241.7k ± 1%   -1.29% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32             309.3k ± 1%   306.1k ± 1%   -1.01% (p=0.037 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                      17.00 ± 0%    13.00 ± 0%  -23.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                      17.00 ± 0%    13.00 ± 0%  -23.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                     17.00 ± 0%    13.00 ± 0%  -23.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                     17.00 ± 0%    13.00 ± 0%  -23.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                     17.00 ± 0%    13.00 ± 0%  -23.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32                    17.00 ± 0%    13.00 ± 0%  -23.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                  22.26k ± 0%   20.13k ± 0%   -9.55% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                  54.52k ± 0%   52.39k ± 0%   -3.90% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32                 84.80k ± 0%   82.69k ± 0%   -2.50% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32                 65.68k ± 1%   63.30k ± 1%   -3.62% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32                 98.96k ± 1%   96.30k ± 0%   -2.69% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32                129.8k ± 0%   127.4k ± 0%   -1.81% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                  73.57k ± 0%   72.38k ± 0%   -1.62% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                  109.9k ± 0%   108.7k ± 0%   -1.10% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                 141.1k ± 0%   139.9k ± 0%   -0.89% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                 97.03k ± 1%   95.12k ± 1%   -1.96% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                 133.8k ± 0%   132.3k ± 0%   -1.16% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32                165.5k ± 0%   163.8k ± 0%   -0.98% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32               96.29k ± 0%   93.12k ± 0%   -3.29% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32               165.6k ± 0%   162.1k ± 0%   -2.06% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32              227.7k ± 0%   224.4k ± 0%   -1.45% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32              173.2k ± 1%   170.0k ± 1%   -1.82% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32              244.8k ± 1%   240.0k ± 1%   -1.98% (p=0.026 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32             309.3k ± 2%   304.1k ± 1%   -1.70% (p=0.026 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                     64.00 ± 0%    60.00 ± 0%   -6.25% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                     64.00 ± 0%    60.00 ± 0%   -6.25% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                    64.00 ± 0%    60.00 ± 0%   -6.25% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                    64.00 ± 0%    60.00 ± 0%   -6.25% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                    64.00 ± 0%    60.00 ± 0%   -6.25% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32                   64.00 ± 0%    60.00 ± 0%   -6.25% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32                 22.31k ± 0%   20.18k ± 0%   -9.54% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32                 54.58k ± 0%   52.44k ± 0%   -3.92% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32                84.85k ± 0%   82.71k ± 0%   -2.53% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32                65.47k ± 1%   63.11k ± 1%   -3.59% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32                98.92k ± 0%   96.04k ± 1%   -2.91% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32               129.8k ± 1%   127.1k ± 1%   -2.14% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-32                 73.63k ± 0%   72.43k ± 0%   -1.63% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-32                 109.9k ± 0%   108.7k ± 0%   -1.12% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-32                141.2k ± 0%   139.9k ± 0%   -0.86% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-32                96.97k ± 0%   95.18k ± 0%   -1.85% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-32                133.8k ± 0%   132.3k ± 0%   -1.06% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-32               165.5k ± 0%   163.9k ± 0%   -0.98% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-32              96.35k ± 0%   93.15k ± 0%   -3.32% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-32              165.6k ± 0%   162.3k ± 0%   -2.01% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-32             227.6k ± 0%   224.4k ± 0%   -1.43% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-32             173.2k ± 1%   168.8k ± 1%   -2.59% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-32             246.9k ± 1%   240.9k ± 1%   -2.42% (p=0.002 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-32            309.4k ± 1%   303.2k ± 0%   -1.99% (p=0.002 n=6)
geomean                                                                                                                                               25.86k        24.58k        -4.95%

Documentation:

@aknuds1 aknuds1 changed the title prometheusremotewrite: Hash labels using xxhash for performance [chore] prometheusremotewrite: Hash labels using xxhash for performance Feb 22, 2024
@aknuds1 aknuds1 marked this pull request as ready for review February 22, 2024 15:32
@aknuds1 aknuds1 requested review from Aneurysm9 and a team as code owners February 22, 2024 15:32
@aknuds1 aknuds1 changed the title [chore] prometheusremotewrite: Hash labels using xxhash for performance prometheusremotewrite: Hash labels using xxhash for performance Feb 22, 2024
@aknuds1 aknuds1 marked this pull request as draft February 22, 2024 15:35
@aknuds1 aknuds1 marked this pull request as ready for review February 22, 2024 15:52
@aknuds1 aknuds1 force-pushed the arve/xxhash branch 5 times, most recently from 7803f75 to b689a3a Compare February 22, 2024 16:39
@aknuds1 aknuds1 marked this pull request as draft February 23, 2024 09:54
@aknuds1 aknuds1 changed the title prometheusremotewrite: Hash labels using xxhash for performance WIP: prometheusremotewrite: Hash labels using xxhash for performance Feb 27, 2024
@aknuds1 aknuds1 force-pushed the arve/xxhash branch 7 times, most recently from a8cf050 to 6e42467 Compare February 28, 2024 12:53
@aknuds1
Copy link
Contributor Author

aknuds1 commented Mar 19, 2024

@friedrichg I see you're working on implementing OTLP in Cortex. Can you confirm whether the []prompb.TimeSeries type returned by PrometheusConverter.TimeSeries in this PR is suitable for integrating with Cortex? I would think so, considering it plugs well into Mimir's OTLP code. Might you have any other feedback on the new API contained within this PR?

Copy link

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

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

@aknuds1 The new API is definitely an improvement over previous API (simple FromMetrics). Tested with cortex and it works. I have no complains there. But it needs more tests in my IMHO

Thanos is implementing OTLP using the same thanos-io/thanos#7227

I believe is compatible too.

Comment on lines 34 to 44
func FromMetrics(md pmetric.Metrics, settings Settings) (map[string]*prompb.TimeSeries, error) {
c := NewPrometheusConverter()
errs := c.FromMetrics(md, settings)
tss := c.TimeSeries()
out := make(map[string]*prompb.TimeSeries, len(tss))
for i := range tss {
out[strconv.Itoa(i)] = &tss[i]
}

return out, errs
}

Choose a reason for hiding this comment

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

This is not covered by benchmarks or unit tests and I believe it should be.

Copy link
Contributor Author

@aknuds1 aknuds1 Mar 28, 2024

Choose a reason for hiding this comment

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

I converted BenchmarkFromMetrics to use FromMetrics, and made a new one for PrometheusConverter: BenchmarkPrometheusConverter_FromMetrics. Is this enough? I notice that the existing test suite already doesn't call FromMetrics (just the benchmarks).

for i, v := range labels {
if len(b)+len(v.Name)+len(v.Value)+2 >= cap(b) {
// If labels entry is 1KB+ do not allocate whole entry.
h := xxhash.New()

Choose a reason for hiding this comment

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

This line is not covered by tests, and it should be

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, PTAL.

}

// New conflict
ts = &prompb.TimeSeries{

Choose a reason for hiding this comment

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

this line is not tested by unit tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, PTAL.

@aknuds1
Copy link
Contributor Author

aknuds1 commented Mar 26, 2024

Thanks for the review @friedrichg!

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@Aneurysm9
Copy link
Member

@Aneurysm9 it was relayed to me by @jpkrohling that you might prefer I propose the API change, motivated by the desire to optimize Prometheus and Grafana Mimir OTLP ingestion, through an issue rather than directly via this PR. Would you like for me to create such an issue, so we can have an in-depth discussion, with interested stakeholders, about a performance-motivated API change?

Yes, please. I think there are a few interested parties presently working on things that would be (likely positively) impacted by this API change, including @friedrichg and @jmichalek132. Let's make sure we're all on the same page regarding what we're expecting from this API and whether the proposed change meets everyone's needs before we move forward with it.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1
Copy link
Contributor Author

aknuds1 commented Apr 11, 2024

@Aneurysm9 I pushed a revision where the new API is dropped, and improvements are hidden behind FromMetrics. PTAL.

aknuds1 and others added 3 commits April 11, 2024 17:52
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1
Copy link
Contributor Author

aknuds1 commented Apr 12, 2024

CI failure looks like a flake.

@jpkrohling jpkrohling changed the title prometheusremotewrite: Hash labels using xxhash for performance [exporter/prometheusremotewrite] Hash labels using xxhash for performance Apr 12, 2024
@jpkrohling jpkrohling merged commit 247a9f9 into open-telemetry:main Apr 12, 2024
169 of 170 checks passed
@github-actions github-actions bot added this to the next release milestone Apr 12, 2024
@aknuds1 aknuds1 deleted the arve/xxhash branch April 12, 2024 11:24
rimitchell pushed a commit to rimitchell/opentelemetry-collector-contrib that referenced this pull request May 8, 2024
…ance (open-telemetry#31385)

**Description:**
Improve performance in pkg/translator/prometheusremotewrite by using the
same [xxhash](https://github.com/cespare/xxhash) based time series
signature algorithm as Prometheus itself
([`labels.StableHash()`](https://github.com/prometheus/prometheus/blob/c6c8f63516741fd38ece5387254afee798cfc8d7/model/labels/sharding.go#L24),
which is guaranteed to not change over time). I became aware of time
series signature calculation being a bit of a bottleneck when profiling
Grafana Mimir's OTLP endpoint.

This change involves moving from a string hash, to a `uint64` one. My
thesis is that if Prometheus uses this algorithm to identify time
series/label sets, it should be suitable for this translation logic too.

#### Hash collisions

I've attempted to handle hash collisions in the same way as Prometheus:
`PrometheusConverter` has a `unique` field, which is its main `map` from
hash to `TimeSeries`, as well as a `conflicts` field, being its
secondary `map` from hash to a slice of `TimeSeries` in case of hash
collisions. If a label set should hash to an existing entry in `unique`,
but not be equal to the existing entry's label set, the label set is
attempted matched to the `conflicts` `map` instead. If its equal is not
found among the conflicts for the hash in question either, it's added to
the conflicts slice (for the hash).

**Testing:**
I've run `make test`/`make lint` and run the `BenchmarkFromMetrics`
benchmark. Benchmark stats included below, they show an average speedup
of 3.68% and an average memory reduction of 17.13%.

**NB:** The benchmark stats reveal performance regressions in a few
cases, because of using the `prometheusConverter` API _via_ the
`FromMetrics` function.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants