logo
pub struct BasicController(_);
Available on crate feature metrics only.
Expand description

Organizes and synchronizes collection of metric data in both “pull” and “push” configurations.

This supports two distinct modes:

  • Push and Pull: start must be called to begin calling the exporter; collect is called periodically after starting the controller.
  • Pull-Only: start is optional in this case, to call collect periodically. If start is not called, collect can be called manually to initiate collection.

The controller supports mixing push and pull access to metric data using the InstrumentationLibraryReader interface.

Implementations

This begins a ticker that periodically collects and exports metrics with the configured interval.

This is required for calling a configured MetricsExporter (see BasicControllerBuilder::with_exporter) and is otherwise optional when only pulling metric data.

The passed in context is passed to collect and subsequently to asynchronous instrument callbacks. Returns an error when the controller was already started.

Note that it is not necessary to start a controller when only pulling data; use the collect and try_for_each methods directly in this case.

This waits for the background worker to return and then collects and exports metrics one last time before returning.

The passed context is passed to the final collect and subsequently to the final asynchronous instruments.

Note that stop will not cancel an ongoing collection or export.

true if the controller was started via start, indicating that the current Reader is being kept up-to-date.

Requests a collection.

The collection will be skipped if the last collection is aged less than the configured collection period.

Get a reference to the current resource.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

ForEach calls the passed function once per instrumentation library, allowing the caller to emit metrics grouped by the library that produced them. Read more

Creates an implementation of the Meter interface. Read more

Creates a named Meter instance.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.