-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove InstrumentRecorder class #87873
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks Tarek.
InstrumentRecorder<int> recorder = new InstrumentRecorder<int>(counter); | ||
|
||
using MeterListener listener = new MeterListener(); | ||
listener.InstrumentPublished = (instrument, theListener) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works and I'm fine if you merge it this way, but a simpler option is:
using MeterListener listener = new MeterListener();
int lastMeasurement = 0;
listener.SetMeasurementEventCallback<int>((inst, measurement, tags, state) => lastMeasurement = measurement);
listener.EnableMeasurementEvents(counter, null);
There is no requirement to use publishing events if you already know the counter you want to listen to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this in another PR. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opened the PR #87898
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM since InstrumentRecorder
was added in P5 it's OK to remove now. You may want to issue a breaking change notice, just in case any customer's started using it in the preview.
I can add something to dotnet/core#8437 |
Removing InstrumentRecorder from the runtime. MetricCollector can be used instead.