All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
metrics
has been updated to v0.24 (#183) New feature flag:metrics-0_24
Removed feature flag:metrics-0_21
2.0.0 - 2024-07-25
opentelemetry
has been updated to v0.24 (#179)
New feature flags:opentelemetry-0_24
,exemplars-tracing-opentelemetry-0_25
Removed feature flags:opentelemetry-0_21
,exemplars-tracing-opentelemetry-0_22
If you are using these metrics library separately in your application in addition to Autometrics, ensure that you match the version that Autometrics uses.
1.0.1 - 2024-02-12
- Update
http
to1.0
. This fixes compatibility withaxum 0.7
(#167) - Explicitly set default timeout and period for the OTEL push exporter (#168)
- Fix a regression that made all compilation errors in instrumented code appear as located in
the
#[autometrics]
annotation instead of the original location (#170) - Add missing feature flag for otel-push-exporter (#172)
1.0.0 - 2023-12-01
opentelemetry
has been updated to v0.21 (#159)
New feature flags:opentelemetry-0_21
,exemplars-tracing-opentelemetry-0_22
Removed feature flags:opentelemetry-0_20
,exemplars-tracing-opentelemetry-0_20
,exemplars-tracing-opentelemetry-0_21
prometheus-client
has been updated to v0.22 (#160)
New feature flag:prometheus-client-0_22
Removed feature flag:prometheus-client-0_21
If you are using these metrics separately in your application in addition to Autometrics, ensure that you match the version that Autometrics uses.
- New exporter,
otel_push_exporter
is now available in addition to the existingprometheus_exporter
. It can be used to push metrics in the OTEL format via HTTP or gRPC to a OTEL-collector-(compatible) server. - Update to
syn
v2 (#145) - Add support for tracing-opentelemetry v0.21 (#147)
- Error messages when using
#[autometrics]
together with#[async_trait]
has been improved (#149) - Fixed missing feature flag for
opentelemetry-otlp
when autometrics featureotel-push-exporter
is enabled - Fixed incorrect duration being recorded when using
#[async_trait]
together with#[autometrics]
(#161)
Please note that the#[autometrics]
macro needs to be defined BEFORE#[async_trait]
. - Fixed value of the
result
label being empty when the function is annotated with#[async_trait]
(#161) - Fixed
#[async_trait]
not being correctly detected if its re-exported in another crate (#164)
The Autometrics specification v1.0.0 has been released. The following changes are made in order to bring the release in compliance with the spec:
- Added
repository.url
andrepository.provider
asbuild_info
labels. They can be configured either through environment variables or automatically based on yourCargo.toml
package.repository
value (only GitHub, GitLab and BitBucket) (#152) - Added
autometrics.version
asbuild_info
label, specifying the autometrics spec version that we are targeting. It is currently hardcoded to1.0.0
(#154) - Environment variables for
repository.url
andrepository.provider
will now be read at both compile time and runtime (#156)
0.6.0 - 2023-08-08
- Autometrics settings can now be configured via
settings::AutometricsSettings::builder()
- A custom
Registry
can be used to collect metrics. This may be used to add custom metrics alongside those produced by Autometrics, as well as to export the metrics without using the providedprometheus_exporter
- All metrics now have a
service.name
label attached. This is set via the settings, via runtime environment variable (AUTOMETRICS_SERVICE_NAME
orOTEL_SERVICE_NAME
), or it falls back to the crate name defined in theCargo.toml
- Function counters are initialized to zero in debug builds. This exposes details of instrumented functions to Prometheus and visualization tools built on top of it, before the functions have been called.
- Basic benchmarking
- Renamed the
function.calls.count
metric tofunction.calls
(which is exported to Prometheus asfunction_calls_total
) to be in line with OpenTelemetry and OpenMetrics naming conventions. Dashboards and alerting rules must be updated. - When the
function.calls.duration
histogram is exported to Prometheus, it now includes the units (function_calls_duration_seconds
) to be in line with Prometheus/OpenMetrics naming conventions. Dashboards and alerting rules must be updated. - Struct methods now have the struct name as part of the
function
label on the metrics (for example,MyStruct::my_method
) - The
caller
label on thefunction.calls
metric was replaced withcaller.function
andcaller.module
- The
custom-objective-latency
feature can now be used with theprometheus-exporter
, as well as with theprometheus
andprometheus-client
crates, because the histogram buckets can now be configured via the settings - Upgraded
opentelemetry
to v0.20
metrics
feature flag (replaced withmetrics-0_21
)opentelemetry
feature flag (replaced withopentelemetry-0_20
)prometheus
feature flag (replaced withprometheus-0_13
)prometheus-client
feature flag (replaced withprometheus-client-0_21
)exemplars-tracing-opentelemetry
feature flag (replaced withexemplars-tracing-opentelemetry-0_20
)
encode_global_metrics
was removed and replaced byprometheus_exporter::encode_to_string
global_metrics_exporter
was removed and replaced byprometheus_exporter::init
backends::prometheus_client::REGISTRY
was removed. TheRegistry
used with theprometheus-client
backend can now be accessed viaAutometricsSettings::prometheus_client_registry
- Return types on functions annotated with
#[autometrics]
containing genericimpl
types in their type arguments (fn() -> Result<impl ToString, impl std::error::Error>
) no longer fail to compile.
0.5.0 - 2023-06-02
- Support the official
prometheus-client
crate for producing metrics - Support exemplars when using the feature flags
exemplars-tracing
orexemplars-tracing-opentelemetry
. Autometrics can now extract fields from the current span and attach them as exemplars on the counter and histogram metrics ResultLabels
derive macro allows to specify on an enum whether variants should always be "ok", or "error" for the success rate metrics of functions using them. (#61)- The
prometheus_exporter
module contains all functions related to theprometheus-exporter
feature prometheus_exporter::encode_http_response
function returns anhttp::Response
with the metrics. This is especially recommended when using exemplars, because it automatically uses the OpenMetricsContent-Type
header, which is required for Prometheus to scrape metrics with exemplarsAUTOMETRICS_DISABLE_DOCS
environment variable can be set to disable doc comment generation (this is mainly for use with editor extensions that generate doc comments themselves)
- Users must configure the metrics library they want to use autometrics with, unless the
prometheus-exporter
feature is enabled. In that case, the officialprometheus-client
will be used - Metrics library feature flags are now mutually exclusive (previously,
autometrics
would only produce metrics using a single metrics library if multiple feature flags were enabled, using a prioritization order defined internally) GetLabels
trait (publicly exported but meant for internal use) changed the signature of its function to accomodate the newResultLabels
macro. This change is not significant if you never importedautometrics::__private
manually (#61)- When using the
opentelemetry
together with theprometheus-exporter
, it will no longer use the default registry provided by theprometheus
crate. It will instead use a new registry - Updated
opentelemetry
dependencies to v0.19. This means that users using autometrics withopentelemetry
but not using theprometheus-exporter
must update theopentelemetry
to use v0.19.
global_metrics_exporter
andencode_global_metrics
have been deprecated and replaced byprometheus_exporter::init
andprometheus_exporter::encode_to_string
, respectively
opentelemetry
is no longer used by defaultGetLabelsForResult
trait (publicly exported but meant for internal use) was removed to accomodate the newResultLabels
macro. This change is not significant if you never importedautometrics::__private
manually (#61)
#[autometrics]
now works on functions that use type inference in their return statement (#74, #61)
0.4.1 - 2023-05-05
- Overhaul documentation
- Generated latency query needs additional labels to show lines for 95th and 99th percentiles
0.4.0 - 2023-04-26
build_info
metric tracks software version and commit- Queries now use
build_info
metric to correlate version info with problems
- Prometheus rules handle when the counter metric name has a
_total
suffix
0.3.3 - 2023-04-14
- Alerts have minimum traffic threshold of 1 request / minute
- Latency SLO total query in alerting rules
0.3.1 - 2023-03-21
custom-objective-latency
andcustom-objective-percentile
feature flags
- Use the OpenTelemetry default histogram buckets
- Remove the latency objective values for 150, 200, and 350 milliseconds
custom-objectives
feature flag
0.3.0 - 2023-03-14
- Support defining Service-Level Objectives (SLOs) in code
- CLI to generate Sloth file, which is then used to generate Prometheus alerting rules
#[skip_autometrics]
annotation when applying autometrics to animpl
blockok_if
anderror_if
autometrics parameters
0.2.4 - 2023-02-08
- Histogram buckets
0.2.3 - 2023-01-31
- Building of documentation on docs.rs
0.2.0 - 2023-01-31
- Support
opentelemetry
andmetrics
crates for tracking metrics - Support applying autometrics to an
impl
block
- Tracking function concurrency is optional
0.1.1 - 2023-01-27
- Track concurrent requests
- Add return types as labels
- Separate function call counter
caller
label
- Use OpenTelemetry metric naming conventions