MetricsConfig

Struct MetricsConfig 

Source
pub struct MetricsConfig {
    pub addr: Option<String>,
    pub prefix: String,
    pub buffer_size: Option<usize>,
    pub tags: BTreeMap<String, String>,
}
Expand description

Configuration for the DogStatsD metrics exporter.

When addr is None, metrics are no-ops (the global recorder is never installed).

§Environment Variables

  • OS__METRICS__ADDR — StatsD address (e.g. 127.0.0.1:8125 or unixgram:///tmp/statsd.sock)
  • OS__METRICS__PREFIX — global metric name prefix
  • OS__METRICS__BUFFER_SIZE — maximum payload length in bytes
  • OS__METRICS__TAGS__KEY=value — per-key global tags

Fields§

§addr: Option<String>

Remote address to forward metrics to.

When None, metrics are disabled (the global recorder is not installed and all metric calls are no-ops).

For UDP, the address must be in the format <host>:<port> (e.g. 127.0.0.1:8125). For Unix domain sockets, use the format <scheme>://<path>, where the scheme is either unix (stream, SOCK_STREAM) or unixgram (datagram, SOCK_DGRAM).

§Default

None (metrics disabled)

§Environment Variable

OS__METRICS__ADDR

§prefix: String

Global prefix prepended to every metric name.

The prefix is prepended to every metric name, with a . separator added automatically.

§Default

"objectstore"

§Environment Variable

OS__METRICS__PREFIX

§buffer_size: Option<usize>

Maximum payload length in bytes.

Controls the maximum size per StatsD payload. Should match the Datadog Agent’s dogstatsd_buffer_size setting. If None, the exporter uses its default (1432 bytes for UDP, 8192 bytes for Unix sockets).

§Default

None (exporter default)

§Environment Variable

OS__METRICS__BUFFER_SIZE

§tags: BTreeMap<String, String>

Global tags applied to all metrics.

Key-value pairs attached to every emitted metric. Useful for identifying environment, region, or other deployment-specific dimensions.

§Default

Empty (no tags)

§Environment Variables

Each tag is set individually:

  • OS__METRICS__TAGS__FOO=foo
  • OS__METRICS__TAGS__BAR=bar

§YAML Example

metrics:
  tags:
    foo: foo
    bar: bar

Trait Implementations§

Source§

impl Clone for MetricsConfig

Source§

fn clone(&self) -> MetricsConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MetricsConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MetricsConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for MetricsConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for MetricsConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,