{"action":"opened","issue":{"url":"https://api.github.com/repos/performancecopilot/parfait/issues/5","labels_url":"https://api.github.com/repos/performancecopilot/parfait/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/performancecopilot/parfait/issues/5/comments","events_url":"https://api.github.com/repos/performancecopilot/parfait/issues/5/events","html_url":"https://github.com/performancecopilot/parfait/issues/5","id":56083813,"number":5,"title":"Automatic Totalizer AggregateCounter","user":{"login":"tallpsmith","id":203682,"avatar_url":"https://avatars.githubusercontent.com/u/203682?v=3","gravatar_id":"","url":"https://api.github.com/users/tallpsmith","html_url":"https://github.com/tallpsmith","followers_url":"https://api.github.com/users/tallpsmith/followers","following_url":"https://api.github.com/users/tallpsmith/following{/other_user}","gists_url":"https://api.github.com/users/tallpsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/tallpsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallpsmith/subscriptions","organizations_url":"https://api.github.com/users/tallpsmith/orgs","repos_url":"https://api.github.com/users/tallpsmith/repos","events_url":"https://api.github.com/users/tallpsmith/events{/privacy}","received_events_url":"https://api.github.com/users/tallpsmith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/performancecopilot/parfait/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/performancecopilot/parfait/labels/imported","name":"imported","color":"FFFFFF"},{"url":"https://api.github.com/repos/performancecopilot/parfait/labels/Priority-Medium","name":"Priority-Medium","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-30T20:57:43Z","updated_at":"2015-01-30T20:57:43Z","closed_at":null,"body":"_From [tallpsm...@gmail.com](https://code.google.com/u/114564928965221180928/) on December 20, 2010 13:37:41_\n\nCowan had a nice idea for an AggregateCounter that does in built totalizing of a set of ‘Instance Domains\":\r\n\r\n\r\nCounter bulkCounter =  AggregatedCounters.aggregate(registry, \"elasticsearch.index.bulk\", \"elasticsearch.index.buik.shard\" + shardId, Unit.ONE, ...);\r\n\r\nwith something like:\r\n\r\n   CompositeCounter aggregate(MonitorableRegistry registry, String topLevel, String subLevel, Unit<?>...) {\r\n      Monitorable<?> existingCounter = registry.getMonitorable(topLevel);\r\n      if (existingCounter == null) {\r\n         // Create the counter\r\n      } else if (! existingCounter instanceof Counter) {\r\n         // Uh-oh, there's an existing metric that's not actually a counter. What idiot made that?\r\n         throw new IdiotException();\r\n      } \r\n\r\n      Counter newCounter = new MonitoredCounter(subLevel, registry, unit....);\r\n      return CompositeCounter.of((Counter) existingCounter, newCounter);\r\n    }\r\n\r\n? 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.\n\n_Original issue: http://code.google.com/p/parfait/issues/detail?id=5_"}}