- Application Monitoring
- Setting Up Windows Azure Diagnostics
- Accessing Windows Azure Diagnostic Data
- Windows Azure Diagnostics Configuration Demo
- On-Demand Transfer for the Windows Azure Diagnostics Configuration?
- Modifying the Windows Azure Diagnostics Configuration
- Tradeoffs with Windows Azure Diagnostics Configuration
- Windows Azure Service Dashboard
- Scenarios
- Summary
On-Demand Transfer for the Windows Azure Diagnostics Configuration
Now suppose you want to modify the types of information you're tracking. You can do this without having to redeploy your application.
The Tickets sample application specifies that it wants to collect some performance counters and event log information, but it doesn't specify the transfer time. It also specifies that the application should check for changes in the diagnostic configuration every five seconds. Here's the relevant section from the OnStart method:
TimeSpan configurationInterval = new TimeSpan(0, 0, 5); diagConfiguration.ConfigurationChangePollInterval = configurationInterval; PerformanceCounterConfiguration workingSetConfig = new PerformanceCounterConfiguration(); workingSetConfig.CounterSpecifier = @"\Process(" + System.Diagnostics.Process.GetCurrentProcess().ProcessName + @")\Working Set"; workingSetConfig.SampleRate = System.TimeSpan.FromSeconds(30.0); diagConfiguration.PerformanceCounters.DataSources.Add(workingSetConfig); diagConfiguration.WindowsEventLog.DataSources.Add("System!*"); diagConfiguration.WindowsEventLog.DataSources.Add("Application!*");
When you run this application, the only information written to Azure Storage is the current state of the diagnostic monitor. How can we get the data transferred to Azure Storage? We can cause the data to be transferred on demand.
The OnDemandDiagnosticTransfer sample application is used to transfer diagnostic data on demand. If you enter the deployment ID of the Tickets application into the OnDemandDiagnosticTransfer application and run it, you'll find that the performance counters are written to table storage in the WADDiagnosticInfrastructureLogsTable table.
Video 2 describes how to use the OnDemandDiagnosticTransfer application to get diagnostic information for the Tickets application:
You need to upgrade your Flash Player. You need version 9 or above to view this video. You may download it here. You may also see this message if you have JavaScript turned off. If this is the case, please enable JavaScript and reload the page.
Click here to see full-size video.
The following code fragment shows how the DevelopmentDiagnosticManager class is used to transfer the diagnostic information for each role:
DeploymentDiagnosticManager diagnosticManager = new DeploymentDiagnosticManager(storageAccount, deploymentId); ... Dictionary<Guid, RoleInstanceDiagnosticManager> requestIDs = new Dictionary<Guid, RoleInstanceDiagnosticManager>(); DataBufferName[] bufferNames = {DataBufferName.DiagnosticInfrastructureLogs, DataBufferName.Directories, DataBufferName.Logs, DataBufferName.PerformanceCounters,| DataBufferName.WindowsEventLogs}; ... foreach (string roleName in diagnosticManager.GetRoleNames()) { foreach (RoleInstanceDiagnosticManager roleInstanceDiagnosticManager in diagnosticManager.GetRoleInstanceDiagnosticManagersForRole(roleName)) { CancelPendingTransfers(roleInstanceDiagnosticManager); foreach (DataBufferName bufferName in bufferNames) { Guid requestID = roleInstanceDiagnosticManager.BeginOnDemandTransfer (bufferName, transferOptions); requestIDs.Add(requestID, roleInstanceDiagnosticManager); } } }
If you were running this code against the cloud, you would configure the OnDemandDiagnosticTransfer.Properties.Settings in the OnDemandDiagnosticTransfer application's app.config file to use cloud storage and make sure that the Use Development Storage radio button is set to "No." You would also configure the Tickets application to use cloud storage.