Instrumented
instrumented provides an attribute macro that enables instrumentation of
functions for use with Prometheus.
This crate is largely based on the log-derive crate, and
inspired by the metered crate.
To get started, add the [instrumented_codegen::instrument] proc macro to any function you
want to instrument. Have a look in the example directory for a full usage.
Configuring
You can specify the global metrics prefix with the METRICS_PREFIX env var,
and provide default labels with the METRICS_LABELS env var, which accepts a
command separated list of label=value pairs. For example:
METRICS_PREFIX=myapp
METRICS_LABELS=app=myapp,env=prod,region=us
Example
extern crate instrumented;
extern crate log;
extern crate reqwest;
use instrument;
// Logs at warn level with the `special` context.
;
// Logs result at info level
// Logs result at debug level