microsoft / ApplicationInsights-Profiler-AspNetCore

Application Insights Profiler sample and documentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Application is starting and shutting down messages written when using profiler.

xcellsoft opened this issue · comments

Since enabling the profiler in a dotnet 3.1.5 I see multiple messages throughout the day indicating the application is shutting down and starting up. The shutdown always appears after the Service Profiler trace uploaded message and the startup comes before.

The application is not shutting down or starting up so I am at a loss why these appear and obviously its a concerning message in our production environment.

Any insight would be appreciated.

snippet from log where the erroneous messages appear.

info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: D:\Qualexio\Omnicore\Src\Qualex.OmniCore.Main
Application Insights Telemetry: {"name":"AppMetrics","time":"2021-01-29T15:04:31.8087422Z",...
Application Insights Telemetry: {"name":"AppMetrics","time":"2021-01-29T15:04:31.8118065Z",...
Application Insights Telemetry: {"name":"AppMetrics","time":"2021-01-29T15:04:31.8152583Z",...
info: Microsoft.ApplicationInsights.Profiler.Uploader.TraceUploader[0]
      Service Profiler trace uploaded.
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...

@xcellsoft Thanks for filing the issue. Could you please give us more info about the application for troubleshooting:

  • What's the NuGet package version of Profiler used: (2.2.0-beta6?)
  • What's the host of the application? (Azure WebSites? Kubernetes? AKS?)
  • Is it a Windows Application or Linux Application? Is it running inside a container?
  • If it is running inside a container, is there a health probe for it?
  • Do you see 'Exceptions' in your application insights around the shutting down of the application?

Those info will help us come up troubleshoot strategies. Thanks!

  • What's the NuGet package version of Profiler used: (2.2.0-beta6?) - YES 2.2.0-beta6
  • What's the host of the application? (Azure WebSites? Kubernetes? AKS?) - I ran it local on my windows desktop via dotnet run and it displayed the same errors so it's not related to environment. It is also happening within a linux container hosted in azure app services. In either event the application is not really shutting down or starting.
  • Is it a Windows Application or Linux Application? Is it running inside a container? Both, see previous answer.
  • If it is running inside a container, is there a health probe for it? Yes and no failures recorded. In production there about 45K health probe calls per day due to frontdoor.
  • Do you see 'Exceptions' in your application insights around the shutting down of the application? NO, it is isolated with the profile and appears to be an anomaly when it performs/uploads traces. The traces appear normally in App Insights.

@xcellsoft, Oh~ I see what you are seeing now. It is totally normal because that is the Uploader's exiting. It is not from your application.
It is a level of info logs for the Uploader process - we switched to generic hosted application for the uploader in the recent versions. And that is is revealing the fact the uploader finished running and quits - which is why your application wasn't impacted.

Do you feel that annoying? Do you think it the best we hide the info level of messages from uploader?

It is very concerning in my opinion to see that message in your production logs (I had a shock moment at first) as we expect those logs to be very clean especially when logging is set to Warning and you see messages in there you assume they are warnings or errors not info from a secondary process.

Yes, I really feel these messages should be suppressed.

Also, it fills up the logs with erroneous data making it more difficult to find/read real warnings/errors.

Do you know which version this is resolved in? I wouldn't have a problem updating in the 3.5 version line, still holding off a little on 5 to give it some time to be fleshed out a little more.

Hey @xcellsoft, the issue is not in .NET Core runtime, it is in this package. I'll issue an fix for suppress the loggings from the uploader, and it will released in the next version - 2.2.0-beta7, supposedly. And you will have to update the reference to Microsoft.ApplicationInsights.Profiler.AspNetCore to that version. I'll close this issue once the package is released.

Sounds good, thanks for the quick turn around.