Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Meter.CreateObservableCounter Method

Definition

Namespace:
System.Diagnostics.Metrics
Assembly:
System.Diagnostics.DiagnosticSource.dll
Package:
System.Diagnostics.DiagnosticSource v11.0.0-preview.5.26302.115

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.

Overloads

Name Description
CreateObservableCounter<T>(String, Func<IEnumerable<Measurement<T>>>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

CreateObservableCounter<T>(String, Func<Measurement<T>>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

CreateObservableCounter<T>(String, Func<T>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

CreateObservableCounter<T>(String, Func<IEnumerable<Measurement<T>>>, String, String, IEnumerable<KeyValuePair<String,Object>>)

Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.

CreateObservableCounter<T>(String, Func<Measurement<T>>, String, String, IEnumerable<KeyValuePair<String,Object>>)

Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.

CreateObservableCounter<T>(String, Func<T>, String, String, IEnumerable<KeyValuePair<String,Object>>)

Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.

CreateObservableCounter<T>(String, Func<IEnumerable<Measurement<T>>>, String, String)

Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<System.Collections.Generic.IEnumerable<System.Diagnostics.Metrics.Measurement<T>>> observeValues, string? unit = default, string? description = default) where T : struct;
member this.CreateObservableCounter : string * Func<seq<System.Diagnostics.Metrics.Measurement<'T>>> * string * string -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValues As Func(Of IEnumerable(Of Measurement(Of T))), Optional unit As String = Nothing, Optional description As String = Nothing) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement.

Parameters

name
String

The instrument name. Cannot be null.

observeValues
Func<IEnumerable<Measurement<T>>>

The callback to call to get the measurements when ObservableCounter{T}.Observe() is called by RecordObservableInstruments().

unit
String

Optional instrument unit of measurements.

description
String

Optional instrument description.

Returns

A new observable counter.

Remarks

Note

Unlike Counter, which takes the increment/delta value, the callback function reports the absolute value of the counter. To determine the reported rate the counter is changing, the difference between successive measurements is used.

Example uses for ObservableCounter: The number of page faults for each process.

Applies to

CreateObservableCounter<T>(String, Func<Measurement<T>>, String, String)

Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<System.Diagnostics.Metrics.Measurement<T>> observeValue, string? unit = default, string? description = default) where T : struct;
member this.CreateObservableCounter : string * Func<System.Diagnostics.Metrics.Measurement<'T>> * string * string -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValue As Func(Of Measurement(Of T)), Optional unit As String = Nothing, Optional description As String = Nothing) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement.

Parameters

name
String

The instrument name. Cannot be null.

observeValue
Func<Measurement<T>>

The callback to call to get the measurements when ObservableCounter{T}.Observe() is called by RecordObservableInstruments()

unit
String

Optional instrument unit of measurements.

description
String

Optional instrument description.

Returns

A new observable counter.

Remarks

Note

Unlike Counter which takes the increment/delta value, the callback function reports the absolute value of the counter. To determine the reported rate the counter is changing, the difference between successive measurements is used.

Example uses for ObservableCounter: The number of page faults for each process.

Applies to

CreateObservableCounter<T>(String, Func<T>, String, String)

Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<T> observeValue, string? unit = default, string? description = default) where T : struct;
member this.CreateObservableCounter : string * Func<'T (requires 'T : struct)> * string * string -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValue As Func(Of T), Optional unit As String = Nothing, Optional description As String = Nothing) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement..

Parameters

name
String

The instrument name. Cannot be null.

observeValue
Func<T>

The callback to call to get the measurements when ObservableCounter{T}.Observe() is called by RecordObservableInstruments().

unit
String

Optional instrument unit of measurements.

description
String

Optional instrument description.

Returns

A new observable counter.

Remarks

Note

Unlike Counter which takes the increment/delta value, the callback function reports the absolute value of the counter. To determine the reported rate the counter is changing, the difference between successive measurements is used.

Example uses for ObservableCounter: The number of page faults for each process.

Applies to

CreateObservableCounter<T>(String, Func<IEnumerable<Measurement<T>>>, String, String, IEnumerable<KeyValuePair<String,Object>>)

Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs

Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.

public:
generic <typename T>
 where T : value class System::Diagnostics::Metrics::ObservableCounter<T> ^ CreateObservableCounter(System::String ^ name, Func<System::Collections::Generic::IEnumerable<System::Diagnostics::Metrics::Measurement<T>> ^> ^ observeValues, System::String ^ unit, System::String ^ description, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, System::Object ^>> ^ tags);
public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<System.Collections.Generic.IEnumerable<System.Diagnostics.Metrics.Measurement<T>>> observeValues, string? unit, string? description, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>> tags) where T : struct;
public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<System.Collections.Generic.IEnumerable<System.Diagnostics.Metrics.Measurement<T>>> observeValues, string? unit, string? description, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>>? tags) where T : struct;
member this.CreateObservableCounter : string * Func<seq<System.Diagnostics.Metrics.Measurement<'T>>> * string * string * seq<System.Collections.Generic.KeyValuePair<string, obj>> -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValues As Func(Of IEnumerable(Of Measurement(Of T))), unit As String, description As String, tags As IEnumerable(Of KeyValuePair(Of String, Object))) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement.

Parameters

name
String

The instrument name. It cannot be null.

observeValues
Func<IEnumerable<Measurement<T>>>

The callback to call to get the measurements when the Observe() is called by RecordObservableInstruments().

unit
String

An optional instrument unit of measurements.

description
String

An optional instrument description.

tags
IEnumerable<KeyValuePair<String,Object>>

The tags to attach to the counter.

Returns

A new observable counter.

Remarks

Note

Unlike Counter, which takes the increment/delta value, the callback function reports the absolute value of the counter. To determine the reported rate the counter is changing, the difference between successive measurements is used.

Example uses for ObservableCounter: The number of page faults for each process.

Applies to

CreateObservableCounter<T>(String, Func<Measurement<T>>, String, String, IEnumerable<KeyValuePair<String,Object>>)

Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs

Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.

public:
generic <typename T>
 where T : value class System::Diagnostics::Metrics::ObservableCounter<T> ^ CreateObservableCounter(System::String ^ name, Func<System::Diagnostics::Metrics::Measurement<T>> ^ observeValue, System::String ^ unit, System::String ^ description, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, System::Object ^>> ^ tags);
public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<System.Diagnostics.Metrics.Measurement<T>> observeValue, string? unit, string? description, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>> tags) where T : struct;
public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<System.Diagnostics.Metrics.Measurement<T>> observeValue, string? unit, string? description, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>>? tags) where T : struct;
member this.CreateObservableCounter : string * Func<System.Diagnostics.Metrics.Measurement<'T>> * string * string * seq<System.Collections.Generic.KeyValuePair<string, obj>> -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValue As Func(Of Measurement(Of T)), unit As String, description As String, tags As IEnumerable(Of KeyValuePair(Of String, Object))) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement.

Parameters

name
String

The instrument name. It cannot be null.

observeValue
Func<Measurement<T>>

The callback to call to get the measurements when the Observe() is called by RecordObservableInstruments()

unit
String

An optional instrument unit of measurements.

description
String

An optional instrument description.

tags
IEnumerable<KeyValuePair<String,Object>>

The tags to attach to the counter.

Returns

A new observable counter.

Remarks

Note

Unlike Counter which takes the increment/delta value, the callback function reports the absolute value of the counter. To determine the reported rate the counter is changing, the difference between successive measurements is used.

Example uses for ObservableCounter: The number of page faults for each process.

Applies to

CreateObservableCounter<T>(String, Func<T>, String, String, IEnumerable<KeyValuePair<String,Object>>)

Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs
Source:
Meter.cs

Creates an ObservableCounter instance, which is an Instrument that reports monotonically increasing value(s) when the instrument is being observed.

public:
generic <typename T>
 where T : value class System::Diagnostics::Metrics::ObservableCounter<T> ^ CreateObservableCounter(System::String ^ name, Func<T> ^ observeValue, System::String ^ unit, System::String ^ description, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, System::Object ^>> ^ tags);
public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<T> observeValue, string? unit, string? description, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>> tags) where T : struct;
public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<T> observeValue, string? unit, string? description, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>>? tags) where T : struct;
member this.CreateObservableCounter : string * Func<'T (requires 'T : struct)> * string * string * seq<System.Collections.Generic.KeyValuePair<string, obj>> -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValue As Func(Of T), unit As String, description As String, tags As IEnumerable(Of KeyValuePair(Of String, Object))) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement.

Parameters

name
String

The instrument name. It cannot be null.

observeValue
Func<T>

The callback to call to get the measurements when the Observe() is called by RecordObservableInstruments().

unit
String

An optional instrument unit of measurements.

description
String

An optional instrument description.

tags
IEnumerable<KeyValuePair<String,Object>>

The tags to attach to the counter.

Returns

A new observable counter.

Remarks

Note

Unlike Counter which takes the increment/delta value, the callback function reports the absolute value of the counter. To determine the reported rate the counter is changing, the difference between successive measurements is used.

Example uses for ObservableCounter: The number of page faults for each process.

Applies to


Feedback

Was this page helpful?