<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.2" />

MetricsEventSource

This EventSource is intended to let out-of-process tools (such as dotnet-counters) do ad-hoc monitoring for the new Instrument APIs. This source only supports one listener at a time. Each new listener will overwrite the configuration about which metrics are being collected and the time interval for the collection. In the future it would be nice to have support for multiple concurrent out-of-proc tools but EventSource's handling of filter arguments doesn't make that easy right now. Configuration - The EventSource accepts the following filter arguments: - SessionId - An arbitrary opaque string that will be sent back to the listener in many event payloads. If listener B reconfigures the EventSource while listener A is still running it is possible that each of them will observe some of the events that were generated using the other's requested configuration. Filtering on sessionId allows each listener to ignore those events. - RefreshInterval - The frequency in seconds for sending the metric time series data. The format is anything parsable using double.TryParse(). Any value less than AggregationManager.MinCollectionTimeSecs (currently 0.1 sec) is rounded up to the minimum. If not specified the default interval is 1 second. - Metrics - A semicolon separated list. Each item in the list is either the name of a Meter or 'meter_name\instrument_name'. For example "Foo;System.Runtime\gc-gen0-size" would include all instruments in the 'Foo' meter and the single 'gc-gen0-size' instrument in the 'System.Runtime' meter. - MaxTimeSeries - An integer that sets an upper bound on the number of time series this event source will track. Because instruments can have unbounded sets of tags even specifying a single metric could create unbounded load without this limit. - MaxHistograms - An integer that sets an upper bound on the number of histograms this event source will track. This allows setting a tighter bound on histograms than time series in general given that histograms use considerably more memory.
public static class Keywords

public static readonly MetricsEventSource Log

public void BeginInstrumentReporting(string sessionId, string meterName, string meterVersion, string instrumentName, string instrumentType, string unit, string description)

public void CollectionStart(string sessionId, DateTime intervalStartTime, DateTime intervalEndTime)

public void CollectionStop(string sessionId, DateTime intervalStartTime, DateTime intervalEndTime)

public void CounterRateValuePublished(string sessionId, string meterName, string meterVersion, string instrumentName, string unit, string tags, string rate)

public void EndInstrumentReporting(string sessionId, string meterName, string meterVersion, string instrumentName, string instrumentType, string unit, string description)

public void Error(string sessionId, string errorMessage)

public void GaugeValuePublished(string sessionId, string meterName, string meterVersion, string instrumentName, string unit, string tags, string lastValue)

public void HistogramLimitReached(string sessionId)

public void HistogramValuePublished(string sessionId, string meterName, string meterVersion, string instrumentName, string unit, string tags, string quantiles)

public void InitialInstrumentEnumerationComplete(string sessionId)

public void InstrumentPublished(string sessionId, string meterName, string meterVersion, string instrumentName, string instrumentType, string unit, string description)

public void Message(string Message)

Used to send ad-hoc diagnostics to humans.

public void MultipleSessionsNotSupportedError(string runningSessionId)

public void ObservableInstrumentCallbackError(string sessionId, string errorMessage)

public void TimeSeriesLimitReached(string sessionId)