This method can be used to signal this MetricFetcher that the metrics are still in use and should be updated.
511173
@Override
	public void update() {
		synchronized (this) {
			long currentTime = System.currentTimeMillis();
			if (currentTime - lastUpdateTime > updateInterval) {
				lastUpdateTime = currentTime;
				fetchMetrics();
			}
		}
	}
1073210
def on_epoch_end(self, last_metrics, **kwargs):
        ""
        return add_metrics(last_metrics, [s.smooth for k,s in self.smootheners.items()])
506107
private void handleTMasterLocationRefreshMessage(
      Metrics.MetricPublisher request,
      Metrics.TMasterLocationRefreshMessage tMasterLocationRefreshMessage) {
    TopologyMaster.TMasterLocation oldLocation =
        (TopologyMaster.TMasterLocation)
            SingletonRegistry.INSTANCE.getSingleton(TMASTER_LOCATION_BEAN_NAME);

    TopologyMaster.TMasterLocation newLocation = tMasterLocationRefreshMessage.getTmaster();

    if (oldLocation == null) {
      // The first time to get TMasterLocation

      // Register to the SingletonRegistry
      LOG.info("We received a new TMasterLocation. Register it into SingletonRegistry");
      SingletonRegistry.INSTANCE.registerSingleton(TMASTER_LOCATION_BEAN_NAME, newLocation);

      // Update Metrics
      serverMetricsCounters.scope(SERVER_NEW_TMASTER_LOCATION).incr();

    } else if (oldLocation.equals(newLocation)) {
      // The new one is the same as old one.

      // Just Log. Do nothing
      LOG.info("We received a new TMasterLocation the same as the old one. Do nothing.");
    } else {
      // Have received TMasterLocation earlier, but it changed.

      // We need update the SingletonRegistry
      LOG.info("We received a new TMasterLocation. Replace the old one.");
      LOG.info("Old TMasterLocation: " + oldLocation);
      SingletonRegistry.INSTANCE.updateSingleton(TMASTER_LOCATION_BEAN_NAME, newLocation);

      // Update Metrics
      serverMetricsCounters.scope(SERVER_NEW_TMASTER_LOCATION).incr();
    }

    LOG.info("Current TMaster location: " + newLocation);

    // Update Metrics
    serverMetricsCounters.scope(SERVER_TMASTER_LOCATION_RECEIVED).incr();
  }
1245014
void checkNeedsPropertiesReloading(long now) {
        if (CACHING_VALIDITY_MS > 0 && now - lastCachedTime > CACHING_VALIDITY_MS) {
            this.rampUp = owner.getRampUpSeconds();
            this.hold = owner.getHoldSeconds();
            this.steps = owner.getStepsAsLong();
            this.maxConcurr = owner.getTargetLevelAsDouble();
            this.defaultShiftRampup = JMeterUtils.getPropDefault("dynamic_tg.shift_rampup_start", 0L);
            this.lastCachedTime = System.currentTimeMillis();
        }
    }
1030838
def update_metric(self, metric, labels, pre_sliced=False):
        """"""
        for current_exec, (texec, islice) in enumerate(zip(self.train_execs, self.slices)):
            if not pre_sliced:
                labels_slice = [label[islice] for label in labels]
            else:
                labels_slice = labels[current_exec]
            metric.update(labels_slice, texec.outputs)
457564
def flush(self, log=False):
        
        if not self.my_metrics:
            logger.debug("Flushing - no metrics to send")
            return True

        now = int(time.time())
        if self.last_failure and self.last_failure + self.metrics_flush_pause > now:
            if not self.log_metrics_flush_pause:
                date = datetime.datetime.fromtimestamp(
                    self.last_failure).strftime(self.date_fmt)
                logger.warning("Metrics flush paused on connection error "
                               "(last failed: %s). "
                               "Inner stored metric: %d. Trying to send...",
                               date, self.metrics_count)
                self.log_metrics_flush_pause = True
            return True

        try:
            logger.debug("Flushing %d metrics to Graphite/carbon", self.metrics_count)
            if self.carbon.send_data():
                self.my_metrics = []
            else:
                logger.warning("Failed sending metrics to Graphite/carbon. "
                               "Inner stored metric: %d", self.metrics_count)
                if log:
                    logger.warning("Failed sending metrics to Graphite/carbon. "
                                   "Inner stored metric: %d", self.metrics_count)
                return False
            if self.log_metrics_flush_pause:
                logger.warning("Metrics flush restored. "
                               "Remaining stored metric: %d", self.metrics_count)
            self.last_failure = 0
            self.log_metrics_flush_pause = False
        except Exception as exp:  # pylint: disable=broad-except
            if not self.log_metrics_flush_pause:
                logger.warning("Failed sending metrics to Graphite/carbon. "
                               "Inner stored metric: %d", self.metrics_count)
            else:
                date = datetime.datetime.fromtimestamp(
                    self.last_failure).strftime(self.date_fmt)
                logger.warning("Metrics flush paused on connection error "
                               "(last failed: %s). "
                               "Inner stored metric: %d. Trying to send...",
                               date, self.metrics_count)

            logger.warning("Exception: %s", str(exp))
            self.last_failure = now
            return False
        return True
1006317
public boolean updateMetric(Metric metric) {
        String metricName = metric.getName();
        checkMetricIsEmpty(metricName);
        QueryPart<Metric> queryPart = new Query<Metric>("metrics")
                .path(metricName, true);
        return httpClientManager.updateMetaData(queryPart, patch(metric));
    }
577177
static void flushMetricsLogger(final MetricsLogger metricsLogger) {
        metricsLogger.flushToString(MetricsManager::queue);
        MetricsManager.rootMetricsLogger.flushToString(MetricsManager::queue);
    }
255211
private void handleChangeManagerStatusRequest(final HttpServletRequest req,
      final Map<String, Object> ret, final boolean enableMetricManager) {
    try {
      logger.info("Updating metric manager status");
      if ((enableMetricManager && MetricReportManager.isInstantiated())
          || MetricReportManager.isAvailable()) {
        final MetricReportManager metricManager = MetricReportManager.getInstance();
        if (enableMetricManager) {
          metricManager.enableManager();
        } else {
          metricManager.disableManager();
        }
        ret.put(STATUS_PARAM, RESPONSE_SUCCESS);
      } else {
        ret.put(RESPONSE_ERROR, "MetricManager is not available");
      }
    } catch (final Exception e) {
      logger.error(e);
      ret.put(RESPONSE_ERROR, e.getMessage());
    }
  }
1176198
def on_epoch_end(self, last_metrics, **kwargs):
        ""
        return add_metrics(last_metrics, self.val/self.count)
626659
public void markForUpdate() {
        if (!updated) {
            updated = true;
            
            // Make a copy of the underlying property map, if non-null
            if (properties != null) {
                properties = properties.copyOf();
            }

            tx.markForPropertyUpdate(this);
        }
    }
890619
@Override
  public boolean isMonitoring() {
    boolean ret = true;
    for (MetricsContext ctxt : subctxt) {
      ret &= ctxt.isMonitoring();
    }
    return ret;
  }
669463
def on_epoch_end(self, last_metrics:MetricsList, iteration:int, **kwargs)->None:
        ""
        self._write_metrics(iteration=iteration, last_metrics=last_metrics)
256774
protected void baseGainChanged ()
    {
        // notify any sound currently holding a source
        for (int ii = 0, nn = _sources.size(); ii < nn; ii++) {
            Sound holder = _sources.get(ii).holder;
            if (holder != null) {
                holder.updateSourceGain();
            }
        }
    }
564412
public static void flushAll(long now) {
        if (MetricsManager.instance != null) {
            MetricsManager.instance.metricsLoggers.values().forEach(MetricsManager::flushMetricsLogger);
            flushToServer(now);
        }
    }
986468
public void forceGatherAllMetrics() {
    LOG.info("Forcing to gather all metrics and flush out.");
    Metrics.MetricPublisherPublishMessage.Builder builder =
        Metrics.MetricPublisherPublishMessage.newBuilder();

    for (List<String> metricNames : timeBucketToMetricNames.values()) {
      for (String metricName : metricNames) {
        gatherOneMetric(metricName, builder);
      }
    }

    metricCollectionCount.incr();
    addDataToMetricPublisher(builder, COLLECTION_COUNT_NAME, metricCollectionCount);

    Metrics.MetricPublisherPublishMessage msg = builder.build();

    queue.offer(msg);
  }
423397
@Override
    protected void collectMetrics(final Metrics metrics) {
        for (final Map.Entry<String, ExecutorService> entry : _executorServices.entrySet()) {
            final String name = entry.getKey();
            final ExecutorService executorService = entry.getValue();
            if (executorService instanceof ForkJoinPool) {
                processForkJoinPool(metrics, name, (ForkJoinPool) executorService);
            }
            if (executorService instanceof ThreadPoolExecutor) {
                // NOTE: That a ScheduledThreadPoolExecutor is a ThreadPoolExecutor
                processThreadPoolExecutor(metrics, name, (ThreadPoolExecutor) executorService);
            }
        }
    }