Skip to main content

Crate metricus_macros

Crate metricus_macros 

Source
Expand description

§metricus-macros

Contains macros.

Attribute Macros§

counter
The counter attribute macro instruments a function with a metrics counter, allowing you to measure how many times a function is called. It requires to specify measurement name under which the count will be recorded. It also accepts optional tags represented as comma-separated list of key-value tuples such as tags(key1 = "value1", key2 = "value2"). The function name (fn_name) is automatically added as a tag, so there is no need to include it manually. All keys must be unique.
counter_with_id
The counter_with_id attribute macro instruments a function with a metrics counter with a user supplied id. This can be useful to provide instrumentation for memory allocators where we need to ‘defer’ metric registration until the backend has been registered.
span
The span attribute macro instruments a function with a metrics span that will be recorded using a histogram, allowing you to measure how long a given function took to execute in nanoseconds. It requires to specify measurement name under which the count will be recorded. It also accepts optional tags represented as comma-separated list of key-value tuples such as tags(key1 = "value1", key2 = "value2"). The function name (fn_name) is automatically added as a tag, so there is no need to include it manually. All keys must be unique.