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

Histogram<T>

public sealed class Histogram<T> : Instrument<T> where T : struct
Represents a metrics instrument that can be used to report arbitrary values that are likely to be statistically meaningful, for example, the request duration. Call CreateHistogram<T> to create a Histogram object.
using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace System.Diagnostics.Metrics { public sealed class Histogram<T> : Instrument<T> where T : struct { internal Histogram(Meter meter, string name, string unit, string description) : this(meter, name, unit, description, (IEnumerable<KeyValuePair<string, object>>)null, (InstrumentAdvice<T>)null) { } internal Histogram(Meter meter, string name, string unit, string description, IEnumerable<KeyValuePair<string, object>> tags, InstrumentAdvice<T> advice) : base(meter, name, unit, description, tags, advice) { Publish(); } public void Record(T value) { RecordMeasurement(value); } public void Record(T value, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 2 })] KeyValuePair<string, object> tag) { RecordMeasurement(value, tag); } public void Record(T value, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 2 })] KeyValuePair<string, object> tag1, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 2 })] KeyValuePair<string, object> tag2) { RecordMeasurement(value, tag1, tag2); } public void Record(T value, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 2 })] KeyValuePair<string, object> tag1, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 2 })] KeyValuePair<string, object> tag2, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 2 })] KeyValuePair<string, object> tag3) { RecordMeasurement(value, tag1, tag2, tag3); } public void Record(T value, [System.Runtime.CompilerServices.ParamCollection] [System.Runtime.CompilerServices.ScopedRef] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 0, 1, 2 })] ReadOnlySpan<KeyValuePair<string, object>> tags) { RecordMeasurement(value, tags); } public void Record(T value, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2 })] params KeyValuePair<string, object>[] tags) { RecordMeasurement(value, MemoryExtensions.AsSpan<KeyValuePair<string, object>>(tags)); } public void Record(T value, [In] [System.Runtime.CompilerServices.IsReadOnly] ref TagList tagList) { RecordMeasurement(value, ref tagList); } } }