A couple weeks ago I’ve asked a question in Sitecore Stackexchange explaining that the Sitecore 9.1 PaaS our team has provisioned in Azure was not providing data to the Application Insights.
I went through the existing post Accessing log files in application insitghts for Sitecore 9 in Azure app service which allowed me to execute some sort troubleshooting, and in summary here are the steps I reproduce
1.Check appinsights.instrumentationkey in ConnectionStrings.config
The idea is to verify if is not going to a different Application Insights or a typo occurred somewhere. Please check the Instrumentation Key from Azure Portal and at the ConnectionStrings.config
2.Check the Daily Cap
4.Enable Live Metrics Stream
5.Enable Application map
On all roles, in the
wwwroot/ApplicationInsights.config, uncomment the line containing the
DependencyTrackingTelemetryModule. A caution though – it nearly doubles your ApplicationInsights data usage.
6.Querying Application Insights
– Go to the Application Insights resource and click the Analytics button on the Overview tab.
– The query builder will open. Paste in the following query:
| project timestamp, message, severityLevel, customDimensions.Role, customDimensions.InstanceName
| order by timestamp desc
Select the time range and click Run
Another thing is that the Search shows results from Sitecore
Michael Baranov suggested the following
It’s a bug in 9.1.
To fix this you need:
Add telemetry module to ApplicationInsights.config
<Add Type="Microsoft.ApplicationInsights.Web.AspNetDiagnosticTelemetryModule, Microsoft.AI.Web"/>
Add module to web.config under system.webserver
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="integratedMode,managedHandler" />
And I did what he said but an Yellow Screen of Death showed up “Could not load file or assembly ‘Microsoft.AspNet.TelemetryCorrelation’ or one of its dependencies. The system cannot find the file specified” and I never heard back from him.
For your reference if you face the same issue Ticket #527731
IMPORTANT: The following approach DOES NOT work without the hotfix provided by Sitecore, don’t give a shot by simply changing the files specified in the step “after the hotfix has been installed”
Accordingly to the Sitecore response
Be aware that the hotfix was built specifically for Sitecore XP 9.1 Initial Release, and you should not install it on other Sitecore versions or in combination with other hotfixes, unless explicitly instructed by Sitecore Support.
Note that you need to extract ZIP file contents to locate installation instructions and related files inside it.
Unless stated differently in the installation instructions, the hotfix should be installed on CM instance and then synced with other instances using your regular development practices
The hotfix should be install as a package, and will replace the following DLL libraries:
After the hotfix has been installed these steps must be taken
1.Edit ApplicationInsights.config. Under the ApplicationInsights\TelemetryModules paste the following line at the bottom of the section
<Add Type="Microsoft.ApplicationInsights.Web.AspNetDiagnosticTelemetryModule, Microsoft.AI.Web" />
2.Edit web.config. Under the configuration/system.webServer/modules after
<remove name="ApplicationInsightsWebTracking"/>, insert the following string:
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="integratedMode,managedHandler"/>
Once you modify the files, restart the App Services and try to access it again to generate data for the Application Insights
References and thanks
Mark Gibbons to write a terrific answer in how Application Insights works, and ways to troubleshoot it
Frank Rosario for opening the ticket with Sitecore
Sitecore for the amazing support
I hope you liked it, and I’ll see you on my next post!