3 types derived from Instrument
System.Diagnostics.DiagnosticSource (3)
122 references to Instrument
Interop.FunctionalTests (1)
Microsoft.Extensions.Diagnostics (10)
Microsoft.Extensions.Diagnostics.Abstractions (17)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (9)
Microsoft.Extensions.Diagnostics.Testing (4)
Microsoft.Extensions.Resilience.PerformanceTests (1)
Shared (1)
System.Diagnostics.DiagnosticSource (78)
System\Diagnostics\Metrics\AggregationManager.cs (20)
23private readonly List<Predicate<Instrument>> _instrumentConfigFuncs = new();
28private Dictionary<Instrument, bool> _instruments = new();
29private readonly ConcurrentDictionary<Instrument, InstrumentState> _instrumentStates = new();
35private readonly Action<Instrument, LabeledAggregationStatistics, InstrumentState?> _collectMeasurement;
38private readonly Action<Instrument, InstrumentState> _beginInstrumentMeasurements;
39private readonly Action<Instrument, InstrumentState> _endInstrumentMeasurements;
40private readonly Action<Instrument, InstrumentState?> _instrumentPublished;
50Action<Instrument, LabeledAggregationStatistics, InstrumentState?> collectMeasurement,
53Action<Instrument, InstrumentState> beginInstrumentMeasurements,
54Action<Instrument, InstrumentState> endInstrumentMeasurements,
55Action<Instrument, InstrumentState?> instrumentPublished,
110private void Include(Predicate<Instrument> instrumentFilter)
129private void CompletedMeasurements(Instrument instrument, object? cookie)
137private void PublishedInstrument(Instrument instrument, MeterListener _)
260private void RemoveInstrumentState(Instrument instrument)
265private InstrumentState? GetInstrumentState(Instrument instrument)
271foreach (Predicate<Instrument> filter in _instrumentConfigFuncs)
294internal InstrumentState? BuildInstrumentState(Instrument instrument)
306private Func<Aggregator?>? GetAggregatorFactory(Instrument instrument)
439foreach (KeyValuePair<Instrument, InstrumentState> kv in _instrumentStates)
System\Diagnostics\Metrics\Meter.cs (23)
19private List<Instrument> _instruments = new List<Instrument>();
20private Dictionary<string, List<Instrument>> _nonObservableInstrumentsCache = new();
96lock (Instrument.SyncObject)
502List<Instrument>? instruments = null;
504lock (Instrument.SyncObject)
514_instruments = new List<Instrument>();
524foreach (Instrument instrument in instruments)
531private static Instrument? GetCachedInstrument(List<Instrument> instrumentList, Type instrumentType, string? unit, string? description, IEnumerable<KeyValuePair<string, object?>>? tags)
534foreach (Instrument instrument in instrumentList)
547private Instrument GetOrCreateInstrument<T>(Type instrumentType, string name, string? unit, string? description, IEnumerable<KeyValuePair<string, object?>>? tags, Func<Instrument> instrumentCreator)
549List<Instrument>? instrumentList;
555instrumentList = new List<Instrument>();
565Instrument? cachedInstrument = GetCachedInstrument(instrumentList, instrumentType, unit, description, tags);
572Instrument newInstrument = instrumentCreator.Invoke();
578Instrument? cachedInstrument = GetCachedInstrument(instrumentList, instrumentType, unit, description, tags);
592internal bool AddInstrument(Instrument instrument)
604internal static List<Instrument>? GetPublishedInstruments()
606List<Instrument>? instruments = null;
610instruments = new List<Instrument>();
614foreach (Instrument instrument in meter._instruments)
System\Diagnostics\Metrics\MeterListener.cs (20)
12public delegate void MeasurementCallback<T>(Instrument instrument, T measurement, ReadOnlySpan<KeyValuePair<string, object?>> tags, object? state) where T : struct;
24private readonly DiagLinkedList<Instrument> _enabledMeasurementInstruments = new DiagLinkedList<Instrument>();
50public Action<Instrument, MeterListener>? InstrumentPublished { get; set; }
56public Action<Instrument, object?>? MeasurementsCompleted { get; set; }
63public void EnableMeasurementEvents(Instrument instrument, object? state = null)
74lock (Instrument.SyncObject)
104public object? DisableMeasurementEvents(Instrument instrument)
112lock (Instrument.SyncObject)
184List<Instrument>? publishedInstruments = null;
185lock (Instrument.SyncObject)
201foreach (Instrument instrument in publishedInstruments)
219DiagNode<Instrument>? current = _enabledMeasurementInstruments.First;
254Dictionary<Instrument, object?>? callbacksArguments = null;
255Action<Instrument, object?>? measurementsCompleted = MeasurementsCompleted;
257lock (Instrument.SyncObject)
266DiagNode<Instrument>? current = _enabledMeasurementInstruments.First;
271callbacksArguments = new Dictionary<Instrument, object?>();
287foreach (KeyValuePair<Instrument, object?> kvp in callbacksArguments)
298internal void NotifyMeasurement<T>(Instrument instrument, T measurement, ReadOnlySpan<KeyValuePair<string, object?>> tags, object? state) where T : struct