Skip to content

Commit

Permalink
MetricsReporter should report only Paprika metrics (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scooletz authored Jan 8, 2025
1 parent 61c326a commit 630674d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Paprika.Runner/MetricsReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public MetricsReporter()
{
InstrumentPublished = (instrument, listener) =>
{
if (ShouldReport(instrument) == false)
return;

lock (_sync)
{
var meter = instrument.Meter;
Expand All @@ -52,6 +55,9 @@ public MetricsReporter()
},
MeasurementsCompleted = (instrument, cookie) =>
{
if (ShouldReport(instrument) == false)
return;

lock (_sync)
{
var instruments = _instrument2State[instrument.Meter];
Expand All @@ -73,6 +79,8 @@ public MetricsReporter()
_listener.SetMeasurementEventCallback<decimal>((i, m, l, c) => ((IMeasurement)c!).Update((double)m, l));
}

private static bool ShouldReport(Instrument instrument) => instrument.Meter.Name.Contains("Paprika");

public void Observe()
{
_listener.RecordObservableInstruments();
Expand Down

0 comments on commit 630674d

Please sign in to comment.