<PackageReference Include="OpenTelemetry" Version="1.9.0" />

OpenTelemetry.Metrics.MetricReader

public abstract class MetricReader : IDisposable
MetricReader base class.

Gets or sets the metric reader temporality preference.

protected MetricReader()

public bool Collect(int timeoutMilliseconds = -1)

Attempts to collect the metrics, blocks the current thread until metrics collection completed, shutdown signaled or timed out. If there are asynchronous instruments involved, their callback functions will be triggered.

public void Dispose()

protected virtual void Dispose(bool disposing)

Releases the unmanaged resources used by this class and optionally releases the managed resources.

protected virtual bool OnCollect(int timeoutMilliseconds)

Called by Collect. This function should block the current thread until metrics collection completed, shutdown signaled or timed out.

protected virtual bool OnShutdown(int timeoutMilliseconds)

Called by Shutdown. This function should block the current thread until shutdown completed or timed out.

public bool Shutdown(int timeoutMilliseconds = -1)

Attempts to shutdown the processor, blocks the current thread until shutdown completed or timed out.