Struct metrics_exporter_tcp::TcpBuilder[][src]

pub struct TcpBuilder { /* fields omitted */ }
Expand description

Builder for creating and installing a TCP recorder/exporter.

Implementations

impl TcpBuilder[src]

pub fn new() -> TcpBuilder[src]

Creates a new TcpBuilder.

pub fn listen_address<A>(self, addr: A) -> TcpBuilder where
    A: Into<SocketAddr>, 
[src]

Sets the listen address.

The exporter will accept connections on this address and immediately begin forwarding metrics to the client.

Defaults to 0.0.0.0:5000.

pub fn buffer_size(self, size: Option<usize>) -> TcpBuilder[src]

Sets the buffer size for internal operations.

The buffer size controls two operational aspects: the number of metrics processed per iteration of the event loop, and the number of buffered metrics each client can hold.

This setting allows trading off responsiveness for throughput, where a smaller buffer size will ensure that metrics are pushed to clients sooner, versus a larger buffer size that allows us to push more at a time.

As well, the larger the buffer, the more messages a client can temporarily hold. Clients have a circular buffer implementation so if their buffers are full, metrics will be dropped as necessary to avoid backpressure in the recorder.

pub fn install(self) -> Result<(), Error>[src]

Installs the recorder and exporter.

An error will be returned if there’s an issue with creating the TCP server or with installing the recorder as the global recorder.

pub fn build(self) -> Result<TcpRecorder, Error>[src]

Builds and installs the exporter, but returns the recorder.

In most cases, users should prefer to use TcpBuilder::install to create and install the recorder and exporter automatically for them. If a caller is combining recorders, however, then this method allows the caller the flexibility to do so.

Trait Implementations

impl Default for TcpBuilder[src]

fn default() -> Self[src]

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

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

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

fn in_current_span(self) -> Instrumented<Self>[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.