client_golang/api
beorn7 2236d782ff api: Extend and improve json-iterator usage
For one, this pulls up the histogram-related json-iterator usage from
prometheus/common into the API client. Previously, the only
json-iterater usage was here in the API client. But then json-iterator
was used for the native histogram additions directly in
prometheus/common, see
https://github.com/prometheus/common/pull/440/files . This however
meant that any user of prometheus/common/model would now link in
json-iterator, even if they are not using the JSON marshaling at
all. To keep prometheus/common/model more leightweight, this commit
moves all the json-iterator usage into the API client itself, as it
was done before for the normal float samples.

This commit also adds an unmarshaling function for native histograms,
which didn't even exist in prometheus/common/model so far.

It also adds json-iterator marshaling and un-marshaling for
model.SampleStream, which is only needed for the benchmark
(BenchmarkSamplesJsonSerialization). This fixes the benchmark such
that it actually compares json-iterator and std-lib json encoding
(which didn't work before because the custom marshaling methods of
model.SampleStream enforced std-lib json encoding for floats and
json-iterator encoding for histograms in all cases).

I expect this to fix #1179.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-03-01 17:27:33 +01:00
..
prometheus/v1 api: Extend and improve json-iterator usage 2023-03-01 17:27:33 +01:00
client.go fix assorted oddities found by golangci-lint (#1040) 2022-08-03 06:30:51 +02:00
client_test.go Enable same linters as the Prometheus repo itself (#1056) 2022-06-17 09:04:06 +02:00