 			if PromWrapper.ttlInMinutes
 				if process.env['DEBUG_METRICS']
 					console.log("Sweeping metrics")
-				for key in Object.keys(metrics)
-					metrics[key].sweep()
+				metrics.forEach (metric, key) =>
+					metric.sweep()
 	60000)
 
 

	registry: registry

	metric: (type, name) ->
		registry.getSingleMetric(name) || new MetricWrapper(type, name)

	collectDefaultMetrics: prom.collectDefaultMetrics


class MetricWrapper
	constructor: (type, name) ->
		metrics[name] = this
		@name = name
		@instances = {}
		@lastAccess = new Date()
		@metric = switch type
			when "counter"

prom = require('prom-client')
registry = require('prom-client').register
metrics = new Map()


optsKey = (opts) ->
