21.166. 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.166.1. Type Parameters
TIns
The type whose methods will be measured.
21.166.2. Inheritance
21.166.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
21.166.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.166.5. Constructors
21.166.5.1. FunctionExecutionMetrics(MeterHolder)
Initializes a new instance of the
public FunctionExecutionMetrics(MeterHolder holder)
21.166.5.1.1. Parameters
holder MeterHolder
The meter holder that provides the meter and common tags.
21.166.6. Methods
21.166.6.1. CountAndTime(string)
Creates metrics for a method call and starts timing its execution.
public IDisposable CountAndTime(string callerName = "")
21.166.6.1.1. Parameters
callerName string
The name of the calling method, automatically populated by the compiler
when using the
21.166.6.1.2. Returns
An
21.166.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();