Class MetricCounter<T>
- Namespace
- Temporalio.Common
- Assembly
- Temporalio.dll
Metric for adding values as a counter.
public abstract class MetricCounter<T> : Metric<T> where T : struct
Type Parameters
TType of value for the metric.
- Inheritance
-
Metric<T>MetricCounter<T>
- Inherited Members
Constructors
MetricCounter(string, string?, string?)
Initializes a new instance of the MetricCounter<T> class.
protected MetricCounter(string name, string? unit = null, string? description = null)
Parameters
namestringThe name of the counter.
unitstringThe optional unit of measurement for the values recorded by the counter.
descriptionstringThe optional description of the counter.
Methods
Add(T, IEnumerable<KeyValuePair<string, object>>?)
Add the given value to the counter.
public abstract void Add(T value, IEnumerable<KeyValuePair<string, object>>? extraTags = null)
Parameters
valueTValue to add. Currently this can only be a positive integer.
extraTagsIEnumerable<KeyValuePair<string, object>>Extra tags if any. If this is called multiple times with the same tags, use WithTags(IEnumerable<KeyValuePair<string, object>>) for better performance.
WithTags(IEnumerable<KeyValuePair<string, object>>)
Create a new counter with the given tags.
public abstract MetricCounter<T> WithTags(IEnumerable<KeyValuePair<string, object>> tags)
Parameters
tagsIEnumerable<KeyValuePair<string, object>>Tags to append to existing tags.
Returns
- MetricCounter<T>
New counter.