<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.0-preview.1.23110.8" />

Instrument

public abstract class Instrument
Base class of all metrics instrument classes
public string Description { get; }

Gets the instrument description.

public bool Enabled { get; }

Gets a value that indicates if there are any listeners for this instrument.

public virtual bool IsObservable { get; }

Gets a value that indicates whether the instrument is an observable instrument.

public Meter Meter { get; }

Gets the Meter that created the instrument.

public string Name { get; }

Gets the instrument name.

public string Unit { get; }

Gets the instrument unit of measurements.

protected Instrument(Meter meter, string name, string unit, string description)

Protected constructor to initialize the common instrument properties like the meter, name, description, and unit.

protected void Publish()

Activates the instrument to start recording measurements and to allow listeners to start listening to such measurements.