When compiled with `-tags stringlabels`, the names and values point into
a larger block of memory containing all labels. Garbage-collection
considers the entire block "live" if you point to a part of it, so the
map ends up retaining all labels for (nearly) all series.
Cloning the string value avoids this problem, and we check first if the
value is already in the map. Since the clone is more expensive, only do
it when built with `-tags stringlabels`.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
* Optimize labelValues when matchers select small number of series.
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
* Address review feedback.
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
* Add missing p.Err()
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
* Reuse existing slice with all label values.
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
* Simplify check for expanded postings.
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
* Fix comment.
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
---------
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
Version 2 introduced a breaking change in the `id` field of all
resources. They were changed from `int` to `int64` to make sure that all
future numerical IDs are supported on all architectures.
You can learn more about this
[here](https://docs.hetzner.cloud/#deprecation-notices-%E2%9A%A0%EF%B8%8F)
Signed-off-by: Julian Tölle <julian.toelle@hetzner-cloud.de>
InstanceSpec struct members are untyped integers, so they can overflow
on 32-bit arch when bit-shifted left.
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
The problem was the following:
When trying to parse native histograms and classic histograms in
parallel, the parser would first parse the histogram proto messages as
a native histogram and then parse the same message again, but now as a
classic histogram. Afterwards, it would forget that it was dealing
with a metric family that contains native histograms and would parse
the rest of the metric family as classic histograms only. The fix is
to check again after being done with a classic histogram.
Signed-off-by: beorn7 <beorn@grafana.com>
* Add function for iterating through all buckets in reverse to find max bucket
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* enhance histogram_quantile to get min/max value
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
---------
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: Carrie Edwards <edwrdscarrie@gmail.com>
Snappy remains as the default compression but there is now a flag to switch
the compression algorithm.
Signed-off-by: Justin Lei <justin.lei@grafana.com>