Question

I am trying to collect some performance counters from a worker role and WADPerformanceCountersTable is never created.

public override bool OnStart()
{
    // Set the maximum number of concurrent connections 
    ServicePointManager.DefaultConnectionLimit = 12;

    DiagnosticMonitorConfiguration diagConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();

    var procTimeConfig = new PerformanceCounterConfiguration();
    procTimeConfig.CounterSpecifier = @"\Processor(_Total)\% Processor Time";
    procTimeConfig.SampleRate = TimeSpan.FromSeconds(10);

    diagConfig.PerformanceCounters.DataSources.Add(procTimeConfig);
    diagConfig.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);

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

    return base.OnStart();
}

I have tried different log tables like WADLogsTable and WADDiagnosticInfrastructureLogsTable and both are created correctly.

Était-ce utile?

La solution 2

Definitely, this problem is caused by the language of the system. It is explained here:

Error in Azure Emulator when creating Performance Counters

My Windows is the Spanish version, so the name of the performance counters must be in Spanish:

procTimeConfig.CounterSpecifier = @"\Procesador(_Total)\% de tiempo de procesador";

Be careful, this only works locally, not on the cloud.

Autres conseils

This code works fine in my application. Since your ScheduledTransferPeriod is 1 minute are you letting your role run for at least 1 minute? That's when the table will be created.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top