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

Instrument

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

Gets the instrument description.

public bool Enabled { get; }

Checks if there is any listeners for this instrument.

public virtual bool IsObservable { get; }

A property tells if the instrument is an observable instrument.

public Meter Meter { get; }

Gets the Meter which 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. All classes extending Instrument need to call this constructor when constructing object of the extended class.

protected void Publish()

Publish is activating the instrument to start recording measurements and to allow listeners to start listening to such measurements.