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

Add System.Net.NameResolution metrics #88773

Merged
merged 5 commits into from
Jul 15, 2023
Merged

Conversation

MihaZupan
Copy link
Member

@MihaZupan MihaZupan commented Jul 12, 2023

Contributes to #48885

The implementation piggybacks off of the existing EventSource logic to minimize the maintainability burden.

I added a System.Net.NameResolution meter with:

  • Counter<long> "dns-lookups-requested" that just does +1, tags: hostname=foo.

The existing EventCounters also have a dns-lookups-duration counter -- do we want a Meter equivalent?

(do tell me if I'm committing any metering crimes - I haven't dealt with the new APIs yet)

P.S. What's the story with InstrumentRecorder? It's a bit sad to see every change duplicate it in tests.

cc: @davidfowl

@MihaZupan MihaZupan added this to the 8.0.0 milestone Jul 12, 2023
@MihaZupan MihaZupan requested review from JamesNK, noahfalk, antonfirsov and a team July 12, 2023 19:18
@ghost ghost assigned MihaZupan Jul 12, 2023
@ghost
Copy link

ghost commented Jul 12, 2023

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Contributes to #48885

The implementation piggybacks off of the existing EventSource logic to minimize the maintainability burden.

I added a System.Net.NameResolution meter with:

  • Counter<long> "dns-lookups-requested" that just does +1, tags: hostname=foo.

The existing EventCounters also have a dns-lookups-duration counter -- do we want a Meter equivalent?

(do tell me if I'm committing any metering crimes - I haven't dealt with the new APIs yet)

P.S. What's the story with InstrumentRecorder? It's a bit sad to see every change duplicate it in tests.

Author: MihaZupan
Assignees: -
Labels:

area-System.Net

Milestone: 8.0.0

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we need to agree on the naming.

P.S. What's the story with InstrumentRecorder? It's a bit sad to see every change duplicate it in tests.

It almost made its' way to the BCL but was removed in #87873. We shall create a copy of MetricCollector or a simplified variant in Common/tests as we keep adding more metrics I guess.

private static readonly Meter s_meter = new("System.Net.NameResolution");

private static readonly Counter<long> s_lookupsRequestedCounter = s_meter.CreateCounter<long>(
name: "dns-lookups-requested",
Copy link
Member

@antonfirsov antonfirsov Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @noahfalk to figure out the naming, since this is establishing a precedent. Should it be dns.lookups.requested?

(The instruments in my pr are to be renamed.)

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can rename the instruments in a follow-up PR.

@MihaZupan MihaZupan merged commit 2a7ba8a into dotnet:main Jul 15, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants