pub struct StatEvent {
pub name: String,
pub tags: BTreeMap<String, String>,
pub value: f64,
pub kind: StatKind,
}Expand description
A single stat datapoint with statsd-style semantics and named tags.
This is the wire type used both for local DogStatsD emission and for shipping batches from bridges/exits to the broker over RPC.
Fields§
§name: StringBTreeMap so that serialization is deterministic, which Mac authentication requires.
value: f64§kind: StatKindImplementations§
Source§impl StatEvent
impl StatEvent
pub fn counter(name: &str, tags: &[(&str, &str)], value: f64) -> StatEvent
pub fn gauge(name: &str, tags: &[(&str, &str)], value: f64) -> StatEvent
pub fn timer_ms(name: &str, tags: &[(&str, &str)], value: f64) -> StatEvent
Sourcepub fn dogstatsd_line(&self) -> String
pub fn dogstatsd_line(&self) -> String
Encodes as a single DogStatsD line, e.g. bridge_bytes:1048576|c|#pool:hk,country:CN.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StatEvent
impl<'de> Deserialize<'de> for StatEvent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StatEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StatEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for StatEvent
impl Serialize for StatEvent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for StatEvent
Auto Trait Implementations§
impl Freeze for StatEvent
impl RefUnwindSafe for StatEvent
impl Send for StatEvent
impl Sync for StatEvent
impl Unpin for StatEvent
impl UnsafeUnpin for StatEvent
impl UnwindSafe for StatEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more