Azure Diagnostics - def vadcfg runtime

I am trying to understand various ways to configure Diagnostics in Windows Azure. So far, I have installed .wadcfg diagnostics that Azure uses properly when I get its contents in an xml block stored in the diagnostics in the wad-control container container (and the tables are updated with the correct refresh rate).

Now I would like to redefine some fields from cscfg, for example, to increase the log transmission period for all instances (without updating each container file of the cotton file, which will be deleted in case of an instance to recycle btw). Therefore, in my WebRole.Run (), I get the parameter from RoleEnvironment.GetConfigurationSettingValue () and try to apply it to the current configuration; but my problem is that the values ​​that I read from DiagnosticMonitor.GetDefaultInitialConfiguration () do not match the contents of my .wadcfg diagnostics, and setting new values ​​there has no effect.

Can someone explain the relationship between what is taken from diagnostics.wadcfg and the values ​​that you can set at runtime?

thanks

+4
source share
3 answers

GetDefaultInitialConfiguration () will not return your current settings, because because its name indicates that it accepts the default configuration. You should use the GetCurrentConfiguration method if you need to accept the configuration that is in place.

However, if you just need to increase the transfer, you can use, for example, the Cerebrata Azure Diagnostics Manager to quickly launch on-demand transfer of your roles.

You can also use the Windows Azure Diagnostics Management cmdlets for powershell. Check out this article .

Hope this helps!

+3
source

To use the values ​​in the wadcfg file, the following code code can be used to access the current MonitorConfiguration diagnostics:

var cloudStorageAccount = CloudStorageAccount.Parse( RoleEnvironment.GetConfigurationSettingValue(WADStorageConnectionString)); var roleInstanceDiagnosticManager = cloudStorageAccount.CreateRoleInstanceDiagnosticManager( RoleEnvironment.DeploymentId, RoleEnvironment.CurrentRoleInstance.Role.Name, RoleEnvironment.CurrentRoleInstance.Id); var dmc = roleInstanceDiagnosticManager.GetCurrentConfiguration(); // Set different logging settings dmc.Logs.... dmc.PerformanceCounters.... // don't forget to update roleInstanceDiagnosticManager.SetCurrentConfiguration(dmc); 
+2
source

Boris Lipschitz code now does not work ( Violation of changes in Windows Azure Diagnostics (SDK 2.0) ): "The DeploymentDiagnosticManager constructor now accepts a connection string to the storage account and not to the CloudStorageAccount object."

Updated code for SDK 2.0 +:

  var roleInstanceDiagnosticManager = new RoleInstanceDiagnosticManager( // Add StorageConnectionString to your role settings for this to work CloudConfigurationManager.GetSetting("StorageConnectionString"), RoleEnvironment.DeploymentId, RoleEnvironment.CurrentRoleInstance.Role.Name, RoleEnvironment.CurrentRoleInstance.Id); var dmc = roleInstanceDiagnosticManager.GetCurrentConfiguration(); // Set different logging settings dmc.Logs.... dmc.PerformanceCounters.... // don't forget to update roleInstanceDiagnosticManager.SetCurrentConfiguration(dmc) 
0
source

Source: https://habr.com/ru/post/1402397/


All Articles