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 Microsoft.​Extensions.​Diagnostics.​Metrics.​MetricsBuilderExtensions
Assembly: Microsoft.Extensions.Diagnostics.Abstractions
Inheritance: object → MetricsBuilderExtensions
Extension methods for <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> to add or clear <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> registrations, and to enable or disable metrics.
Methods
public static
IMetricsBuilder
AddListener​(IMetricsBuilder builder)
Registers a new <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> of type <typeparamref name="T" /> .
Returns Returns the original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> for chaining.
builder
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> .
public static
IMetricsBuilder
AddListener​(IMetricsBuilder builder,
IMetricsListener listener)
Registers a new <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> instance.
Returns Returns the original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> for chaining.
builder
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> .
listener
The implementation type of the listener.
public static
IMetricsBuilder
ClearListeners​(IMetricsBuilder builder)
Removes all <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> registrations from the dependency injection container.
Returns Returns the original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> for chaining.
builder
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> .
public static
IMetricsBuilder
EnableMetrics​(IMetricsBuilder builder,
string meterName)
Enables all instruments for the given meter, for all registered listeners.
Returns The original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> for chaining.
builder
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> .
meterName
The <see cref="P:System.Diagnostics.Metrics.Meter.Name" /> or prefix. A null value matches all meters.
public static
IMetricsBuilder
EnableMetrics​(IMetricsBuilder builder,
string meterName,
string instrumentName = null,
string listenerName = null,
MeterScope scopes = 3)
Enables a specified <see cref="T:System.Diagnostics.Metrics.Instrument" /> for the given <see cref="T:System.Diagnostics.Metrics.Meter" /> and <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> .
Returns The original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> for chaining.
builder
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> .
meterName
The <see cref="P:System.Diagnostics.Metrics.Meter.Name" /> or prefix. A null value matches all meters.
instrumentName
The <see cref="P:System.Diagnostics.Metrics.Instrument.Name" /> . A null value matches all instruments.
listenerName
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> .Name. A null value matches all listeners.
scopes
Indicates which meter scopes to consider. Defaults to all scopes.
public static
MetricsOptions
EnableMetrics​(MetricsOptions options,
string meterName)
Enables all instruments for the given meter, for all registered listeners.
Returns The original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.MetricsOptions" /> for chaining.
options
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.MetricsOptions" /> .
meterName
The <see cref="P:System.Diagnostics.Metrics.Meter.Name" /> or prefix. A null value matches all meters.
public static
MetricsOptions
EnableMetrics​(MetricsOptions options,
string meterName,
string instrumentName = null,
string listenerName = null,
MeterScope scopes = 3)
Enables a specified <see cref="T:System.Diagnostics.Metrics.Instrument" /> for the given <see cref="T:System.Diagnostics.Metrics.Meter" /> and <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> .
Returns The original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.MetricsOptions" /> for chaining.
options
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.MetricsOptions" /> .
meterName
The <see cref="P:System.Diagnostics.Metrics.Meter.Name" /> or prefix. A null value matches all meters.
instrumentName
The <see cref="P:System.Diagnostics.Metrics.Instrument.Name" /> . A null value matches all instruments.
listenerName
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> .Name. A null value matches all listeners.
scopes
Indicates which meter scopes to consider. Default to all scopes.
public static
IMetricsBuilder
DisableMetrics​(IMetricsBuilder builder,
string meterName)
Disables all instruments for the given meter, for all registered listeners.
Returns The original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> for chaining.
builder
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> .
meterName
The <see cref="P:System.Diagnostics.Metrics.Meter.Name" /> or prefix. A null value matches all meters.
public static
IMetricsBuilder
DisableMetrics​(IMetricsBuilder builder,
string meterName,
string instrumentName = null,
string listenerName = null,
MeterScope scopes = 3)
Disables a specified <see cref="T:System.Diagnostics.Metrics.Instrument" /> for the given <see cref="T:System.Diagnostics.Metrics.Meter" /> and <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> .
Returns The original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> for chaining.
builder
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsBuilder" /> .
meterName
The <see cref="P:System.Diagnostics.Metrics.Meter.Name" /> or prefix. A null value matches all meters.
instrumentName
The <see cref="P:System.Diagnostics.Metrics.Instrument.Name" /> . A null value matches all instruments.
listenerName
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> .Name. A null value matches all listeners.
scopes
Indicates which meter scopes to consider. Defaults to all scopes.
public static
MetricsOptions
DisableMetrics​(MetricsOptions options,
string meterName)
Disables all instruments for the given meter, for all registered listeners.
Returns The original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.MetricsOptions" /> for chaining.
options
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.MetricsOptions" /> .
meterName
The <see cref="P:System.Diagnostics.Metrics.Meter.Name" /> or prefix. A null value matches all meters.
public static
MetricsOptions
DisableMetrics​(MetricsOptions options,
string meterName,
string instrumentName = null,
string listenerName = null,
MeterScope scopes = 3)
Disables a specified <see cref="T:System.Diagnostics.Metrics.Instrument" /> for the given <see cref="T:System.Diagnostics.Metrics.Meter" /> and <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> .
Returns The original <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.MetricsOptions" /> for chaining.
options
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.MetricsOptions" /> .
meterName
The <see cref="P:System.Diagnostics.Metrics.Meter.Name" /> or prefix. A null value matches all meters.
instrumentName
The <see cref="P:System.Diagnostics.Metrics.Instrument.Name" /> . A null value matches all instruments.
listenerName
The <see cref="T:Microsoft.Extensions.Diagnostics.Metrics.IMetricsListener" /> .Name. A null value matches all listeners.
scopes
Indicates which meter scopes to consider. Defaults to all scopes.
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