How do I enable and view SqlClient traces on Azure?
I have a web app hosted on Azure and it uses SqlClient.
I know that we can use XPerf/PerfView to collect and view traces. But I am not sure how to use it when the web app is hosted on Azure app service.
If it is a web app you could use Application Insights to track calls made using SqlClient. These calls are autocollected as described here. Do mind that, in order for full sql query tracking, you will need to opt-in for this feature as described here:
services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => { module. EnableSqlCommandTextInstrumentation = true; });
As a bonus you get detailed insights regarding your apps workings, performance and failures.
Related
Is it possible to access analytics such as browser, dates and times of site hits, IP addresses, etc.?
From the docs here, it looks like Azure App Insights are only available for Static Web Apps that use Azure Functions. I just have a static website, no API's.
Here is the message I'm shown when trying to enable App Insights:
Ideally, I want to set a Diagnostic Setting and use Azure Log Analytics to view analytics.
How can I get deeper analytics on a Static Web App without a Function API?
EDIT 1: I'd like to at least capture the number of hits somewhere.
Azure Metrics is grabbing them, but doesn't seem to expose logs anywhere, only these visualizations.
Ended up going with:
A stand-alone Application Insights instance
Azure Static Apps does not allow App Insights to be turned on for the resource unless there is an Azure Function involved(?)
Added this App Insights Javascript snippet to each page of the static site.
Got some great help from #MSNEV!
This is the solution I was looking for.
What is the use case for Azure application insights or log analytics?
I am using APIM and Azure Functions and want to perform logging for requests. Which one is the best fit, application insights or log analytics?
https://learn.microsoft.com/en-gb/azure/azure-monitor/overview
Update
In particular, any info on Azure application insights vs log analytics used for APIM?
What used to be known as Application Insights and Log Analytics independent offerings - are now a part of Azure Monitor. We're actively merging both platforms.
For instance, Analytics exploration part is exactly the same (same backend, same UX, same capabilities, just different data schema). Alerts are the same. Some experiences are still different (for instance, app experiences such as Application Map).
Example: in Azure Monitor Overview (https://learn.microsoft.com/en-gb/azure/azure-monitor/overview):
"Log Analytics" is referred as a feature and not what used to be known as Log Analytics as a product. For instance, Application Insights resources provide the same "Log Analytics" feature.
For Azure Functions / APIM the native integration with Azure Monitor is through Application Insights.
Update (October, 2020). Application Insights can now store data in Log Analytics workspaces. Now many workspace related features are available to Application Insights resources. How to migrate.
Azure function better to go with application insights and if you working with kubernetes cluster choose Log analytics work space
Azure Functions offers built-in integration with Azure Application Insights to monitor functions.
So for azure function, you'd better use application insights, which is easy configure.
Details are here.
Application Insights
Application Insights is an Application Performance Management (APM) service, that you use to monitor your application. It helps to detect performance anomalies, has analytic abilities, and can help you understand how users interact with your application.
Not only can it collect telemetry data from your application, but it can also collect information from the application host, Azure Diagnostics, or Docker logs. It’s also nice that you can use Application Insights to set up tests that send requests to your website/service to check for availability (and receive a notice if these fail).
One of the most powerful things that I’ve noticed in my use of Application Insights (which is monitoring this blog), is the Smart Detection feature. This feature proactively analyzes and detects changes in your application. So even if you hadn’t set up an Alert of monitoring of a specific metric, it can pick it up and react to it.
Is it possible to use the application insights profiler on azure functions? Either via the portal or a more manual means.
I haven't found a way in the portal and I haven't seen explicit documentation stating either way nor github tickets.
I'd assume probably not, as many of the automagic features of application insights don't seem to be supported yet.
If it's not possible, out of interest is it because of the azure functions sandbox not giving enough permissions for profiling?
If it's not possible, out of interest is it because of the azure functions sandbox not giving enough permissions for profiling?
The application insights profiler is just supported in web app. The Azure function belongs to function app. So you can not use profiler in Azure function.
Profiler currently works for ASP.NET and ASP.NET Core web apps that are running on Web Apps.
If you want to suggest Microsoft to add some new features like app insights profiler in app insights in azure function, you could put your suggestion in Github.
Next steps
Application Insights is now GA’d and ready for production workloads. We’re also listening for any feedback you have. Please file it on our GitHub. We’ll be adding some new features like better sampling controls and automatic dependency tracking soon.
I am having problems with the number of pooled connections in my Azure web app. And it will help me a lot if I can see the number of pooled connections so I can understand how it relates to the application usage.
On classic Windows machines I can view the ADO.NET performance counter "NumberOfPooledConnections" using the "Performance Monitor" tool. But I could not figure out how to do the same thing when I am using an Azure App Service.
Unfortunately, performance counters are not supported on Azure App Services due its multitenant nature of it.
See: Access performance counter programmatically in Microsoft Azure web app
Three things that you may want to try however is:
Enable Application Insights (https://learn.microsoft.com/en-us/azure/application-insights/app-insights-performance-counters) or New Relic.
If your application is for test purpose, I can also suggest to deploy to cloudservice where you will have access to the full VM and traditional Perf counter
Try deploying to App Service Environments & I believe you will get access thru programmatically at least. This does get expensive.
I am planning use Semantic Logging Application Block in Web API hosted on Azure Web Role. I am planning to extend event source and create few event sources of mine.
I want to make sure that this component SLAB + Custom Event Source works properly on Azure Web Role.
Anyone has used this component on azure and want to share their experience?
I use SLAB in my apps, however be sure that it can be used in the azure service you need to ask Microsoft support.
http://azure.microsoft.com/en-us/documentation/articles/choose-web-site-cloud-service-vm/
for example at the bottom of the list you see that
Can listen to ETW events
is not supported for Web Sites but it seems to be fine for Web Roles. However, double check it with Azure support as caution is never enough.
Regards