Table of Contents

Class MeterInspector

Namespace
MetricsAssertions
Assembly
MetricsAssertions.dll

Discovery helper for the one thing Microsoft.Extensions.Diagnostics.Metrics.Testing.MetricCollector<T> cannot answer: which instruments a meter actually publishes (a registry question, not a measurement one). Uses a short-lived MeterListener - the only mechanism that enumerates a meter's instruments without knowing their names or value types up front.

public static class MeterInspector
Inheritance
MeterInspector
Inherited Members

Methods

IsPublished(string, string)

Returns whether the named instrument is published by the named meter.

public static bool IsPublished(string meterName, string instrumentName)

Parameters

meterName string

The meter name.

instrumentName string

The instrument name.

Returns

bool

PublishedInstrumentNames(string)

Returns the names of every instrument currently published by the named meter.

public static IReadOnlySet<string> PublishedInstrumentNames(string meterName)

Parameters

meterName string

The meter name to inspect.

Returns

IReadOnlySet<string>

PublishesAll(string, params string[])

Returns whether the named meter publishes every one of instrumentNames.

public static bool PublishesAll(string meterName, params string[] instrumentNames)

Parameters

meterName string

The meter name.

instrumentNames string[]

The instrument names that must all be published.

Returns

bool