 
         # the full statistic
         @_data  = {}
-        @_lastCpuUsage = null
 
         @_collectors = []
 

        setup monitoring of some components
        called by the hub *after* setting up the DB, etc.
        ###
        num_clients_gauge = new_gauge('hub_clients_count', 'Number of connected clients')
        {number_of_clients} = require('./hub_register')
        @register_collector ->
            num_clients_gauge.set(number_of_clients())

        cpu_seconds_total = new_counter('hub_cpu_seconds_total', 'Total number of CPU seconds used', ['type'])
        @register_collector =>
            if not process.cpuUsage?
                return
            #cpuUsage = process.cpuUsage(@_lastCpuUsage)
            #cpu_seconds_total.labels('user').inc(cpuUsage.user)
            #cpu_seconds_total.labels('system').inc(cpuUsage.system)
		    #@_lastCpuUsage = cpuUsage

    _collect: ->
        # called by @_update to evaluate the collector functions
        for c in @_collectors
            c()

    # every FREQ_s the _data dict is being updated
    # e.g current value, exp decay, later on also "intelligent" min/max, etc.


# This is a small helper class to record real-time metrics about the hub.
# It is designed for the hub, such that a local process can easily check its health.
# After an initial version, this has been repurposed to use prometheus.
# It wraps its client elements and adds some instrumentation to some hub components.

fs         = require('fs')
path       = require('path')
underscore = require('underscore')
{defaults} = misc = require('smc-util/misc')

