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

api: Extend and improve json-iterator usage #1225

Merged
merged 1 commit into from
Mar 1, 2023
Merged

api: Extend and improve json-iterator usage #1225

merged 1 commit into from
Mar 1, 2023

Commits on Mar 1, 2023

  1. 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>
    beorn7 committed Mar 1, 2023
    Configuration menu
    Copy the full SHA
    2236d78 View commit details
    Browse the repository at this point in the history