Skip to main content

Callback

Type Alias Callback 

Source
pub type Callback<T> = Box<dyn Fn(&dyn AsyncInstrument<T>) + Send + Sync>;
Expand description

A function registered with a Meter that makes observations for the instruments it is registered with.

The async instrument parameter is used to record measurement observations for these instruments.

The function needs to complete in a finite amount of time.

§Panics

Callbacks should avoid panicking. The SDK does not currently isolate or recover from panics occurring within observable callbacks. If an operation inside a callback can panic, the caller should catch the panic or handle the error within the callback.

Aliased Type§

pub struct Callback<T>(/* private fields */);