private void runSensors()

in metrics-core/src/main/java/software/amazon/swage/metrics/jmx/MXBeanPoller.java [164:181]


    private void runSensors() {

        //TODO: should there be per-emit context attributes?
        //TODO: or should we have one Context and only close at the very end?
        MetricContext metricContext = metricRecorder.context(this.updaterContext);

        //TODO: emit each sensor on its own scheduled thread instead of all synchronously?
        for(Sensor sensor : sensors) {
            try {
                sensor.sense(metricContext);
            } catch (SenseException e) {
                // Problem with particular sensor, continue on to next
                log.warn("Sensor {} failure", sensor.getClass().getCanonicalName(), e);
            }
        }

        metricContext.close();
    }