Logging Http Service Request Queues counters in Azure Diagnostics - iis

I was reading how we can detect request queueing problem in our Azure Service irrespective of level in our service at which it is queued.
http://blog.leansentry.com/2013/07/all-about-iis-asp-net-request-queues/
After reading the above mentioned article, I feel that setting up a monitoring on Http Service Request Queues\CurrentQueueSize performance counter is what I actually want. But now the question is how can I enable logging of this counter in Azure Diagnostics? I read over internet and didn't got much. Any idea?

When you create your project in Visual Studio you will see that you get a <Import moduleName="Diagnostics" /> in your ServiceDefinition.csdef file. This is what enables Windows Azure Diagnostics (WAD) in your deployment.
You will also see a diagnostics.wadcfg file in your Cloud Service project if you expand your Roles. In that wadcfg you can add any perf counters you want, and you will see some examples in there that you can use as a template. For the HTTP queue you would add something like:
<PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes" sampleRate="PT3M" />
Once you do this then the perf counter will be in your storage account and you can query it using any standard storage tool, or one of the WAD tools such as Cerebrata, or you can configure Verbose monitoring from the management portal and then see the counter in the Monitor tab on the management portal.
Also note that Windows Azure Diagnostics 1.2 has just been released and is a good option if you haven't already enabled WAD 1.0 in your project. For more info see http://azure.microsoft.com/en-us/documentation/articles/cloud-services-dotnet-diagnostics/.

Related

Sink configuration for Application Insights for Azure Service Fabric

Where do I update the sink configuration for Azure Service Fabric
https://learn.microsoft.com/en-us/azure/monitoring-and-diagnostics/azure-diagnostics-configure-application-insights?
<SinksConfig>
<Sink name="ApplicationInsights">
<ApplicationInsights>{Insert InstrumentationKey}</ApplicationInsights>
<Channels>
<Channel logLevel="Error" name="MyTopDiagData" />
<Channel logLevel="Verbose" name="MyLogData" />
</Channels>
</Sink>
</SinksConfig>
These settings is set as part of the cluster creation, when you setup a cluster from azure portal, you have to provide Application Insights Key as part of the setup and it will create for your.
If you used ARM templates, you have to configure it on wadCfg section of your template.
Please take a look at this link to know more
Please take into account that these settings are targeted monitor and
log events from the cluster, if are planning to use these settings to
monitor you apps, I would recommend using EventFlow bundled in your
application. Because the cluster generally does not change as often as
your application does.

How to Enable Azure Diagnostics in Cloud Services

I want to enable azure diagnostics for my azure cloud service but I'm a little bit confused.
I read the article : https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-dotnet-diagnostics. I found also that I can enable azure diagnostics in the cloud service properties page by checking "Enable Diagnostics" in the Configuration tab of the cloud service. Also I can go more advanced by clicking the Configure button that shows up when you enable diagnostics.
The cause of my confusion is why in the article says you need to download the WadConfig.xsd file and configure everything and then upload an xml file while you can do the same thing (not sure the same thing) in the cloud service properties configuration?
It seems that Azure SDK 2.5 and later allow us to enable diagnostics and configure diagnostics configuration in UI by right-clicking on the Role and selecting Properties. But developers using Azure SDK 2.4 and previous versions can not manage diagnostic configuration in Visual Studio .
For detailed information, please read this blog.

Trace messages from Website not appearing in Azure Diagnostics

I have an API deployed as an Azure Website (not a worker role). The code for the site has Trace statements dotted through it that I would like to capture in an Azure Table via the Azure Diagnostics.
I'm using Trace.TraceError, Trace.TraceInformation, etc.
I've followed the instructions here, which essentially say that all that is required is to flick the switch in the management portal and set a location for Application Diagnostics: https://azure.microsoft.com/en-us/documentation/articles/web-sites-enable-diagnostic-log/
I have ensured that the Microsoft.WindowsAzure.Diagnostics reference is added to the project, and I have also tried adding the following to the Web.config (even though the instructions don't say this is necessary):
<system.diagnostics>
<trace autoflush="true" indentsize="4" >
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics" />
</listeners>
</trace>
</system.diagnostics>
Despite this, the only output I get to the Azure Blob and/or Table (that I specified in the portal) is the following:
24/06/2015 14:02:49 AlasdairOTCDev Verbose SnapshotHelper::RestoreSnapshotInternal SUCCESS - process 11284 -1
24/06/2015 14:02:48 AlasdairOTCDev Verbose SnapshotHelper::RestoreSnapshotInternal SUCCESS - File.Copy 11284 -1
Trace levels are set to Verbose in the portal.
What am I doing wrong, and how can I debug this?
Many thanks for any assistance that can be provided as I'm rapidly running out of hair to pull out...
It turns out the root of the problem was with our build.
There was an issue where our build script was not compiling the TRACE symbol. Builds compiled locally did include this (which is why it all appeared to work locally) but when we built and deployed to Azure it was being missed out.
Without the TRACE symbol, none of the logging statements were activated.
You don't need the reference to Microsoft.WindowsAzure.Diagnostics in your project. That is for Cloud Services and the article you referenced does not mention it since it is for Azure Web Apps (formerly Websites).
Assuming you are using an Azure Web App (not a cloud service web role), then you have to use the current Azure Management portal at https://manage.windowsazure.com if you want to configure your web app to store application diagnostics to an Azure Storage Table or Azure Storage Blob Container. In the configure page for the web app, your configuration should look like this for a table storage.
(Currently, the preview portal at https://portal.azure.com only lets you configure application diagnostics logging using the web app's file system)
For anyone who still encounters this problem, besides for the excellent answers given on this page (enable tracing on azure, and making sure TRACE is set to true in your build), make sure you actually flush the traces!
In your code you need something like this:
System.Diagnostics.Trace.TraceError("Can you see me?");
System.Diagnostics.Trace.Flush();
Or
System.Diagnostics.Trace.AutoFlush = true;
System.Diagnostics.Trace.TraceError("Can you see me?");

Azure Cloud Service monitoring settings unavailable

I can't set the level of monitoring in production. I enabled diagnotics in WebRole project(also with performance counters and Azure Storage connection). I check azure storage tables - data is written. How to enable changing monitoring level?
P.S. I user Azure SDK 2.5
There is a compatibility issue with SDK 2.5 that causes the verbose monitoring settings to be unavailable in the portal. To resolve this you should be able to add the following configuration setting to your csdef/cscfg and set it to a valid storage account:
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=diagstore;AccountKey=+Pgl4GVRy01UUy9uL4cFqsufI/79xsqBAHkNmYsDycfY8Qs5dZXzqgs8AZl1XsJWvGgEUsW/smz1DvswusCxjw==" />
SDK 2.6 will resolve this issue.

Web Service bound to Web role in Windows Azure?

I am stuck with the question if a Web Service implemented in Windows Azure have to run in a Web role, or is it possible to have it run in a Worker role ? If so, is there an alternative way to monitor the http-traffic, because a Worker role don't give access to the IIS logs ?
BR/Christer
You can run your web services in a Worker Role via ServiceHost (you can also run them with ServiceHost in a Web Role if you wanted). By default, IIS isn't activated in a Worker Role, which is why you don't have IIS logs.
There are several WCF performance counters you could look at, but you probably need to look at networking performance counters for byte-level details.
EDIT: To address question of how to access performance counters: using Remote Desktop should be reserved for debugging purposes. Instead, it's better to collect performance counters with the Diagnostic Monitor, then publish them to Windows Azure Table storage for external access. See this article for a quick intro to Windows Azure and performance counters. The article shows how to manually query the performance counters (which get published to WADPerformanceCountersTable). You can also view this table through Visual Studio (once you install the Windows Azure tools), or through 3rd-party tools such as Cerebrata Azure Diagnostics Manager.

Resources