When logging, the App Insights logger would look for an HttpRequest attached to the current logging scope. This request was attached by the Functions host. We'd use that to log more interesting request details like StatusCode, UserAgent, etc. In v2, this has changed as there's no guarantee that the Response has been written by the time the function execution has completed. That was leading to some tough scenarios.
In order to get tests running again, I've removed this behavior so we can take another look at how we scope the requests and the function invocations to see if we can get this to work more nicely.
Pragna will link this to other related issues.
Here is the related issue #2272 to add httprequest traces to systemlogs
Note that this may require some refactoring of our HTTP pipeline. The problem is that we have no idea what the response code is when we log our 'Request' to App Insights. So while we may be able to log the ASP.NET logs, we won't be able to "merge" those with our function result. Not sure what the correct approach is here, other than making sure we've completed the Request before we actually signal that the function is complete.
@lmolkova -- we can close this now that we track HTTP requests in the WebJobs/dev branch, right?
this is not addressed yet - I'll submit PR to webjobs when ApplicaitonInsights 2.8 is released (with distributed tracing support)
Looks like it's out! https://github.com/Microsoft/ApplicationInsights-dotnet/releases/tag/2.8.0
We're super eager to see this addressed.
Likewise. Do we have an ETA for this?
We're reviewing a PR right now that will re-introduce this: https://github.com/Azure/azure-webjobs-sdk/pull/1965.
Great to see that the PR is merged! Are there any followups pending? Can you give an updated indication on the status of this issue, and rough time scale of next release?
We had to revert this fix due to a few issues discovered during testing. We will be working to get this back in for our next release.
Going to move this to the Triaged milestone while we wait for some fixes in the App Insights SDK.
https://github.com/Azure/azure-webjobs-sdk/pull/2073 seems to be take two of fixing this.
It's not only Response details that are missing. We found things like URL (=> requests.url) and HTTP Method (=> requests.customDimensions.HttpMethod) are missing too.
~#2073~ https://github.com/Azure/azure-webjobs-sdk/pull/2073 will address this as well. We are waiting on a portal change before we can fully merge the PR (it would break the query we use in the Functions "Monitor" page). It is effectively changing HTTP-triggered function telemetry to look like the standard App Insights RequestTelemetry.
@brettsam, did you link the right issue? #2073 was moved and then closed as wontfix, and doesn't seem related to what you wrote.
Whoops -- meant https://github.com/Azure/azure-webjobs-sdk/pull/2073.
Bumping to Sprint 45. We're unblocked now but tracking down the last few bugs.
This is out in PR now, but moving to 46 as the work won't be completed until then.
This was committed with #4214 and is being released with https://github.com/Azure/azure-functions-host/releases/tag/v2.0.12408
Most helpful comment
This was committed with #4214 and is being released with https://github.com/Azure/azure-functions-host/releases/tag/v2.0.12408