All notable changes to this project will be documented in this file.
- Compatibility with
axum = "0.8"
. This also updatesmatchit
to0.8
, changing how group pattern are described: for example,with_group_patterns_as("/foo", &["/foo/:bar"])
needs to be changed towith_group_patterns_as("/foo", &["/foo/{bar}"])
. The metrics values are also impacted: for example, the value"/foo/:bar"
is now"/foo/{bar}"
. [#69]
- Fixed the long-standing pending requests metric leak. [#74]
0.7.0 - 2024-07-20
MakeDefaultHandle::make_default_handle
now takesself
as argument. This allows custom implementor structs to hold non-static data. [#49]- Change the default initialization of
PrometheusHandle
to prevent unbounded memory growth of histograms. [#52] - Bump
metrics
to0.23
,metrics-exporter-prometheus
to0.15
. [#52] - Document MSRV as 1.70 currently. [#52]
GenericMetricLayer::pair_from
to initialize from a concrete struct.GenericMetricLayer::pair
now requires that the handle type implementsDefault
. [#49]BaseMetricLayer
that serves a more lightweight alternative toGenericMetricLayer
. [#56]
0.6.1 - 2024-01-23
- Disabled the
"push-gateway"
feature inmetrics-exporter-prometheus
by default, and added a way to enable it via the same name underaxum_prometheus
. This change ensures that this crate can still be built without openssl support, see here. [#44] - Update examples to
metrics-exporter-prometheus
to0.13
andmetrics
to0.22
. [#43]
0.6.0 - 2024-01-22
- Update
metrics-exporter-prometheus
to0.13
andmetrics
to0.22
. [#39]
0.5.0 - 2023-11-27
- Support for response body size metric, which can be turned on via
PrometheusMetricLayerBuilder::enable_response_body_size
. [#33] - All metrics now are initialized via
metrics::describe_*
function by default, but can be turned off withPrometheusMetricLayerBuilder::no_initialize_metrics
. [#33] - Compatibility with
http-body = "1.0"
andaxum = "0.7"
. [#36]
- The lower-level Lifecycle API has changed: separated the
OnBodyChunk
trait, which is ran when a response body chunk has been generated. [#\33]
0.4.0 - 2023-07-24
- Support for different exporters than Prometheus. Developers now allowed to use their own exporter - as long as it's using the
metrics.rs
ecosystem. This is meant to be a non-breaking change - if you're using Prometheus, you shouldn't notice any changes in the public API. If you do however, please file an issue! #28 - An example showcasing
StatsD
exporter #28 - Simple snapshot tests #28
- Utility functions to get metric names at runtime #28
- Previous attempts to fix
PrometheusMetricBuilder::with_prefix
in 0.3.4 were not complete, this is now fully addressed. #28
0.3.4 - 2023-07-16
PrometheusMetricBuilder::with_prefix
is now properly setting the metric prefix, and the metric handle also takes that prefix into account. Previously the metric initialization incorrectly ignored the prefix, which caused the requests duration histogram to usequantile
instead ofle
labels.
0.3.3 - 2023-05-02
- Update
metrics-exporter-prometheus
to0.12
andmetrics
to0.21
.
0.3.2 - 2023-03-25
- The status code of the response is now captured in the total requests counter metric.
0.3.1 - 2023-02-16
with_prefix
toPrometheusMetricLayerBuilder
, which can be used to rename the default prefix (axum
) for all metrics. This is especially useful when working with cargo workspaces that has more than oneaxum_prometheus
instance (since environment variables don't work there).
0.3.0 - 2023-01-04
-
Routing patterns can be ignored, and grouped together when reporting to Prometheus.
-
Endpoint label behavior can be altered with the new
EndpointLabel
enum. -
Added a new builder
PrometheusMetricLayerBuilder
to easily customize these.let (prometheus_layer, metric_handle) = PrometheusMetricLayerBuilder::new() // ignore reporting requests that match "/foo" or "/sensitive" .with_ignore_patterns(&["/foo", "/sensitive"]) // if the any of the second argument matches, report them at the `/bar` endpoint .with_group_patterns_as("/bar", &["/foo/:bar", "/foo/:bar/:baz"]) // use `axum::extract::MatchedPath`, and if that fails, use the exact requested URI .with_endpoint_label_type(EndpointLabel::MatchedPath) .with_default_metrics() .build_pair();
-
A builder-example and an endpoint-type-example.
-
The metric names can be changed by setting some environmental variables at compile time. It is best to set these in the
config.toml
(note this is not the same file asCargo.toml
):[env] AXUM_HTTP_REQUESTS_TOTAL = "my_app_requests_total" AXUM_HTTP_REQUESTS_DURATION_SECONDS = "my_app_requests_duration_seconds" AXUM_HTTP_REQUESTS_PENDING = "my_app_requests_pending"
0.2.0 - 2022-10-25
- Compatibility with
axum-core = "0.3"
and thusaxum = "0.6"
.
First version.