Прочитај на енглеском Уреди

Делите путем


Meter.CreateObservableCounter Method

Definition

Overloads

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

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

C#
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;

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

Напомена

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

.NET 9 и друге верзије
Производ Верзије
.NET 6, 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

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

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.

C#
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;

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

Напомена

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

.NET 9 и друге верзије
Производ Верзије
.NET 6, 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

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

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.

C#
public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T>(string name, Func<T> observeValue, string? unit = default, string? description = default) where T : struct;

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

Напомена

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

.NET 9 и друге верзије
Производ Верзије
.NET 6, 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

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

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

C#
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;
C#
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;

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

Напомена

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

.NET 9 и друге верзије
Производ Верзије
.NET 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

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

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.

C#
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;
C#
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;

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

Напомена

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

.NET 9 и друге верзије
Производ Верзије
.NET 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

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

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.

C#
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;
C#
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;

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

Напомена

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

.NET 9 и друге верзије
Производ Верзије
.NET 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)