powered by Jive Software

Adding a Statistic to Monitoring Plugin

Hi,

I am somewhat mystified by this. I want to add my own statistic to the monitoring plugin page.

In this case, I want to monitor the number of times the word “widget” is said in conversations.

So, I add a plugin which has a packet interceptor. In the packet interceptor, I keep a counter tracking “widget”.

In that plugin I define a local class that extends i18nStatistic that defines a Statistic.

private void addWidgetStatistic() {
// Register a statistic.
Statistic widgetStatistic = new i18nStatistic(WIDGETS_KEY, Statistic.Type.count)
{
public double sample() {
return nwidgets;
}

public boolean isPartialSample() {
return false;
}
};

// Add to StatisticsManager
statisticsManager.addStatistic(WIDGETS_KEY, widgetStatistic);
}

So far, so good… the sample method is called every 5 seconds and seems to be working just fine.

I add definitions of the resource strings for the name,description,type in the resource files.

However, I never see the Statistic show up in the monitoring “All Reports” list.

If I display the StatisticsManager list of Statistics, it is NOT there.

The following line in stats-reporter.jsp implies that the jsp file should be showing this because the same call is used to generate a list of calls to get statistics.

List statList = Arrays.asList(getStatsViewer().getAllHighLevelStatKeys());

What have I missed?

thanks,

jon