Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Totalizer AggregateCounter #5

Open
tallpsmith opened this issue Jan 30, 2015 · 0 comments
Open

Automatic Totalizer AggregateCounter #5

tallpsmith opened this issue Jan 30, 2015 · 0 comments

Comments

@tallpsmith
Copy link
Contributor

From [email protected] on December 20, 2010 13:37:41

Cowan had a nice idea for an AggregateCounter that does in built totalizing of a set of ‘Instance Domains":

Counter bulkCounter = AggregatedCounters.aggregate(registry, "elasticsearch.index.bulk", "elasticsearch.index.buik.shard" + shardId, Unit.ONE, ...);

with something like:

CompositeCounter aggregate(MonitorableRegistry registry, String topLevel, String subLevel, Unit...) { Monitorable existingCounter = registry.getMonitorable(topLevel);
if (existingCounter == null) {
// Create the counter
} else if (! existingCounter instanceof Counter) {
// Uh-oh, there's an existing metric that's not actually a counter. What idiot made that?
throw new IdiotException();
}

  Counter newCounter = new MonitoredCounter(subLevel, registry, unit....);
  return CompositeCounter.of((Counter) existingCounter, newCounter);
}

? It's not THAT clean but I think it works fine in this case -- just specify the 'bulk' counter at 'sub' counter creation time, but if it already exists reuse it.

Original issue: http://code.google.com/p/parfait/issues/detail?id=5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant