You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 26, 2018. It is now read-only.
producer calls IsEnabled("Microsoft.AspNetCore.Hosting.HttpRequestIn", httpContext) just to determine that listener wants instrumentation to happen. Producer optionally adds context that could help consumer to check if he wants instrumentation for this particular request.
if 1 is true, producer calls IsEnabled("Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") to check if consumer wants start event and if true, writes event with the same name
producers just writes IsEnabled("Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop") if instrumentation was on in step 1.
The problem that even if there is no event for the first IsEnabled, user still has to write a method with corresponding DiagnosticName attribute.
class HttpHandlerListener
{
[DiagnosticName("System.Net.Http.HttpRequestOut")]
public void IsEnabled()
{
}
[DiagnosticName("System.Net.Http.HttpRequestOut.Start")]
public void OnStart(HttpRequestMessage request)
{
}
[DiagnosticName("System.Net.Http.HttpRequestOut.Stop")]
public void Stop(HttpResponseMessage response)
{
}
}
I have tried to work it around in the other way with SubscribeWithAdapter(object, Predicate isEnabled),
but isEnabled never gets called if there is no attribute with this diagnosticName.
As a minimum solution, I would expect isEnabled predicate (provided to SubscribeWithAdapter) at least be called and it's result should be taken into account.
But may be IsEnabled should be done in the same way as Write?
[DiagnosticName("System.Net.Http.HttpRequestOut")] //or another attribute?
public bool IsEnabled(HttpContext context)
{
return context.Request.Method != "OPTIONS";
}
And if there is no IsEnabled, DiagnosticName on the Write callback could be used as an indicator that event is enabled
The text was updated successfully, but these errors were encountered:
Marking as up-for-grabs and moving to Backlog. This seems like a reasonable feature request, but we're not investing a lot in the automatic proxy generation logic at this time.
We have recently introduced a new DiagnosticSource usage pattern in the HttpClient and AspNetCore.Hosting:
E.g. in AspNetCore.Hosting:
The problem that even if there is no event for the first IsEnabled, user still has to write a method with corresponding DiagnosticName attribute.
I have tried to work it around in the other way with SubscribeWithAdapter(object, Predicate isEnabled),
but isEnabled never gets called if there is no attribute with this diagnosticName.
As a minimum solution, I would expect isEnabled predicate (provided to SubscribeWithAdapter) at least be called and it's result should be taken into account.
But may be IsEnabled should be done in the same way as Write?
And if there is no IsEnabled, DiagnosticName on the Write callback could be used as an indicator that event is enabled
The text was updated successfully, but these errors were encountered: