Instrument<T> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The base class for all non-observable instruments. Mirrored from: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics.instrument-1?view=net-6.0.
public abstract class Instrument<T> : Microsoft.VisualStudio.Telemetry.Metrics.IInstrument where T : struct
type Instrument<'T (requires 'T : struct)> = class
interface IInstrument
Public MustInherit Class Instrument(Of T)
Implements IInstrument
Type Parameters
- T
The type of the instrument.
- Inheritance
-
Instrument<T>
- Implements
Fields
EmptyTags |
Indicates an empty set of tags which can be used in substitute of user-specified tags. |
Properties
Description |
Gets the instrument description. |
Enabled |
Gets a value indicating whether there are any listeners for this instrument. Always True currently, as measurements are recorded internal to the instrument. When OpenTelemetry is integrated, this will accurately describe the status of listeners. |
IsObservable |
Gets a value indicating whether the instrument is an observable instrument. Always False currently, as Instruments in are non-observable by definition in .NET. |
Meter |
Gets the Meter that created the instrument. |
Name |
Gets the instrument name. |
Tags |
Gets or sets the set of tags associated with an instrument's datapoint. This set is re-used from call to call to avoid too many allocations. |
Unit |
Gets the instrument unit of measurements. |
Methods
Publish() |
Activates the instrument to start recording measurements and to allow listeners to start listening to such measurements. This is currently a no-op as measurement implicitly begins when the first measurement is recorded. |
RecordMeasurement(T, KeyValuePair<String,Object>, KeyValuePair<String,Object>, KeyValuePair<String,Object>) |
Records a measurement by notifying all MeterListener objects that are listening to this instrument. |
RecordMeasurement(T, KeyValuePair<String,Object>, KeyValuePair<String,Object>) |
Records a measurement by notifying all MeterListener objects that are listening to this instrument. |
RecordMeasurement(T, KeyValuePair<String,Object>) |
Records a measurement by notifying all MeterListener objects that are listening to this instrument. |
RecordMeasurement(T, ReadOnlySpan<KeyValuePair<String,Object>>) |
Records a measurement by notifying all MeterListener objects that are listening to this instrument. |
RecordMeasurement(T) |
Records a measurement by notifying all MeterListener objects that are listening to this instrument. |