Skip to content
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

Merged
merged 1 commit into from
Jun 20, 2023
Merged

MetricCollector revamp. #4087

merged 1 commit into from
Jun 20, 2023

Conversation

geeknoid
Copy link
Member

@geeknoid geeknoid commented Jun 19, 2023

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

Copy link
Member

@noahfalk noahfalk left a 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.

@noahfalk
Copy link
Member

cc @samsp-msft

@geeknoid geeknoid force-pushed the geeknoid/mc branch 2 times, most recently from 813debf to d808b21 Compare June 19, 2023 18:11
@geeknoid
Copy link
Member Author

@noahfalk @tarekgh Addressed Noah's feedback. It's looking even more like InstrumentRecorder, but with time support, wait support, and a few additional conveniences.

@tarekgh
Copy link
Member

tarekgh commented Jun 19, 2023

@geeknoid I looked at MetricCollector and it looks good to me. I don't have any more feedback.

@JamesNK do you have any feedback from aspnet side replacing InstrumentRecorder with MetricCollector?

@tarekgh
Copy link
Member

tarekgh commented Jun 19, 2023

do you need this empty file? Microsoft.Extensions.Telemetry.Console.json

@geeknoid
Copy link
Member Author

@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.

@tarekgh
Copy link
Member

tarekgh commented Jun 19, 2023

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.

image

@geeknoid geeknoid force-pushed the geeknoid/mc branch 2 times, most recently from 023f613 to 680d44e Compare June 19, 2023 22:41
@geeknoid
Copy link
Member Author

@noahfalk Now at 100% code coverage, so ready to check in. Any more feedback?

@noahfalk
Copy link
Member

@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.

@JamesNK
Copy link
Member

JamesNK commented Jun 20, 2023

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

@geeknoid geeknoid force-pushed the geeknoid/mc branch 2 times, most recently from 55e9e71 to 6c0ec35 Compare June 20, 2023 03:41
Copy link
Member

@noahfalk noahfalk left a 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?

@geeknoid geeknoid enabled auto-merge (squash) June 20, 2023 12:52
- 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.
@geeknoid geeknoid merged commit 2d13f1e into main Jun 20, 2023
@geeknoid geeknoid deleted the geeknoid/mc branch June 20, 2023 14:21
@ghost ghost added this to the 8.0 Preview6 milestone Jun 20, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants