21.173. Class FunctionExecutionMetrics<TIns>

Namespace: ArmoniK.Core.Common.Meter
Assembly: ArmoniK.Core.Common.dll

Provides metrics collection for function execution, tracking both count and duration.

public class FunctionExecutionMetrics<TIns>

21.173.1. Type Parameters

TIns

The type whose methods will be measured.

21.173.2. Inheritance

objectFunctionExecutionMetrics<TIns>

21.173.3. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

21.173.4. Remarks

This class creates and manages counters and histograms for method calls, allowing automatic instrumentation of methods with minimal code changes. The metrics include both invocation counts and execution durations.

21.173.5. Constructors

21.173.5.1. FunctionExecutionMetrics(MeterHolder)

Initializes a new instance of the class.

public FunctionExecutionMetrics(MeterHolder holder)

21.173.5.1.1. Parameters

holder MeterHolder

The meter holder that provides the meter and common tags.

21.173.6. Methods

21.173.6.1. CountAndTime(string)

Creates metrics for a method call and starts timing its execution.

public IDisposable CountAndTime(string callerName = "")

21.173.6.1.1. Parameters

callerName string

The name of the calling method, automatically populated by the compiler when using the .

21.173.6.1.2. Returns

IDisposable

An that, when disposed, will record the method’s completion and update the relevant metrics.

21.173.6.1.3. Remarks

This method is designed to be used with a using statement at the start of a method:

using var _ = metrics.CountAndTime();