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
No RequestTelemetry created in aspnet core TestServer #2491
Comments
Hi @saikatguha , Apologies for the delayed response. Is this scenario completely based on functions or webjobs SDK. Because the Http Trigger is only supported in functions, But, the scope in which the above scenario trigger runs is the webjobs builder scope. Dispatching comes through the job host and not through the ASP .net Http Pipeline. Setting up in the ASP .Net Http Pipeline will not work here as expected. So it is important that it will be dispatched through the job host and not through the Http server. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
This is functions only. Not web jobs. |
@saikatguha , Thank you for your feedback! As this is functions based scenario, as suggested in the earlier comment, the scope in which the above scenario/code trigger runs is the webjobs builder scope. Dispatching comes through the job host and not through the ASP .net Http Pipeline. Setting up in the ASP .Net Http Pipeline will not work here as expected. So it is important that it will be dispatched through the job host and not through the Http server. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
Dispatch is happening inside the function handler. var testServer = new TestServer(testBuilder);
var testClient = testServer.CreateClient();
var testRequest = new HttpRequestMessage(HttpMethod.Get, "https://localhost:5001/");
var testResponse = await testClient.SendAsync(testRequest); |
@saikatguha , Thank you for your feedback! We will investigate and try to reproduce this scenario and update the findings |
Tagging @fabiocav , for more insights |
Hi @saikatguha , Apologies for the delayed response, We would like to know if you are facing this issue in version 3.0. There is an activity set-up during the invocation and it is likely impacting the flow of information and details as they are going down to the request that's being issued against the Test client. |
Yes in 3 as well. It likely has to do with some global or singleton objects or thread local object since it shows up even when the TestServer/TestClient are completely disconnected from the original dispatch and request objects. |
Hi @saikatguha , Thank you for the information, triaging this issue for further investigation |
Describe your environment.
Steps to reproduce.
Startup
class withservices.AddApplicationInsightsTelemetry()
inConfigureServices
.var server = new TestServer(new WebHostBuilder().UseStartup<Startup>())
await server.CreateClient().SendAsync(new HttpRequestMessage...)
What is the expected behavior?
ApplicationInsights creates RequestTelemetry for the request just as it would for a normal Kestrel host. Additionally, the created
RequestTelemetry
is dependency injected intoHttpContext.Features
in the request processing pipeline. (This is what happens for normal Kestrel server.)What is the actual behavior?
No RequestTelemetry is created. No
RequestTelemetry
is dependency injected intoHttpContext.Features
in the request processing pipeline.Additional context.
Auto-collection of SQL/HTTP dependencies appears to not work in TestServer request handling pipeline (perhaps due to there not being a RequestTelemetry context).
Code that works in console app
Code that does not work in functions app
The text was updated successfully, but these errors were encountered: