1
votes

I spent entire day trying to set up Windows Azure Diagnostic module. I set up WAD using diagnostics.wadcfg for both worker and web role. This wadcfg file properly copying to bin folders. This is my wadcfg files for WorkerRole and WebRole (links for more clear question). For diagnostic configuration initialization I use very simple and generic call: just

DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString");

in WorkerRole's and WebRole's (both classes - descendants of RoleEntryPoint) OnStart()

Connection string set up properly, both role sections in Service configuration contains LocalResource section

<LocalResources>
    <LocalStorage name="DiagnosticStore" sizeInMB="5000" cleanOnRoleRecycle="false"/>
</LocalResources>

Unfortunatey this not working as I expecting: no IIS logs shipped, no Custom directory content shipped to blobs, perfomance counters and WindowsEventLogs once shipped properly, but then halted (no more rows added since few initial shippings)

Also wad-control-container have pretty strange xml configuration for both roles: WorkerRole and WebRole.

What I'm missing and what the proper way to initialize Diagnostic via diagnostics.wadcfg ?

Why stored configuration so different from diagnostics.wadcfg format?

Should I run DiagnosticMonitor.SetCurrentConfiguration() after monitor initialization to store current configuration in Blob?

1

1 Answers

4
votes

If you want to use the diagnostics.wadcfg (my preferred method for role instance defaults), then you should strip all the code out of your OnStart(). There is actually no reason to call Start anymore if you are just passing defaults. The agent will automatically start with defaults even if you did nothing (assuming you include the plugin).

Also, there is no reason to set the LocalResource anymore either unless you specifically need more than 4GB of disk quota space. In that case, you can set a larger value. By default, the Diagnostics agent will assign itself 4GB of a local resource.

To use the diagnostics.wadcfg, simply mark it as content or copy local (make sure it gets packaged). It needs to be at the root of the worker role (next to Worker.cs) or in the bin directory for a web role. Assuming you have configured it correctly, it will use those values as the defaults if it does not already find a configured set of values in blob storage.

Three notes:

  1. You cannot use custom performance counters here (unless they are already installed on the machine). The agent runs before most startup scripts that would install custom counters, so if you configure custom counters in the diagnostics.wadcfg, you are too early and it will fail.
  2. Be careful with your quota numbers. Stuff will fail if you accidentally assign a total of more than 4GB to your data sources (unless you change the quota limit).
  3. Diagnostics.wadcfg is used as the last default. If you set a value (which you are doing programmatically), it will use that first. If it finds a value already in blob storage (think reboot), it will use that. It only works when nothing has been set - no defaults already exist.