Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Diagnostics.​Metrics.​Meter
Assembly: System.Diagnostics.DiagnosticSource
Inheritance: object → Meter
Implemented Interfaces
Meter is the class responsible for creating and tracking the Instruments.
Properties
public
string
Name
Gets the Meter name.
public
string
Version
Gets the Meter version.
public
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>>
Tags
Returns the tags associated with the Meter.
public
object
Scope
Returns the Meter scope object.
public
string
TelemetrySchemaUrl
<para>Gets the location of a Schema File that can be retrieved using HTTP or HTTPS protocol.</para>
Methods
public
Counter<​T>
CreateCounter​(string name,
string unit = null,
string description = null)
Create a metrics Counter object.
Returns A new counter.
name
The instrument name. Cannot be <see langword="null" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
Counter<​T>
CreateCounter​(string name,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Creates a metrics Counter object.
Returns A new counter.
name
The instrument name. It cannot be <see langword="null" /> .
unit
An optional instrument unit of measurements.
description
An optional instrument description.
tags
The tags to attach to the counter.
public
Gauge<​T>
CreateGauge​(string name)
Creates a Gauge instrument, which can be used to record non-additive values.
name
The instrument name. cannot be <see langword="null" /> .
public
Gauge<​T>
CreateGauge​(string name,
string unit = null,
string description = null,
Collections.​Generic.​IEnumerable?<​Collections.​Generic.​KeyValuePair<​string, object>> tags = null)
Create a metrics Gauge object.
name
The instrument name. cannot be <see langword="null" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
tags
tags to attach to the Gauge.
public
UpDownCounter<​T>
CreateUpDownCounter​(string name,
string unit = null,
string description = null)
Create a metrics UpDownCounter object.
Returns A new up down counter.
name
The instrument name. Cannot be <see langword="null" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
UpDownCounter<​T>
CreateUpDownCounter​(string name,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Create a metrics UpDownCounter object.
Returns A new up down counter.
name
The instrument name. Cannot be <see langword="null" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
tags
tags to attach to the counter.
public
Histogram<​T>
CreateHistogram​(string name)
Histogram is an Instrument which can be used to report arbitrary values that are likely to be statistically meaningful. It is intended for statistics such as histograms, summaries, and percentile.
name
The instrument name. Cannot be <see langword="null" /> .
public
Histogram<​T>
CreateHistogram​(string name,
string unit,
string description)
Creates a Histogram, which is an instrument that can be used to report arbitrary values that are likely to be statistically meaningful. It is intended for statistics such as histograms, summaries, and percentiles.
Returns A new histogram.
name
The instrument name. Cannot be <see langword="null" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
Histogram<​T>
CreateHistogram​(string name,
string unit,
string description,
Collections.​Generic.​IEnumerable?<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Creates an Histogram instance, which is an Instrument that can be used to report arbitrary values that are likely to be statistically meaningful. It is intended for statistics such as histograms, summaries, and percentile.
Returns A new histogram.
name
The instrument name. It cannot be <see langword="null" /> .
unit
An optional instrument unit of measurements.
description
An optional instrument description.
tags
The tags to attach to the counter.
public
Histogram<​T>
CreateHistogram​(string name,
string unit = null,
string description = null,
Collections.​Generic.​IEnumerable?<​Collections.​Generic.​KeyValuePair<​string, object>> tags = null,
InstrumentAdvice?<​T> advice = null)
Histogram is an Instrument which can be used to report arbitrary values that are likely to be statistically meaningful. It is intended for statistics such as histograms, summaries, and percentile.
name
The instrument name. Cannot be <see langword="null" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
tags
Optional tags to attach to the histogram.
advice
Optional <see cref="T:System.Diagnostics.Metrics.InstrumentAdvice`1" /> to attach to the histogram.
public
ObservableCounter<​T>
CreateObservableCounter​(string name,
Func<​T> observeValue,
string unit = null,
string description = null)
Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.
Returns A new observable counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when <code>ObservableCounter{T}.Observe()</code> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableCounter<​T>
CreateObservableCounter​(string name,
Func<​T> observeValue,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.
Returns A new observable counter.
name
The instrument name. It cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
An optional instrument unit of measurements.
description
An optional instrument description.
tags
The tags to attach to the counter.
public
ObservableCounter<​T>
CreateObservableCounter​(string name,
Func<​Measurement<​T>> observeValue,
string unit = null,
string description = null)
Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.
Returns A new observable counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when <code>ObservableCounter{T}.Observe()</code> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" />
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableCounter<​T>
CreateObservableCounter​(string name,
Func<​Measurement<​T>> observeValue,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.
Returns A new observable counter.
name
The instrument name. It cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" />
unit
An optional instrument unit of measurements.
description
An optional instrument description.
tags
The tags to attach to the counter.
public
ObservableCounter<​T>
CreateObservableCounter​(string name,
Func<​Collections.​Generic.​IEnumerable<​Measurement<​T>>> observeValues,
string unit = null,
string description = null)
Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.
Returns A new observable counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValues
The callback to call to get the measurements when <code>ObservableCounter{T}.Observe()</code> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableCounter<​T>
CreateObservableCounter​(string name,
Func<​Collections.​Generic.​IEnumerable<​Measurement<​T>>> observeValues,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.
Returns A new observable counter.
name
The instrument name. It cannot be <see langword="null" /> .
observeValues
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
An optional instrument unit of measurements.
description
An optional instrument description.
tags
The tags to attach to the counter.
public
ObservableUpDownCounter<​T>
CreateObservableUpDownCounter​(string name,
Func<​T> observeValue,
string unit = null,
string description = null)
Creates an ObservableUpDownCounter object. ObservableUpDownCounter is an Instrument that reports increasing or decreasing values when the instrument is being observed.
Returns A new observable up down counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableUpDownCounter<​T>
CreateObservableUpDownCounter​(string name,
Func<​T> observeValue,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Create an ObservableUpDownCounter object. ObservableUpDownCounter is an Instrument which reports increasing or decreasing value(s) when the instrument is being observed.
Returns A new observable up down counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
tags
tags to attach to the counter.
public
ObservableUpDownCounter<​T>
CreateObservableUpDownCounter​(string name,
Func<​Measurement<​T>> observeValue,
string unit = null,
string description = null)
Creates an ObservableUpDownCounter object. ObservableUpDownCounter is an Instrument that reports increasing or decreasing values when the instrument is being observed.
Returns A new observable up down counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" />
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableUpDownCounter<​T>
CreateObservableUpDownCounter​(string name,
Func<​Measurement<​T>> observeValue,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Create an ObservableUpDownCounter object. ObservableUpDownCounter is an Instrument which reports increasing or decreasing value(s) when the instrument is being observed.
Returns A new observable up down counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" />
unit
Optional instrument unit of measurements.
description
Optional instrument description.
tags
tags to attach to the counter.
public
ObservableUpDownCounter<​T>
CreateObservableUpDownCounter​(string name,
Func<​Collections.​Generic.​IEnumerable<​Measurement<​T>>> observeValues,
string unit = null,
string description = null)
Creates an ObservableUpDownCounter object. ObservableUpDownCounter is an Instrument that reports increasing or decreasing values when the instrument is being observed.
Returns A new observable up down counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValues
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableUpDownCounter<​T>
CreateObservableUpDownCounter​(string name,
Func<​Collections.​Generic.​IEnumerable<​Measurement<​T>>> observeValues,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Create an ObservableUpDownCounter object. ObservableUpDownCounter is an Instrument which reports increasing or decreasing value(s) when the instrument is being observed.
Returns A new observable up down counter.
name
The instrument name. Cannot be <see langword="null" /> .
observeValues
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
tags
tags to attach to the counter.
public
ObservableGauge<​T>
CreateObservableGauge​(string name,
Func<​T> observeValue,
string unit = null,
string description = null)
Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.
Returns A new observable gauge.
name
The instrument name. Cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when <code>ObservableCounter{T}.Observe()</code> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableGauge<​T>
CreateObservableGauge​(string name,
Func<​T> observeValue,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
ObservableGauge is an asynchronous Instrument which reports non-additive value(s) (e.g. the room temperature - it makes no sense to report the temperature value from multiple rooms and sum them up) when the instrument is being observed.
Returns A new observable gauge.
name
The instrument name. cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
tags
tags to attach to the counter.
public
ObservableGauge<​T>
CreateObservableGauge​(string name,
Func<​Measurement<​T>> observeValue,
string unit = null,
string description = null)
Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.
Returns A new observable gauge.
name
The instrument name. Cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when <code>ObservableCounter{T}.Observe()</code> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableGauge<​T>
CreateObservableGauge​(string name,
Func<​Measurement<​T>> observeValue,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
ObservableGauge is an asynchronous Instrument which reports non-additive value(s) (e.g. the room temperature - it makes no sense to report the temperature value from multiple rooms and sum them up) when the instrument is being observed.
Returns A new observable gauge.
name
The instrument name. cannot be <see langword="null" /> .
observeValue
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
tags
tags to attach to the counter.
public
ObservableGauge<​T>
CreateObservableGauge​(string name,
Func<​Collections.​Generic.​IEnumerable<​Measurement<​T>>> observeValues,
string unit = null,
string description = null)
Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.
Returns A new observable gauge.
name
The instrument name. Cannot be <see langword="null" /> .
observeValues
The callback to call to get the measurements when <code>ObservableCounter{T}.Observe()</code> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
Optional instrument unit of measurements.
description
Optional instrument description.
public
ObservableGauge<​T>
CreateObservableGauge​(string name,
Func<​Collections.​Generic.​IEnumerable<​Measurement<​T>>> observeValues,
string unit,
string description,
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​string, object>> tags)
Creates an ObservableGauge instance, which is an asynchronous Instrument that reports non-additive value(s) when the instrument is being observed.
Returns A new observable gauge.
name
The instrument name. It cannot be <see langword="null" /> .
observeValues
The callback to call to get the measurements when the <see cref="M:System.Diagnostics.Metrics.ObservableInstrument`1.Observe" /> is called by <see cref="M:System.Diagnostics.Metrics.MeterListener.RecordObservableInstruments" /> .
unit
An optional instrument unit of measurements.
description
An optional instrument description.
tags
The tags to attach to the counter.
protected
void
Dispose​(bool disposing)
Dispose the Meter which will disable all instruments created by this meter.
disposing
<see langword="true" /> if called from Dispose(), <see langword="false" /> if called from a finalizer.
public
void
Dispose​()
Dispose the Meter which will disable all instruments created by this meter.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object