Skip to content

Convert SignalR EventSource usage to new pattern #11130

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

Merged
merged 6 commits into from
Jun 14, 2019

Conversation

BrennanConroy
Copy link
Member

And sneak in a new counter: CurrentConnections

@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Jun 12, 2019
@BrennanConroy BrennanConroy requested a review from davidfowl June 12, 2019 05:21
@davidfowl
Copy link
Member

Nice! The pattern where we check IsEnabled() is broken because you can end up with bad counts if the counters are enabled midway.

@analogrelay analogrelay added this to the 3.0.0-preview7 milestone Jun 12, 2019
@BrennanConroy
Copy link
Member Author

So should we move all Interlocked to outside the IsEnabled check?

@BrennanConroy
Copy link
Member Author

/azp run AspNetCore-ci

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@BrennanConroy
Copy link
Member Author

@aspnet/build How does one reset the AspNetCore-ci check without closing and re-opening the PR?

@dougbu
Copy link
Contributor

dougbu commented Jun 13, 2019

@BrennanConroy what do you mean by "reset" in this context?

@BrennanConroy
Copy link
Member Author

There is a red X still even though I have restarted the job.

Looks like a similar issue to another PR where the check isn't being updated on a successful build: #10540

@davidfowl
Copy link
Member

Before you merge, a screenshot with the counters please 😄

private long _currentConnections;

internal HttpConnectionsEventSource()
: base("Microsoft-AspNetCore-Http-Connections")
Copy link
Member

Choose a reason for hiding this comment

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

Rename to Microsoft.AspNetCore.Http.Connections?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we also normalize the counter names? The hosting ones follow the pattern of "current-requests", and we currently use "CurrentConnections".

Copy link
Member

Choose a reason for hiding this comment

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

Yes, lets unify the patterns.

Copy link
Contributor

@analogrelay analogrelay Jun 13, 2019

Choose a reason for hiding this comment

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

EventSource names have always been Microsoft-Things-Separated-By-Dashes, why would we change that?

Also, we should update the hosting ones since these have already shipped with these names. Plus snake-case is so un-.NET ;)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

@analogrelay analogrelay Jun 13, 2019

Choose a reason for hiding this comment

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

Well, it's unfortunate that corefx didn't follow our completely undocumented design pattern from 2.2 here 😝. Hard to fix corefx now though. I'm OK with establishing snake-case as the convention if that's the case.

If we do that we have two options:

  • Leave the SignalR counters alone. Nobody is "broken" but they look different (though the Display Name is what is generally shown I believe)
  • Change the existing SignalR counters to match the new pattern. Anybody depending on the exact name is broken. There weren't great tools for collecting these before 3.0 though so I don't feel too bad breaking that (as long as we Announcements it)

Copy link
Member

Choose a reason for hiding this comment

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

There's only one option, use the new pattern.

@BrennanConroy
Copy link
Member Author

image

@davidfowl
Copy link
Member

Whats up with the duration counter? Why does it look like that?

@BrennanConroy
Copy link
Member Author

Whats up with the duration counter? Why does it look like that?

I was going to ask if you knew how to set the display name of a "normal" event counter.

@BrennanConroy
Copy link
Member Author

Figured it out, didn't realize EventCounter inherited from DiagnosticCounter

image


_connectionDuration ??= new EventCounter("connections-duration", this)
{
DisplayName = "Average Connection Duration",
Copy link
Member

@halter73 halter73 Jun 13, 2019

Choose a reason for hiding this comment

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

If we're renaming anyway, this should probably be called "connections-duration-milliseconds".

If we decide that's too verbose, we should still document the units somewhere. The DisplayName should include "milliseconds" or "ms" somewhere.

Copy link
Member

Choose a reason for hiding this comment

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

There’s a new display units field coming

@BrennanConroy
Copy link
Member Author

@aspnet/build Please merge :)

@davidfowl davidfowl merged commit 9023696 into master Jun 14, 2019
@ghost ghost deleted the brecon/eventCounterV2 branch June 14, 2019 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants