PackageTrack
Sign in Get early access

prometheus-http-query

Prometheus HTTP API client

0.9.0 5.6M downloads/mo #4315 most downloaded on crates.io puetzp/prometheus-http-query

What this package is like to depend on

Last release 3 months ago

09 May 2026

Ships unpredictably

gaps range from 2 weeks to 2.1 years

Some releases are documented

notes for 14 of 29 stable releases

1 version withdrawn

withdrawn after publishing

5 years old

30 releases · first in 2021

1 release in the last 12 months

see the full history below

Release timeline

30 releases · Apr 2021 to May 2026
2022 2023 2024 2025 2026
Release Pre-release Withdrawn

Releases

latest 30
  1. 0.9.0 09 May 2026
    Release notes

    See CHANGELOG

    Thank you @scvalex and @drbrain for the contributions!

    While the crate is not regularly updated anymore, I appreciate every PR created in this repository and try to merge contributions diligently.

    Open source →
    Release notes

    Added

    • Re-export reqwest to avoid having to manage multiple, possibly conflicting dependencies to the same crate in a user's Cargo.toml (thanks to @svcalex via pull request)

    Changed

    • Update reqwest in Cargo.toml to 0.13 (thanks to @drbrain via pull request)
    • Also contains the unreleased changes of 0.8.4
    Open source →
  2. 0.8.3 08 Apr 2024
    Release notes

    See CHANGELOG

    Thanks to @chris13524

    Open source →
    Release notes

    Changed

    • Bumped dependency reqwest to v12.x (@chris13524 via pull request)
    • Bumped dependency url to v2.5
    Open source →
  3. 0.8.2 30 Dec 2023
    Release notes

    See CHANGELOG

    Thanks to @alesharik !

    Open source →
    Release notes

    Added

    • InstantQueryBuilder::query
    • RangeQueryBuilder::query

    All changes by courtesy of @alesharik via pull request.

    Open source →
  4. 0.8.1 28 Dec 2023
    Release notes

    See CHANGELOG

    Thanks to @VoltaireNoir !

    Open source →
    Release notes

    Added

    • InstantQueryBuilder::get_raw
    • InstantQueryBuilder::post_raw
    • RangeQueryBuilder::get_raw
    • RangeQueryBuilder::post_raw
    • LabelNamesQueryBuilder::get_raw
    • LabelValuesQueryBuilder::get_raw
    • MetricMetadataQueryBuilder::get_raw
    • RulesQueryBuilder::get_raw
    • SeriesQueryBuilder::get_raw
    • TargetMetadataQueryBuilder::get_raw

    All changes by courtesy of @VoltaireNoir via pull request.

    Open source →
  5. 0.8.0 09 Dec 2023
    Release notes

    See CHANGELOG

    Thanks to @VoltaireNoir !

    Open source →
    Release notes

    Added

    • Derive Copy on Sample
    • Data::as_vector_mut
    • Data::as_matrix_mut
    • Data::as_scalar_mut
    • Data::into_vector
    • Data::into_matrix
    • Data::into_sample
    • PromqlResult::into_inner

    Changed

    • Data::as_vector returns Option<&Vec<InstantVector>> now
    • Data::as_matrix returns Option<&Vec<RangeVector>> now

    Note that this is technically a breaking release due to the altered function signatures of the two functions above. These functions formerly returned Option<&[InstantVector]>. However thanks to Rust's type coercions rules the changes are actually not expected to break any code, since the returned vector is yet again coerced to a slice when accessed immutably.

    All changes by courtesy of @VoltaireNoir via pull request.

    Open source →
  6. 0.7.1 29 Oct 2023
    Release notes Open source →
    Release notes

    Added

    • ClientError::inner()
    • ParseUrlError::inner()
    Open source →
  7. 0.7.0 13 Oct 2023
    Release notes Open source →
    Release notes

    Added

    • RuleGroup::limit()
    • RuleGroup::last_evaluation()
    • RuleGroup::evaluation_time()
    • AlertingRule::last_evaluation()
    • AlertingRule::evaluation_time()
    • RecordingRule::last_evaluation()
    • RecordingRule::evaluation_time()
    • Rule::as_recording()
    • Rule::as_alerting()
    • impl Eq for RuleHealth
    • RuleHealth::is_good()
    • RuleHealth::is_bad()
    • RuleHealth::is_unknown()
    • impl Eq for AlertState
    • AlertState::is_inactive()
    • AlertState::is_pending()
    • AlertState::is_firing()
    • impl Eq for TargetHealth
    • TargetHealth::is_up()
    • TargetHealth::is_down()
    • TargetHealth::is_unknown()
    • impl Eq for MetricType
    • MetricType::is_counter()
    • MetricType::is_gauge()
    • MetricType::is_histogram()
    • MetricType::is_gauge_histogram()
    • MetricType::is_summary()
    • MetricType::is_info()
    • MetricType::is_stateset()
    • MetricType::is_unknown()
    • AlertingRule::keep_firing_for()
    • impl Eq for WalReplayState
    • WalReplayState::is_waiting()
    • WalReplayState::is_in_progress()
    • WalReplayState::is_done()

    Changed

    Among other changes some Client methods have been refactored and return "builders" (like Client::query and Client::query_range already did) to gradually build a query to the respective endpoint instead of having to pass a lot of arguments to a single function and also having to pass None a lot to use the "default" functionality of the given Prometheus API endpoint. The following Client methods were refactored in that fashion:

    • Client::rules()
    • Client::target_metadata()
    • Client::metric_metadata()
    • Client::series()
    • Client::label_names()
    • Client::label_values()

    Other changes include:

    • Renamed RuleType to RuleKind and its variants from Alert and Record to Alerting and Recording.
    • Alert::value() now returns f64.
    • Client::query, Client::query_range direct::query and direct::query_range now require the PromQl query string to implement std::fmt::Display instead of std::string::ToString.
    • Refactored deserialization of Prometheus server responses so the explicit dependency on serde_json could be removed.
    • Refactored the error module and some custom errors related to deserialization using serde::de::Error. The Error enum inside the error module now contains one variant less and existing error variants were improved by properly implementing std::error::Error::source(). Libraries like anyhow are now able to display more detailed error messages. This change is not breaking if you did not match on specific error enum variants before.
    • Client methods now return a more concise error if the server response (from Prometheus or an intermediate proxy) does not contain a Content-Type header identifying the payload as JSON, that is the media type from the response is not as expected.
    Open source →
  8. 0.6.7 30 Sep 2023
    Release notes Open source →
    Release notes

    Fixed

    • Fixes an issue where a Prometheus server sends an HTTP response with Content-Type: application/json; charset=utf-8 (see issue)
    Open source →
  9. 0.6.6 17 Apr 2023
    Release notes Open source →
    Release notes

    Added

    • InstantQueryBuilder::header and RangeQueryBuilder::header (see also PR #6, thank you @lasantosr)
    Open source →
  10. 0.6.5 27 Jan 2023
    Release notes Open source →
    Release notes

    Added

    • Added several feature flags pertaining to the client TLS configuration that match the feature flags of reqwest by the same name.
    Open source →
  11. 0.6.4 26 Jan 2023 withdrawn

    Nothing published for this version

  12. 0.6.3 20 Nov 2022
    Release notes

    Added

    • Client::is_server_healthy
    • Client::is_server_ready

    Changed

    • Update crate url to v2.3
    Open source →
  13. 0.6.2 23 Aug 2022
    Release notes

    Added

    • prometheus_http_query::error::ApiErrorType that corresponds to the error variants that are used within the Prometheus API code.

    Changed

    • prometheus_http_query::error::ApiError is now part of the public crate API and provides methods to inspect the cause of the error, e.g. ApiError::error_type, ApiError::is_timeout and ApiError::message.

    Fixed

    • Client methods now return the proper error variant when e.g. a reverse proxy acts as intermediary. This considers the following three cases:
      • Prometheus returns 2xx with JSON body -> JSON is parsed and function returns the result in a Result::Ok.
      • Prometheus returns 4xx or 5xx -> JSON is parsed and function returns the ApiError containing the error details within Result::Err.
      • A proxy cannot handle the request and responds with a 4xx or 5xx itself -> error is raised and function returns the wrapped reqwest::Error within Result::Err.
    Open source →
  14. 0.6.1 22 Aug 2022
    Release notes

    Fixed

    • All Client methods now properly return prometheus_http_query::error::ApiError when Prometheus responds with an HTTP 4xx and the error type and message are captured.

    Changed

    • Simplified JSON body parsing with serde (no API changes).
    Open source →
  15. 0.6.0 01 Aug 2022
    Release notes

    Changed

    • Client::query and Client::query_range now return builder types to add parameters to a request (e.g. timeout) before sending the request via InstantQueryBuilder::get or InstantQueryBuilder::post and their pendants in RangeQueryBuilder. The purpose is to reduce the number of parameters in e.g. Client::query and configure a request via a builder instead as the number of parameters will certainly increase in the future.
    • InstantQueryBuilder::get, InstantQueryBuilder::post and their RangeQueryBuilder pendants still return a Result<PromqlResult, _>, but the Promqlresult now contains data and stats. The former being the familiar collection of vectors or matrices, the latter the execution stats as returned by the HTTP API.
    • Client::base_url now returns Url
    • Move and rename PromqlResult::as_instant -> Data::as_vector
    • Move and rename PromqlResult::as_range -> Data::as_matrix
    • Move PromqlResult::as_scalar -> Data::as_scalar

    Added

    • InstantQueryBuilder and RangeQueryBuilder. Each allows to set additional optional parameters to a request (e.g. a timeout). Request can then be sent using HTTP GET (see InstantQueryBuilder::get) or POST (see InstantQueryBuilder::post).
    • InstantQueryBuilder::stats and RangeQueryBuilder::stats as the first new query parameter/builder method. Use it to request query execution stats from Prometheus as part of the PromqlResult when get or post are executed. See this pull request for details and background information.
    • PromqlResult::data
    • PromqlResult::stats
    Open source →
  16. 0.5.2 06 Jul 2022

    Nothing published for this version

  17. 0.5.1 29 Mar 2022

    Nothing published for this version

  18. 0.5.0 27 Mar 2022

    Nothing published for this version

  19. 0.4.2 18 Mar 2022

    Nothing published for this version

  20. 0.4.1 16 Mar 2022

    Nothing published for this version

  21. 0.4.0 09 Feb 2022

    Nothing published for this version

  22. 0.3.3 24 Jan 2022

    Nothing published for this version

  23. 0.3.2 22 Jan 2022

    Nothing published for this version

  24. 0.3.1 30 Dec 2021

    Nothing published for this version

  25. 0.3.0 10 Jul 2021

    Nothing published for this version

  26. 0.2.3 19 Jun 2021

    Nothing published for this version

  27. 0.2.2 18 Jun 2021

    Nothing published for this version

  28. 0.2.1 17 Jun 2021

    Nothing published for this version

  29. 0.2.0 17 Jun 2021

    Nothing published for this version

  30. 0.1.0 14 Apr 2021

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive