The performance counters are working, but their data is not logged inside WADPerformanceCountersTable.
In the webrole.cs I have
public override bool OnStart()
{
var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
config.PerformanceCounters.DataSources.Add(
new PerformanceCounterConfiguration
{
CounterSpecifier = @"\Processor(_Total)\% Processor Time",
SampleRate = TimeSpan.FromSeconds(5)
});
if (!PerformanceCounterCategory.Exists("MyCustomCounterCategory"))
{
CounterCreationDataCollection counterCollection = new CounterCreationDataCollection();
// add a counter tracking user button1 clicks
CounterCreationData operationTotal1 = new CounterCreationData();
operationTotal1.CounterName = "MyButton1Counter";
operationTotal1.CounterHelp = "My Custom Counter for Button1";
operationTotal1.CounterType = PerformanceCounterType.NumberOfItems32;
counterCollection.Add(operationTotal1);
// add a counter tracking user button2 clicks
CounterCreationData operationTotal2 = new CounterCreationData();
operationTotal2.CounterName = "MyButton2Counter";
operationTotal2.CounterHelp = "My Custom Counter for Button2";
operationTotal2.CounterType = PerformanceCounterType.NumberOfItems32;
counterCollection.Add(operationTotal2);
PerformanceCounterCategory.Create(
"MyCustomCounterCategory",
"My Custom Counter Category",
PerformanceCounterCategoryType.SingleInstance, counterCollection);
Trace.WriteLine("Custom counter category created.");
}
else
{
Trace.WriteLine("Custom counter category already exists.");
}
config.PerformanceCounters.ScheduledTransferPeriod =
TimeSpan.FromMinutes(2D);
config.PerformanceCounters.BufferQuotaInMB = 512;
TimeSpan perfSampleRate = TimeSpan.FromSeconds(30D);
// Add configuration settings for custom performance counters.
config.PerformanceCounters.DataSources.Add(
new PerformanceCounterConfiguration()
{
CounterSpecifier = @"\MyCustomCounterCategory\MyButton1Counter",
SampleRate = perfSampleRate
});
config.PerformanceCounters.DataSources.Add(
new PerformanceCounterConfiguration()
{
CounterSpecifier = @"\MyCustomCounterCategory\MyButton2Counter",
SampleRate = perfSampleRate
});
// Apply the updated configuration to the diagnostic monitor.
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
return base.OnStart();
}
In one of my pages load method I added
var button1Counter = new PerformanceCounter(
"MyCustomCounterCategory",
"MyButton1Counter",
string.Empty,
false);
System.Diagnostics.Trace.WriteLine("Users accessed");
button1Counter.Increment();
I can see the "Users accessed" log in WebLogsTable, also button1Counter.Increment works (I can see it's raw value counting up using logs).
The problem is tat the only performance counter I can see in PerformanceCounters Table is \Processor(_Total)\% Processor Time. If I turn on Verbose monitoring mode in Azure Management Panel, I see some more Performance counters being logged (but only once eery five minutes, but not the custom performance counters )
Why aren't the custom performance counters I created being logged?
Here is the WAD Performanc Counters Table:
Here are the logs:
Here are the Windows Logs (Each log gets repeated 10 times but I removed the duplicates for "The Portable Device Enumerator Service service entered the stopped state." and "The Application Experience service entered the stopped state" and the one regarding time change. " so you can see them. Why create 10 identical logs?)
SO how can I make AZURE put the custom performance routers in the WADPerformanceCoutersTable?
I have been struggling with this for two days. Please help! I use Azure, and not the simulator
Thank you