Skip to content

Commit

Permalink
[chore] [translator/prometheusremotewrite] Clean up and simplify code (
Browse files Browse the repository at this point in the history
…#30749)

Perform various code cleanup, including fixing of some typos, plus
simplification in the `prometheusremotewrite` module. While not an
attempt to optimize, benchmarking shows a speedup of up to 8.9% in some
cases (see below).

I've performed `make test`. I also ran benchmarks - `benchstat` shows a
2.3% speedup on average and up to 8.9% speedup in some cases. Not even
sure why there would be a change in performance, theorizing that
simplified code lets the compiler do a better job of optimizing.

`BenchmarkFromMetrics` statistics:

<details>

```console
goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite
                                                                                                                                           │   main.txt   │            cleanup.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-12          1.868m ± 0%   1.876m ±  0%  +0.44% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12          3.272m ± 1%   3.280m ±  0%       ~ (p=0.485 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-12         4.300m ± 1%   4.283m ±  1%       ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-12         11.33m ± 1%   11.20m ±  0%  -1.16% (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-12         12.78m ± 1%   12.59m ±  1%  -1.49% (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-12        13.84m ± 0%   13.58m ±  0%  -1.85% (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-12          5.795m ± 1%   5.779m ±  1%       ~ (p=0.699 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-12          8.593m ± 0%   8.085m ±  1%  -5.91% (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-12        10.459m ± 1%   9.557m ±  0%  -8.62% (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-12         18.95m ± 1%   18.50m ±  2%  -2.40% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-12         21.83m ± 1%   20.79m ±  1%  -4.77% (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-12        24.14m ± 1%   22.63m ±  1%  -6.26% (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-12       7.246m ± 0%   7.071m ±  1%  -2.42% (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-12       10.99m ± 0%   10.36m ±  1%  -5.72% (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-12      13.92m ± 0%   13.00m ±  1%  -6.64% (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-12      29.29m ± 1%   29.21m ±  1%       ~ (p=0.699 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-12      33.67m ± 1%   32.95m ±  1%  -2.16% (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-12     37.05m ± 0%   35.75m ±  1%  -3.50% (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-12             1.180µ ± 0%   1.163µ ±  0%  -1.40% (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-12             1.180µ ± 0%   1.165µ ±  0%  -1.27% (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-12            1.180µ ± 0%   1.166µ ±  0%  -1.19% (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-12            1.178µ ± 0%   1.163µ ±  0%  -1.27% (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-12            1.179µ ± 0%   1.163µ ±  0%  -1.27% (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-12           1.180µ ± 0%   1.163µ ±  0%  -1.44% (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-12          1.907m ± 1%   1.888m ±  1%  -1.04% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12          3.327m ± 1%   3.279m ±  0%  -1.45% (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-12         4.381m ± 1%   4.268m ±  0%  -2.59% (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-12         11.43m ± 0%   11.35m ±  0%  -0.72% (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-12         12.89m ± 1%   12.78m ±  0%  -0.86% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12        13.94m ± 0%   13.79m ±  2%  -1.03% (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-12          5.867m ± 1%   5.790m ±  0%  -1.31% (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-12          8.651m ± 0%   8.107m ±  1%  -6.28% (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-12        10.503m ± 1%   9.567m ±  2%  -8.91% (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-12         18.96m ± 1%   18.74m ±  0%  -1.17% (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-12         21.93m ± 1%   21.11m ±  1%  -3.73% (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-12        24.31m ± 1%   22.88m ±  2%  -5.85% (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-12       7.260m ± 0%   7.099m ±  2%  -2.23% (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-12       11.03m ± 0%   10.55m ±  0%  -4.35% (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-12      13.95m ± 0%   13.19m ±  0%  -5.43% (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-12      29.34m ± 1%   29.45m ±  0%       ~ (p=0.240 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-12      33.81m ± 1%   33.09m ±  1%  -2.13% (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-12     37.27m ± 0%   35.98m ±  1%  -3.46% (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-12            13.04µ ± 0%   12.99µ ±  0%  -0.39% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-12            13.03µ ± 0%   12.95µ ±  0%  -0.63% (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-12           13.02µ ± 0%   12.96µ ±  1%  -0.46% (p=0.041 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-12           13.01µ ± 0%   12.96µ ±  0%  -0.38% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-12           13.01µ ± 1%   12.92µ ±  0%  -0.75% (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-12          13.01µ ± 0%   12.94µ ±  0%  -0.55% (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-12         2.027m ± 1%   2.020m ±  1%       ~ (p=0.589 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12         3.451m ± 1%   3.446m ±  1%       ~ (p=0.093 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-12        4.499m ± 1%   4.447m ±  1%  -1.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:_0-12        11.57m ± 0%   11.57m ± 21%       ~ (p=0.699 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-12        12.99m ± 1%   12.98m ±  0%       ~ (p=0.818 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12       14.07m ± 0%   13.95m ±  1%  -0.81% (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-12         5.738m ± 4%   5.800m ±  2%       ~ (p=0.394 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-12         8.498m ± 1%   8.220m ±  2%  -3.27% (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-12       10.337m ± 1%   9.775m ±  0%  -5.43% (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-12        18.86m ± 1%   19.05m ±  0%  +0.98% (p=0.026 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-12        21.81m ± 2%   21.37m ±  1%       ~ (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-12       24.12m ± 1%   23.14m ±  1%  -4.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:_0-12      7.434m ± 1%   7.346m ±  1%  -1.18% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12      11.16m ± 1%   10.51m ±  1%  -5.83% (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-12     14.07m ± 1%   13.15m ±  1%  -6.56% (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-12     29.76m ± 8%   29.61m ±  0%       ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-12     33.88m ± 1%   33.34m ±  1%  -1.60% (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-12    37.38m ± 0%   36.19m ±  0%  -3.17% (p=0.002 n=6)
geomean                                                                                                                                       2.696m        2.634m        -2.31%

                                                                                                                                           │   main.txt   │             cleanup.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-12         1.578Mi ± 0%   1.578Mi ± 0%       ~ (p=0.974 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12         3.691Mi ± 0%   3.691Mi ± 0%       ~ (p=0.310 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-12        5.807Mi ± 0%   5.807Mi ± 0%       ~ (p=0.937 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-12        10.14Mi ± 0%   10.14Mi ± 0%       ~ (p=0.180 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-12        12.28Mi ± 0%   12.28Mi ± 0%  -0.01% (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-12       14.42Mi ± 0%   14.42Mi ± 0%  -0.01% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-12         6.583Mi ± 0%   6.560Mi ± 0%  -0.35% (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-12         9.370Mi ± 0%   9.369Mi ± 0%  -0.01% (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-12        12.22Mi ± 0%   12.22Mi ± 0%  -0.02% (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-12        23.98Mi ± 0%   23.96Mi ± 0%  -0.10% (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-12        26.79Mi ± 0%   26.79Mi ± 0%  -0.01% (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-12       29.66Mi ± 0%   29.65Mi ± 0%  -0.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:_0-12      7.947Mi ± 0%   7.923Mi ± 0%  -0.29% (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-12      12.86Mi ± 0%   12.86Mi ± 0%  -0.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-12     17.86Mi ± 0%   17.85Mi ± 0%  -0.04% (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-12     34.04Mi ± 0%   34.02Mi ± 0%  -0.07% (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-12     39.05Mi ± 0%   39.03Mi ± 0%       ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12    44.15Mi ± 0%   44.13Mi ± 0%  -0.04% (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-12            1.613Ki ± 0%   1.613Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-12            1.613Ki ± 0%   1.613Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-12           1.613Ki ± 0%   1.613Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-12           1.613Ki ± 0%   1.613Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-12           1.613Ki ± 0%   1.613Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-12          1.613Ki ± 0%   1.613Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-12         1.579Mi ± 0%   1.579Mi ± 0%       ~ (p=1.000 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12         3.692Mi ± 0%   3.692Mi ± 0%  -0.01% (p=0.009 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-12        5.809Mi ± 0%   5.808Mi ± 0%  -0.01% (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-12        10.14Mi ± 0%   10.14Mi ± 0%       ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-12        12.28Mi ± 0%   12.28Mi ± 0%       ~ (p=0.065 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12       14.42Mi ± 0%   14.42Mi ± 0%       ~ (p=0.699 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-12         6.584Mi ± 0%   6.561Mi ± 0%  -0.35% (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-12         9.371Mi ± 0%   9.370Mi ± 0%  -0.01% (p=0.026 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-12        12.22Mi ± 0%   12.22Mi ± 0%  -0.02% (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-12        23.98Mi ± 0%   23.96Mi ± 0%  -0.10% (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-12        26.79Mi ± 0%   26.79Mi ± 0%  -0.01% (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-12       29.66Mi ± 0%   29.66Mi ± 0%  -0.02% (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-12      7.948Mi ± 0%   7.925Mi ± 0%  -0.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-12      12.87Mi ± 0%   12.86Mi ± 0%  -0.02% (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-12     17.86Mi ± 0%   17.86Mi ± 0%  -0.03% (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-12     34.04Mi ± 0%   34.02Mi ± 0%  -0.07% (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-12     39.06Mi ± 0%   39.06Mi ± 0%       ~ (p=0.589 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12    44.15Mi ± 0%   44.13Mi ± 0%  -0.04% (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-12           16.07Ki ± 0%   16.07Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-12           16.07Ki ± 0%   16.07Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-12          16.07Ki ± 0%   16.07Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-12          16.07Ki ± 0%   16.07Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-12          16.07Ki ± 0%   16.07Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-12         16.07Ki ± 0%   16.07Ki ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-12        1.593Mi ± 0%   1.593Mi ± 0%       ~ (p=0.818 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12        3.706Mi ± 0%   3.706Mi ± 0%       ~ (p=0.818 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-12       5.824Mi ± 0%   5.823Mi ± 0%  -0.00% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-12       10.16Mi ± 0%   10.16Mi ± 0%       ~ (p=0.485 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-12       12.29Mi ± 0%   12.29Mi ± 0%       ~ (p=0.818 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12      14.43Mi ± 0%   14.43Mi ± 0%       ~ (p=0.310 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-12        6.599Mi ± 0%   6.576Mi ± 0%  -0.35% (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-12        9.385Mi ± 0%   9.384Mi ± 0%       ~ (p=0.093 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-12       12.24Mi ± 0%   12.23Mi ± 0%  -0.01% (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-12       24.00Mi ± 0%   23.98Mi ± 0%  -0.09% (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-12       26.80Mi ± 0%   26.80Mi ± 0%  -0.01% (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-12      29.67Mi ± 0%   29.67Mi ± 0%  -0.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:_0-12     7.962Mi ± 0%   7.939Mi ± 0%  -0.29% (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-12     12.88Mi ± 0%   12.88Mi ± 0%  -0.02% (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-12    17.88Mi ± 0%   17.87Mi ± 0%  -0.03% (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-12    34.06Mi ± 0%   34.03Mi ± 0%  -0.07% (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-12    39.07Mi ± 0%   39.07Mi ± 0%       ~ (p=0.699 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12   44.16Mi ± 0%   44.15Mi ± 0%  -0.04% (p=0.002 n=6)
geomean                                                                                                                                      3.084Mi        3.083Mi       -0.04%
¹ all samples are equal

                                                                                                                                           │  main.txt   │             cleanup.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-12         22.10k ± 0%   22.10k ± 0%       ~ (p=0.892 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12         54.19k ± 0%   54.19k ± 0%       ~ (p=0.924 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-12        84.28k ± 0%   84.28k ± 0%       ~ (p=0.751 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_0-12        62.30k ± 0%   62.29k ± 0%  -0.03% (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-12        94.74k ± 0%   94.71k ± 0%  -0.03% (p=0.019 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12       125.1k ± 0%   125.0k ± 0%  -0.02% (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-12         74.27k ± 0%   73.27k ± 0%  -1.35% (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-12         109.4k ± 0%   109.4k ± 0%  -0.01% (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-12        140.5k ± 0%   140.5k ± 0%  -0.02% (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-12        94.88k ± 0%   93.85k ± 0%  -1.08% (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-12        130.3k ± 0%   130.2k ± 0%  -0.05% (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-12       161.6k ± 0%   161.5k ± 0%  -0.06% (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-12      96.55k ± 0%   95.54k ± 0%  -1.04% (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-12      164.0k ± 0%   163.9k ± 0%  -0.03% (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-12     225.4k ± 0%   225.3k ± 0%  -0.04% (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-12     161.1k ± 0%   160.1k ± 0%  -0.62% (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-12     229.9k ± 0%   229.4k ± 0%       ~ (p=0.071 n=6)
FromMetrics/resource_attribute_count:_0/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12    292.4k ± 0%   292.1k ± 0%  -0.11% (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-12             17.00 ± 0%    17.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-12             17.00 ± 0%    17.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-12            17.00 ± 0%    17.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-12            17.00 ± 0%    17.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-12            17.00 ± 0%    17.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-12           17.00 ± 0%    17.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-12         22.12k ± 0%   22.12k ± 0%       ~ (p=0.275 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12         54.21k ± 0%   54.21k ± 0%  -0.00% (p=0.004 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-12        84.30k ± 0%   84.30k ± 0%  -0.01% (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-12        62.34k ± 0%   62.32k ± 0%  -0.03% (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-12        94.77k ± 0%   94.75k ± 0%       ~ (p=0.113 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12       125.1k ± 0%   125.1k ± 0%       ~ (p=0.673 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-12         74.28k ± 0%   73.28k ± 0%  -1.35% (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-12         109.4k ± 0%   109.4k ± 0%  -0.01% (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-12        140.5k ± 0%   140.5k ± 0%  -0.02% (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-12        94.89k ± 0%   93.88k ± 0%  -1.07% (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-12        130.3k ± 0%   130.2k ± 0%  -0.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:_10-12       161.6k ± 0%   161.5k ± 0%  -0.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:_0-12      96.56k ± 0%   95.55k ± 0%  -1.04% (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-12      164.0k ± 0%   163.9k ± 0%  -0.02% (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-12     225.4k ± 0%   225.3k ± 0%  -0.03% (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-12     161.1k ± 0%   160.1k ± 0%  -0.62% (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-12     230.0k ± 0%   230.0k ± 0%       ~ (p=0.452 n=6)
FromMetrics/resource_attribute_count:_5/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12    292.4k ± 0%   292.1k ± 0%  -0.11% (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-12            64.00 ± 0%    64.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_5-12            64.00 ± 0%    64.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_10-12           64.00 ± 0%    64.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_0-12           64.00 ± 0%    64.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_5-12           64.00 ± 0%    64.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_0/labels_per_metric:_20/exemplars_per_series:_10-12          64.00 ± 0%    64.00 ± 0%       ~ (p=1.000 n=6) ¹
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_0-12        22.17k ± 0%   22.17k ± 0%       ~ (p=1.000 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_5-12        54.26k ± 0%   54.26k ± 0%       ~ (p=0.567 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_2/exemplars_per_series:_10-12       84.36k ± 0%   84.35k ± 0%  -0.00% (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-12       62.40k ± 0%   62.39k ± 0%       ~ (p=0.719 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_5-12       94.82k ± 0%   94.83k ± 0%       ~ (p=0.916 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_0/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12      125.2k ± 0%   125.2k ± 0%       ~ (p=0.606 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_0/labels_per_metric:_2/exemplars_per_series:_0-12        74.33k ± 0%   73.33k ± 0%  -1.34% (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-12        109.4k ± 0%   109.4k ± 0%  -0.01% (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-12       140.5k ± 0%   140.5k ± 0%  -0.01% (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-12       94.94k ± 0%   93.94k ± 0%  -1.05% (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-12       130.3k ± 0%   130.3k ± 0%  -0.03% (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-12      161.7k ± 0%   161.6k ± 0%  -0.04% (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-12     96.61k ± 0%   95.61k ± 0%  -1.04% (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-12     164.0k ± 0%   164.0k ± 0%  -0.03% (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-12    225.5k ± 0%   225.4k ± 0%  -0.03% (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-12    161.2k ± 0%   160.2k ± 0%  -0.62% (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-12    230.0k ± 0%   230.0k ± 0%       ~ (p=0.786 n=6)
FromMetrics/resource_attribute_count:_50/histogram_count:_1000/non-histogram_count:_1000/labels_per_metric:_20/exemplars_per_series:_10-12   292.5k ± 0%   292.2k ± 0%  -0.11% (p=0.002 n=6)
geomean                                                                                                                                      25.36k        25.31k       -0.21%
¹ all samples are equal
```
</details>

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
  • Loading branch information
aknuds1 authored Feb 15, 2024
1 parent 2e5b00d commit fc70fff
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 67 deletions.
54 changes: 24 additions & 30 deletions pkg/translator/prometheusremotewrite/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
)

const (
nameStr = "__name__"
sumStr = "_sum"
countStr = "_count"
bucketStr = "_bucket"
Expand Down Expand Up @@ -70,15 +69,14 @@ func (a ByLabelName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
// tsMap will be unmodified if either labels or sample is nil, but can still be modified if the exemplar is nil.
func addSample(tsMap map[string]*prompb.TimeSeries, sample *prompb.Sample, labels []prompb.Label,
datatype string) string {

if sample == nil || labels == nil || tsMap == nil {
// This shouldn't happen
return ""
}

sig := timeSeriesSignature(datatype, &labels)
ts, ok := tsMap[sig]

if ok {
sig := timeSeriesSignature(datatype, labels)
ts := tsMap[sig]
if ts != nil {
ts.Samples = append(ts.Samples, *sample)
} else {
newTs := &prompb.TimeSeries{
Expand All @@ -95,7 +93,7 @@ func addSample(tsMap map[string]*prompb.TimeSeries, sample *prompb.Sample, label
// we only add exemplars if samples are presents
// tsMap is unmodified if either of its parameters is nil and samples are nil.
func addExemplars(tsMap map[string]*prompb.TimeSeries, exemplars []prompb.Exemplar, bucketBoundsData []bucketBoundsData) {
if tsMap == nil || bucketBoundsData == nil || exemplars == nil {
if len(tsMap) == 0 || len(bucketBoundsData) == 0 || len(exemplars) == 0 {
return
}

Expand All @@ -111,14 +109,10 @@ func addExemplar(tsMap map[string]*prompb.TimeSeries, bucketBounds []bucketBound
sig := bucketBound.sig
bound := bucketBound.bound

_, ok := tsMap[sig]
if ok {
if tsMap[sig].Samples != nil {
if exemplar.Value <= bound {
tsMap[sig].Exemplars = append(tsMap[sig].Exemplars, exemplar)
return
}
}
ts := tsMap[sig]
if ts != nil && len(ts.Samples) > 0 && exemplar.Value <= bound {
ts.Exemplars = append(ts.Exemplars, exemplar)
return
}
}
}
Expand All @@ -129,20 +123,20 @@ func addExemplar(tsMap map[string]*prompb.TimeSeries, bucketBounds []bucketBound
//
// the label slice should not contain duplicate label names; this method sorts the slice by label name before creating
// the signature.
func timeSeriesSignature(datatype string, labels *[]prompb.Label) string {
func timeSeriesSignature(datatype string, labels []prompb.Label) string {
length := len(datatype)

for _, lb := range *labels {
for _, lb := range labels {
length += 2 + len(lb.GetName()) + len(lb.GetValue())
}

b := strings.Builder{}
b.Grow(length)
b.WriteString(datatype)

sort.Sort(ByLabelName(*labels))
sort.Sort(ByLabelName(labels))

for _, lb := range *labels {
for _, lb := range labels {
b.WriteString("-")
b.WriteString(lb.GetName())
b.WriteString("-")
Expand All @@ -152,9 +146,9 @@ func timeSeriesSignature(datatype string, labels *[]prompb.Label) string {
return b.String()
}

// createAttributes creates a slice of Cortex Label with OTLP attributes and pairs of string values.
// Unpaired string value is ignored. String pairs overwrites OTLP labels if collision happens, and the overwrite is
// logged. Resultant label names are sanitized.
// createAttributes creates a slice of Prometheus Labels with OTLP attributes and pairs of string values.
// Unpaired string values are ignored. String pairs overwrite OTLP labels if collisions happen, and overwrites are
// logged. Resulting label names are sanitized.
func createAttributes(resource pcommon.Resource, attributes pcommon.Map, externalLabels map[string]string, extras ...string) []prompb.Label {
serviceName, haveServiceName := resource.Attributes().Get(conventions.AttributeServiceName)
instance, haveInstanceID := resource.Attributes().Get(conventions.AttributeServiceInstanceID)
Expand Down Expand Up @@ -184,8 +178,8 @@ func createAttributes(resource pcommon.Resource, attributes pcommon.Map, externa

for _, label := range labels {
var finalKey = prometheustranslator.NormalizeLabel(label.Name)
if existingLabel, alreadyExists := l[finalKey]; alreadyExists {
l[finalKey] = existingLabel + ";" + label.Value
if existingValue, alreadyExists := l[finalKey]; alreadyExists {
l[finalKey] = existingValue + ";" + label.Value
} else {
l[finalKey] = label.Value
}
Expand Down Expand Up @@ -269,7 +263,7 @@ func addSingleHistogramDataPoint(pt pmetric.HistogramDataPoint, resource pcommon
}

// sum, count, and buckets of the histogram should append suffix to baseName
labels = append(labels, prompb.Label{Name: nameStr, Value: baseName + nameSuffix})
labels = append(labels, prompb.Label{Name: model.MetricNameLabel, Value: baseName + nameSuffix})

return labels
}
Expand Down Expand Up @@ -361,7 +355,7 @@ func getPromExemplars[T exemplarType](pt T) []prompb.Exemplar {
exemplar := pt.Exemplars().At(i)
exemplarRunes := 0

promExemplar := &prompb.Exemplar{
promExemplar := prompb.Exemplar{
Value: exemplar.DoubleValue(),
Timestamp: timestamp.FromTime(exemplar.Timestamp().AsTime()),
}
Expand Down Expand Up @@ -404,7 +398,7 @@ func getPromExemplars[T exemplarType](pt T) []prompb.Exemplar {
promExemplar.Labels = append(promExemplar.Labels, labelsFromAttributes...)
}

promExemplars = append(promExemplars, *promExemplar)
promExemplars = append(promExemplars, promExemplar)
}

return promExemplars
Expand Down Expand Up @@ -467,7 +461,7 @@ func addSingleSummaryDataPoint(pt pmetric.SummaryDataPoint, resource pcommon.Res
labels = append(labels, prompb.Label{Name: extras[extrasIdx], Value: extras[extrasIdx+1]})
}

labels = append(labels, prompb.Label{Name: nameStr, Value: name})
labels = append(labels, prompb.Label{Name: model.MetricNameLabel, Value: name})

return labels
}
Expand Down Expand Up @@ -527,7 +521,7 @@ func addCreatedTimeSeriesIfNeeded(
timestamp pcommon.Timestamp,
metricType string,
) {
sig := timeSeriesSignature(metricType, &labels)
sig := timeSeriesSignature(metricType, labels)
if _, ok := series[sig]; !ok {
series[sig] = &prompb.TimeSeries{
Labels: labels,
Expand Down Expand Up @@ -568,7 +562,7 @@ func addResourceTargetInfo(resource pcommon.Resource, settings Settings, timesta
if len(settings.Namespace) > 0 {
name = settings.Namespace + "_" + name
}
labels := createAttributes(resource, attributes, settings.ExternalLabels, nameStr, name)
labels := createAttributes(resource, attributes, settings.ExternalLabels, model.MetricNameLabel, name)
sample := &prompb.Sample{
Value: float64(1),
// convert ns to ms
Expand Down
23 changes: 11 additions & 12 deletions pkg/translator/prometheusremotewrite/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ func Test_timeSeriesSignature(t *testing.T) {
// run tests
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
lbs := tt.lbs
assert.EqualValues(t, tt.want, timeSeriesSignature(tt.metric.Type().String(), &lbs))
assert.EqualValues(t, tt.want, timeSeriesSignature(tt.metric.Type().String(), tt.lbs))
})
}
}
Expand Down Expand Up @@ -691,19 +690,19 @@ func TestAddSingleSummaryDataPoint(t *testing.T) {
{Name: model.MetricNameLabel, Value: "test_summary" + sumStr},
}
return map[string]*prompb.TimeSeries{
timeSeriesSignature(pmetric.MetricTypeSummary.String(), &labels): {
timeSeriesSignature(pmetric.MetricTypeSummary.String(), labels): {
Labels: labels,
Samples: []prompb.Sample{
{Value: 0, Timestamp: convertTimeStamp(ts)},
},
},
timeSeriesSignature(pmetric.MetricTypeSummary.String(), &sumLabels): {
timeSeriesSignature(pmetric.MetricTypeSummary.String(), sumLabels): {
Labels: sumLabels,
Samples: []prompb.Sample{
{Value: 0, Timestamp: convertTimeStamp(ts)},
},
},
timeSeriesSignature(pmetric.MetricTypeSummary.String(), &createdLabels): {
timeSeriesSignature(pmetric.MetricTypeSummary.String(), createdLabels): {
Labels: createdLabels,
Samples: []prompb.Sample{
{Value: float64(convertTimeStamp(ts)), Timestamp: convertTimeStamp(ts)},
Expand Down Expand Up @@ -732,13 +731,13 @@ func TestAddSingleSummaryDataPoint(t *testing.T) {
{Name: model.MetricNameLabel, Value: "test_summary" + sumStr},
}
return map[string]*prompb.TimeSeries{
timeSeriesSignature(pmetric.MetricTypeSummary.String(), &labels): {
timeSeriesSignature(pmetric.MetricTypeSummary.String(), labels): {
Labels: labels,
Samples: []prompb.Sample{
{Value: 0, Timestamp: convertTimeStamp(ts)},
},
},
timeSeriesSignature(pmetric.MetricTypeSummary.String(), &sumLabels): {
timeSeriesSignature(pmetric.MetricTypeSummary.String(), sumLabels): {
Labels: sumLabels,
Samples: []prompb.Sample{
{Value: 0, Timestamp: convertTimeStamp(ts)},
Expand Down Expand Up @@ -802,19 +801,19 @@ func TestAddSingleHistogramDataPoint(t *testing.T) {
{Name: model.BucketLabel, Value: "+Inf"},
}
return map[string]*prompb.TimeSeries{
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), &infLabels): {
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), infLabels): {
Labels: infLabels,
Samples: []prompb.Sample{
{Value: 0, Timestamp: convertTimeStamp(ts)},
},
},
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), &labels): {
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), labels): {
Labels: labels,
Samples: []prompb.Sample{
{Value: 0, Timestamp: convertTimeStamp(ts)},
},
},
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), &createdLabels): {
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), createdLabels): {
Labels: createdLabels,
Samples: []prompb.Sample{
{Value: float64(convertTimeStamp(ts)), Timestamp: convertTimeStamp(ts)},
Expand Down Expand Up @@ -844,13 +843,13 @@ func TestAddSingleHistogramDataPoint(t *testing.T) {
{Name: model.BucketLabel, Value: "+Inf"},
}
return map[string]*prompb.TimeSeries{
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), &infLabels): {
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), infLabels): {
Labels: infLabels,
Samples: []prompb.Sample{
{Value: 0, Timestamp: convertTimeStamp(ts)},
},
},
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), &labels): {
timeSeriesSignature(pmetric.MetricTypeHistogram.String(), labels): {
Labels: labels,
Samples: []prompb.Sample{
{Value: 0, Timestamp: convertTimeStamp(ts)},
Expand Down
5 changes: 3 additions & 2 deletions pkg/translator/prometheusremotewrite/histograms.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ func addSingleExponentialHistogramDataPoint(
resource,
pt.Attributes(),
settings.ExternalLabels,
model.MetricNameLabel, metric,
model.MetricNameLabel,
metric,
)

sig := timeSeriesSignature(
pmetric.MetricTypeExponentialHistogram.String(),
&labels,
labels,
)
ts, ok := series[sig]
if !ok {
Expand Down
6 changes: 3 additions & 3 deletions pkg/translator/prometheusremotewrite/histograms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ func TestAddSingleExponentialHistogramDataPoint(t *testing.T) {
{Name: "attr", Value: "test_attr"},
}
return map[string]*prompb.TimeSeries{
timeSeriesSignature(pmetric.MetricTypeExponentialHistogram.String(), &labels): {
timeSeriesSignature(pmetric.MetricTypeExponentialHistogram.String(), labels): {
Labels: labels,
Histograms: []prompb.Histogram{
{
Expand Down Expand Up @@ -698,7 +698,7 @@ func TestAddSingleExponentialHistogramDataPoint(t *testing.T) {
}

return map[string]*prompb.TimeSeries{
timeSeriesSignature(pmetric.MetricTypeExponentialHistogram.String(), &labels): {
timeSeriesSignature(pmetric.MetricTypeExponentialHistogram.String(), labels): {
Labels: labels,
Histograms: []prompb.Histogram{
{
Expand All @@ -714,7 +714,7 @@ func TestAddSingleExponentialHistogramDataPoint(t *testing.T) {
{Value: 1},
},
},
timeSeriesSignature(pmetric.MetricTypeExponentialHistogram.String(), &labelsAnother): {
timeSeriesSignature(pmetric.MetricTypeExponentialHistogram.String(), labelsAnother): {
Labels: labelsAnother,
Histograms: []prompb.Histogram{
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/translator/prometheusremotewrite/metrics_to_prw.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Settings struct {
SendMetadata bool
}

// FromMetrics converts pmetric.Metrics to prometheus remote write format.
// FromMetrics converts pmetric.Metrics to Prometheus remote write format.
func FromMetrics(md pmetric.Metrics, settings Settings) (tsMap map[string]*prompb.TimeSeries, errs error) {
tsMap = make(map[string]*prompb.TimeSeries)

Expand Down
27 changes: 15 additions & 12 deletions pkg/translator/prometheusremotewrite/number_data_points.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"go.opentelemetry.io/collector/pdata/pmetric"
)

// addSingleSumNumberDataPoint converts the Gauge metric data point to a
// addSingleGaugeNumberDataPoint converts the Gauge metric data point to a
// Prometheus time series with samples and labels. The result is stored in the
// series map.
func addSingleGaugeNumberDataPoint(
Expand All @@ -28,7 +28,8 @@ func addSingleGaugeNumberDataPoint(
resource,
pt.Attributes(),
settings.ExternalLabels,
model.MetricNameLabel, name,
model.MetricNameLabel,
name,
)
sample := &prompb.Sample{
// convert ns to ms
Expand Down Expand Up @@ -78,24 +79,26 @@ func addSingleSumNumberDataPoint(
}
sig := addSample(series, sample, labels, metric.Type().String())

if ts, ok := series[sig]; sig != "" && ok {
if ts := series[sig]; sig != "" && ts != nil {
exemplars := getPromExemplars[pmetric.NumberDataPoint](pt)
ts.Exemplars = append(ts.Exemplars, exemplars...)
}

// add _created time series if needed
if settings.ExportCreatedMetric && metric.Sum().IsMonotonic() {
startTimestamp := pt.StartTimestamp()
if startTimestamp != 0 {
createdLabels := make([]prompb.Label, len(labels))
copy(createdLabels, labels)
for i, l := range createdLabels {
if l.Name == model.MetricNameLabel {
createdLabels[i].Value = name + createdSuffix
break
}
if startTimestamp == 0 {
return
}

createdLabels := make([]prompb.Label, len(labels))
copy(createdLabels, labels)
for i, l := range createdLabels {
if l.Name == model.MetricNameLabel {
createdLabels[i].Value = name + createdSuffix
break
}
addCreatedTimeSeriesIfNeeded(series, createdLabels, startTimestamp, pt.Timestamp(), metric.Type().String())
}
addCreatedTimeSeriesIfNeeded(series, createdLabels, startTimestamp, pt.Timestamp(), metric.Type().String())
}
}
Loading

0 comments on commit fc70fff

Please sign in to comment.