new internal framework to export counters dynamically

replaces the old fixed stats structure