Class RequestMetrics
public class RequestMetrics : IRequestMetrics
- Inheritance
-
RequestMetrics
- Implements
- Inherited Members
Constructors
RequestMetrics()
Constructs an empty, disabled metrics object
public RequestMetrics()
Properties
Counters
Counters being tracked
public Dictionary<Metric, long> Counters { get; set; }
Property Value
IsEnabled
Whether metrics are enabled for the request
public bool IsEnabled { get; }
Property Value
Properties
Collection of properties being tracked
public Dictionary<Metric, List<object>> Properties { get; set; }
Property Value
Timings
Timings for metrics being tracked
public Dictionary<Metric, List<IMetricsTiming>> Timings { get; set; }
Property Value
Methods
AddProperty(Metric, object)
Adds a property for a metric. If there are multiple, the object is added as a new item in a list.
public void AddProperty(Metric metric, object property)
Parameters
GetErrors()
Returns errors associated with the metric, including if there are still any timing events in-flight.
public string GetErrors()
Returns
IncrementCounter(Metric)
Increments a specific metric counter. If counter doesn't exist yet, it is set to 1.
public void IncrementCounter(Metric metric)
Parameters
metric
Metric
SetCounter(Metric, long)
Sets a counter for a specific metric.
public void SetCounter(Metric metric, long value)
Parameters
StartEvent(Metric)
Starts timing an event. Logs an exception if an event of the same type was started but not stopped.
public TimingEvent StartEvent(Metric metric)
Parameters
metric
Metric
Returns
StopEvent(Metric)
Stops timing an event. Logs an exception if the event wasn't started.
public Timing StopEvent(Metric metric)
Parameters
metric
Metric
Returns
ToJSON()
Return a JSON represenation of the current metrics
public string ToJSON()
Returns
ToString()
Returns a string representation of the current metrics.
public override string ToString()