def publish
      clock = @registry.clock
      until @should_stop
        start = clock.wall_time
        Spectator.logger.info 'Publishing'
        send_metrics_now
        elapsed = clock.wall_time - start
        sleep @frequency - elapsed if elapsed < @frequency
      end
      Spectator.logger.info 'Stopping publishing thread'
    end
def publish
      clock = @registry.clock
      until @should_stop
        start = clock.wall_time
        Spectator.logger.info 'Publishing'
        send_metrics_now
        elapsed = clock.wall_time - start
        sleep @frequency - elapsed if elapsed < @frequency
      end
      Spectator.logger.info 'Stopping publishing thread'
    end
Publish loop:
   send measurements to the aggregator endpoint ':uri',
   every ':frequency' seconds