Here is a rough implementation. It does not have docs yet
Example:
#[derive(Register, Default)]
struct Metrics {
/// This is my counter
my_counter: Counter,
nested: NestedMetrics,
#[register(skip)]
skipped: Counter,
#[register(unit = "bytes")]
custom_unit: Counter,
#[register(name = "my_custom_name")]
custom_name: Counter,
/// This will get ignored
#[register(help = "my custom help")]
custom_help: Counter,
}
#[derive(Register, Default)]
struct NestedMetrics {
/// This is my gauge
my_gauge: Gauge,
}
// Only if Metrics implements default
let metrics = Metrics::register_default(&mut registry);
let metrics = Metrics::default();
metrics.register(&mut registry);
Resolves #140 cc @mxinden
Here is a rough implementation. It does not have docs yet
Example: