-
Notifications
You must be signed in to change notification settings - Fork 764
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
MetricCollector revamp. #4087
MetricCollector revamp. #4087
Conversation
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 like it a lot better than the previous API. Added some suggestions inline.
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/CollectedMeasurement.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs
Outdated
Show resolved
Hide resolved
test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/HeaderParsingFeatureTests.cs
Outdated
Show resolved
Hide resolved
test/Libraries/Microsoft.AspNetCore.Telemetry.Middleware.Tests/Metering/HttpMeteringTests.cs
Outdated
Show resolved
Hide resolved
cc @samsp-msft |
813debf
to
d808b21
Compare
do you need this empty file? Microsoft.Extensions.Telemetry.Console.json |
@tarekgh Where do you see this .json file? That's an old file that should have been deleted last week when I retired the console package. I don't see that file in my PR. |
023f613
to
680d44e
Compare
@noahfalk Now at 100% code coverage, so ready to check in. Any more feedback? |
You are speedy :) I will take a look later this evening at your updated version. |
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/CollectedMeasurement.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/CollectedMeasurement.cs
Show resolved
Hide resolved
I had a lot of feedback for the wait for measurement methods. I created a PR with the changes that merges into this branch: #4091 |
55e9e71
to
6c0ec35
Compare
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.
A few last suggestions, but this is looking pretty good to me. I think it is capturing all the things I liked about the original InstrumentRecorder and has removed portions of the MetricCollector API that felt confusing. Hopefully it still felt pretty ergonomic to use?
test/Libraries/Microsoft.AspNetCore.Telemetry.Middleware.Tests/Metering/HttpMeteringTests.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs
Show resolved
Hide resolved
- This now has a considerably simpler API surface allowing you to collect data for a single instrument at a time. - You can now snapshot all recorded measurements and apply various filters over lists of measurements. - General shape of the API looks similar in style to the FakeLogger. You can now take snapshots of existing state, as a client you never get your hands on "live" state, which helps with racy code. - There is now a WaitForMeasurementsAsync function which is helpful to simplify testing async logic.
MetricCollector revamp.
This now has a considerably simpler API surface allowing you to collect
data for a single instrument at a time.
You can now snapshot all recorded measurements and apply various
filters over lists of measurements.
General shape of the API looks similar in style to the FakeLogger.
You can now take snapshots of existing state, as a client you never get
your hands on "live" state, which helps with racy code.
There is now a WaitForMeasurementsAsync function which is helpful to
simplify testing async logic.
Microsoft Reviewers: Open in CodeFlow