Macro cadence_macros::statsd_set [−][src]
Emit a set using the default global client, optionally with tags
The set will use the prefix from the default global client combined with the provided key.
Any errors encountered sending metrics will be handled by the error handler registered with the default global client. This error handler is a no-op unless explicitly set. Callers should set the error handler for the default client if you wish to handle these errors (by logging them or something similar).
Panics
This macro will panic if the default global client has not been set when
it is invoked (via cadence_macros::set_global_default
).
Examples
use cadence::{StatsdClient, NopMetricSink}; use cadence_macros::statsd_set; let client = StatsdClient::builder("my.prefix", NopMetricSink) .with_error_handler(|e| { eprintln!("metric error: {}", e) }) .build(); cadence_macros::set_global_default(client); // "my.prefix.some.set:123|s" statsd_set!("some.set", 123); // "my.prefix.some.set:123|s|#tag:val" statsd_set!("some.set", 123, "tag" => "val"); // "my.prefix.some.set:123|s|#tag:val,another:thing" statsd_set!("some.set", 123, "tag" => "val", "another" => "thing");
Limitations
Only key-value style tags are supported. Value style tags are not
supported, e.g. builder.with_tag_value("val")
.