TaskHub.Shared

Histogram Metric

A Histogram is a metric that samples observations and counts them in configurable buckets. It is used to measure the distribution of values, such as request latencies or payload sizes.

Factory

IHistogramMetricFactory is an extension of IMetricServiceFactory that provides methods to create and manage Histogram metrics services.

public interface IHistogramMetricFactory : IMetricServiceFactory<IHistogramMetric>;

Service

IHistogramMetricService provides methods to interact with Counter metrics.

public interface IHistogramMetric : IMetricService
{
    Prometheus.ITimer Measure();
    Prometheus.ITimer Measure(params (string key, string value)[] labels);
}

Usage

public class SomeClass(IHistogramMetric metric)
{
	public void SomeMethod1()
	{
		metric.Measure();
	}
	public void SomeMethod2()
	{
		metric.Measure(("label1", "value1"), ("label2", "value2"));
	}
}