Metrics.NET by iulian.margarintescu, The Recognos Metrics.NET Team

<PackageReference Include="Metrics.NET" Version="0.5.5" />

 MetricsContext

Represents a logical grouping of metrics

Exposes advanced operations that are possible on this metrics context.

Returns a metrics data provider capable of returning the metrics in this context and any existing child contexts.

MetricsContext Context(string contextName)

Create a new child metrics context. Metrics added to the child context are kept separate from the metrics in the parent context.

MetricsContext Context(string contextName, Func<string, MetricsContext> contextCreator)

Create a new child metrics context. Metrics added to the child context are kept separate from the metrics in the parent context.

Counter Counter(string name, Unit unit, MetricTags tags = default)

A counter is a simple incrementing and decrementing 64-bit integer. Ex number of active requests.

void Gauge(string name, Func<double> valueProvider, Unit unit, MetricTags tags = default)

A gauge is the simplest metric type. It just returns a value. This metric is suitable for instantaneous values.

Histogram Histogram(string name, Unit unit, SamplingType samplingType = 0, MetricTags tags = default)

A Histogram measures the distribution of values in a stream of data: e.g., the number of results returned by a search.

Meter Meter(string name, Unit unit, TimeUnit rateUnit = 3, MetricTags tags = default)

A meter measures the rate at which a set of events occur, in a few different ways. This metric is suitable for keeping a record of now often something happens ( error, request etc ).

void PerformanceCounter(string name, string counterCategory, string counterName, string counterInstance, Unit unit, MetricTags tags = default)

Register a performance counter as a Gauge metric.

void ShutdownContext(string contextName)

Remove a child context. The metrics for the child context are removed from the MetricsData of the parent context.

Timer Timer(string name, Unit unit, SamplingType samplingType = 0, TimeUnit rateUnit = 3, TimeUnit durationUnit = 2, MetricTags tags = default)

A timer is basically a histogram of the duration of a type of event and a meter of the rate of its occurrence. Histogram and Meter