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

HttpClient Diagnostics: deprecated events issue #21273

Closed
lmolkova opened this issue Apr 21, 2017 · 10 comments
Closed

HttpClient Diagnostics: deprecated events issue #21273

lmolkova opened this issue Apr 21, 2017 · 10 comments

Comments

@lmolkova
Copy link

In PR dotnet/corefx#16393 we have changed logging (DiagnosticSource) in HttoClient and introduced a new events:

  • System.Net.Http.HttpRequestOut.Start
  • System.Net.Http.HttpRequestOut.Stop
  • System.Net.Http.Exception

We kept events that have been previously fired, but deprecated them:

  • System.Net.Http.Request
  • System.Net.Http.Response

We also made new and old events mutually exclusive.

However there is a valid production scenario when there are two listeners in the application that want different set of events:
e.g. ApplicationInsights for the 'new' events and Glimpse for the 'old' events. With mutual exclusiveness, only 'new' listener will receive any events.

Besides Glimpse, VisualStudio consumes 'old' events, however I do not know whether it is internal logging or listener is somehow injected into the application where other listeners may exist; may be @nbilling can provide more details on it.
Potentially there are other consumers affected by this change.

Simple solution would be to check for deprecated event listener with IsEnabled method even if there was a listener to new event, however the assumption is that frequently there will be just one listener.
IsEnabled for deprecated events may be cached under the assumption that there are no consumers that dynamically subscribe and unsubscribe.

/cc @vancem @avanderhoorn @nbilling @cwe1ss

@lmolkova
Copy link
Author

Another solution could be to use different DiagnosticListeners names so it will be cheaper to check if someone listens to one of them with no-arg IsEnabled()

@vancem
Copy link
Contributor

vancem commented Apr 21, 2017

Yes, we know about users of the old events get broken if there is also a client using the new events.

The idea was that the tools using the old events should quickly migrate to the new events.

In general to the extent possible our philosophy is to try not to compromise on the future for the sake of the past. Thus we should be investing effort in upgrading the tools that use the old events rather than in improving compatibility.

@lmolkova
Copy link
Author

lmolkova commented Apr 21, 2017

That is correct that tools could migrate to the new events, however end users need to update tools.
And the problem for end user that something just stopped working only because they updated AppInsights version to the latest one. It is not easy to find the root cause.
And while it should be easy to update Glimpse, updating VisualStudio could be much more difficult (however I still hope that it's internal VS logging).

@vancem
Copy link
Contributor

vancem commented Apr 21, 2017

If there is enough compatibility pain than we should be looking at fixing it. However we should have a clear understanding what the impact is, how likely it is to happen, and how easy is it to work around.

@cwe1ss
Copy link
Contributor

cwe1ss commented Apr 22, 2017

Multiple listeners/tracers are a challenge for other reasons as well. Imagine both are calling SetParentId() with different IDs.
AFAIK, there's no good solution for this in OpenTracing yet. By default, it allows only one tracer but there are some concepts about a "TeeTracer" which is an indirection that allows for one main tracer (e.g. Application Insights) and one or more "passive" tracers (e.g. a prometheus metrics reporter).

@avanderhoorn
Copy link
Contributor

I think part of the issue here is that if Glimpse or AI or anyone else wants to support v1 and v2. In this case our consuming code base would be listening to both events. The original though was to make these events mutually exclusive to avoid both events firing... hence if one consumer was listening to v2 events, the system would disable v1 events. We can probably handle this implementation detail for code we own (i.e. Glimpse, AI, etc) but others outside of MS have started listening to DS events and hence just arbitrary picking one vs the other doesn't seem to make much sense. Hence the thought was that if consumers who want to support v1 and v2 have some way of knowing if they should expect v2 events, they can disable their v1 listeners (i.e. they would return false from their IsEnabled callback). If we went this way, it would let v1 only consumers work just fine, it would let v2 consumers work just fine and it would let consumers listening to both v1 and v2 have a way of opting into v2 events (ignoring v1 events). The question is what does that "v2 is present" signal look like? Is it an event that is fired by DS or is it something else?

@ViktorHofer
Copy link
Member

ViktorHofer commented May 10, 2017

@karelz @danmosemsft @vancem I don't think somebody is working on this 2.0 issue?

@karelz
Copy link
Member

karelz commented May 11, 2017

@vancem @brianrob @valenis ping?

@vancem
Copy link
Contributor

vancem commented May 11, 2017

I am looking at this now.

vancem referenced this issue in vancem/corefx May 11, 2017
Addresses https://github.com/dotnet/corefx/issues/18762
Basically we always check if a client needs deprecated events (previously we checked only if new events were not enabled).
This allows clients to support both new and old simultaneously.
vancem referenced this issue in vancem/corefx May 11, 2017
Addresses https://github.com/dotnet/corefx/issues/18762
Basically we always check if a client needs deprecated events (previously we checked only if new events were not enabled).
This allows clients to support both new and old simultaneously.
vancem referenced this issue in vancem/corefx May 11, 2017
Addresses https://github.com/dotnet/corefx/issues/18762
Basically we always check if a client needs deprecated events (previously we checked only if new events were not enabled).
This allows clients to support both new and old simultaneously.
@vancem
Copy link
Contributor

vancem commented May 11, 2017

Fixed by dotnet/corefx#19659

@vancem vancem closed this as completed May 11, 2017
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants