Class CustomMetricMeter
- Namespace
- Temporalio.Extensions.DiagnosticSource
- Assembly
- Temporalio.Extensions.DiagnosticSource.dll
Implementation of ICustomMetricMeter for a Meter that can be set on CustomMetricMeter to record metrics to the meter.
public class CustomMetricMeter : ICustomMetricMeter
- Inheritance
-
CustomMetricMeter
- Implements
- Inherited Members
Remarks
By default all histograms are set as a long of milliseconds unless
CustomMetricMeterOptions is set to FloatSeconds.
Similarly, if the unit for a histogram is "duration", it is changed to "ms" unless that same
setting is set, at which point the unit is changed to "s".
Constructors
CustomMetricMeter(Meter, bool)
Initializes a new instance of the CustomMetricMeter class.
public CustomMetricMeter(Meter meter, bool disableWorkflowTracingEventListener = false)
Parameters
meterMeterMeter to back this custom meter implementation with.
disableWorkflowTracingEventListenerboolWhen false, the default, calls to .NET meter from inside a workflow are subject to the event listener which catch non-deterministic thread, timer, and/or default task scheduler use. Some .NET meter adapter implementations, such as https://github.com/prometheus-net/prometheus-net with its "managed lease handles", do non-deterministic things. So setting this to true will surround in-workflow meter calls with WithTracingEventListenerDisabled<T>(Func<T>).
Properties
Meter
Gets the underlying meter for this custom meter.
public Meter Meter { get; }
Property Value
Methods
CreateCounter<T>(string, string?, string?)
Create a metric counter.
public ICustomMetricCounter<T> CreateCounter<T>(string name, string? unit, string? description) where T : struct
Parameters
namestringName for the metric.
unitstringUnit for the metric if any.
descriptionstringDescription for the metric if any.
Returns
- ICustomMetricCounter<T>
Counter to be called with updates.
Type Parameters
TThe type of counter value. Currently this is always
long, but the types can change in the future.
CreateGauge<T>(string, string?, string?)
Create a metric gauge.
public ICustomMetricGauge<T> CreateGauge<T>(string name, string? unit, string? description) where T : struct
Parameters
namestringName for the metric.
unitstringUnit for the metric if any.
descriptionstringDescription for the metric if any.
Returns
- ICustomMetricGauge<T>
Gauge to be called with updates.
Type Parameters
TThe type of gauge value. Currently this can be
longordouble, but the types can change in the future.
CreateHistogram<T>(string, string?, string?)
Create a metric histogram.
public ICustomMetricHistogram<T> CreateHistogram<T>(string name, string? unit, string? description) where T : struct
Parameters
namestringName for the metric.
unitstringUnit for the metric if any.
descriptionstringDescription for the metric if any.
Returns
- ICustomMetricHistogram<T>
Histogram to be called with updates.
Type Parameters
TThe type of histogram value. Currently this can be
long,double, or TimeSpan, but the types can change in the future.
Remarks
By default all histograms are set as a long of milliseconds unless
CustomMetricMeterOptions is set to FloatSeconds.
Similarly, if the unit for a histogram is "duration", it is changed to "ms" unless that
same setting is set, at which point the unit is changed to "s".
CreateTags(object?, IReadOnlyCollection<KeyValuePair<string, object>>)
Create a new tag set. This created value will be passed to different metric update calls at update time.
public object CreateTags(object? appendFrom, IReadOnlyCollection<KeyValuePair<string, object>> tags)
Parameters
appendFromobjectIf present, the new tag set should start with these values. Do not mutate this value.
tagsIReadOnlyCollection<KeyValuePair<string, object>>Set of tags. The values of each pair are either
string,long,double, orbool.
Returns
- object
New tag set to use for metric updates.