refresh metric settings of topologies & metric meta
764459
public void refreshTopologies() {
        TimeTicker ticker = new TimeTicker(TimeUnit.MILLISECONDS, true);
        try {
            doRefreshTopologies();
            LOG.debug("Refresh topologies, cost:{}", ticker.stopAndRestart());

            if (!context.getNimbusData().isLeader()) { // won't hit...
                syncTopologyMetaForFollower();
                LOG.debug("Sync topology meta, cost:{}", ticker.stop());
            }
        } catch (Exception ex) {
            LOG.error("handleRefreshEvent error:", ex);
        }
    }
431464
def _yarn_node_metrics(self, rm_address, instance, addl_tags):
        
        metrics_json = self._rest_request_to_json(rm_address, instance, YARN_NODES_PATH, addl_tags)

        if metrics_json and metrics_json['nodes'] is not None and metrics_json['nodes']['node'] is not None:

            for node_json in metrics_json['nodes']['node']:
                node_id = node_json['id']

                tags = ['node_id:{}'.format(str(node_id))]
                tags.extend(addl_tags)

                self._set_yarn_metrics_from_json(tags, node_json, YARN_NODE_METRICS)
112800
function Metric(name, config, cache){
    var self = this;
    this.name = name;
    this.config = config || [];
    this.cache = cache;
    this.isDraft = false;

    this.setup(this.cache.read(this.name));
}
1033570
def _update_metrics(self,
                        metric_train: mx.metric.EvalMetric,
                        metric_val: mx.metric.EvalMetric):
        
        checkpoint_metrics = {"epoch": self.state.epoch,
                              "learning-rate": self.model.optimizer.learning_rate,
                              "gradient-norm": self.state.gradient_norm,
                              "time-elapsed": time.time() - self.state.start_tic}
        gpu_memory_usage = utils.get_gpu_memory_usage(self.model.context)
        checkpoint_metrics['used-gpu-memory'] = sum(v[0] for v in gpu_memory_usage.values())
        checkpoint_metrics['converged'] = self.state.converged
        checkpoint_metrics['diverged'] = self.state.diverged

        for name, value in metric_train.get_name_value():
            checkpoint_metrics["%s-train" % name] = value
        for name, value in metric_val.get_name_value():
            checkpoint_metrics["%s-val" % name] = value

        self.state.metrics.append(checkpoint_metrics)
        utils.write_metrics_file(self.state.metrics, self.metrics_fname)

        tf_metrics = checkpoint_metrics.copy()
        tf_metrics.update({"%s_grad" % n: v for n, v in self.state.gradients.items()})
        tf_metrics.update(self.model.params)
        self.tflogger.log_metrics(metrics=tf_metrics, checkpoint=self.state.checkpoint)
554161
def SetupPrometheusExportsFromConfig():
    """"""
    port = getattr(settings, 'PROMETHEUS_METRICS_EXPORT_PORT', None)
    port_range = getattr(
        settings, 'PROMETHEUS_METRICS_EXPORT_PORT_RANGE', None)
    addr = getattr(settings, 'PROMETHEUS_METRICS_EXPORT_ADDRESS', '')
    if port_range:
        SetupPrometheusEndpointOnPortRange(port_range, addr)
    elif port:
        SetupPrometheusEndpointOnPort(port, addr)
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)
130485
def add_metric_names(self, names):
        ""
        if hasattr(self, '_added_met_names'): self._added_met_names += names
        else:                                 self._added_met_names  = names
169166
def _compute_needed_metrics(self, instance, available_metrics):
        
        i_key = self._instance_key(instance)
        if self.in_compatibility_mode(instance):
            if instance.get('all_metrics', False):
                return available_metrics

            wanted_metrics = []
            # Get only the basic metrics
            for counter_id in available_metrics:
                # No cache yet, skip it for now
                if not self.metadata_cache.contains(i_key, counter_id):
                    self.log.debug(
                        "No metadata found for counter {}, will not collect it".format(ensure_unicode(counter_id))
                    )
                    continue
                metadata = self.metadata_cache.get_metadata(i_key, counter_id)
                if metadata.get('name') in BASIC_METRICS:
                    wanted_metrics.append(vim.PerformanceManager.MetricId(counterId=counter_id, instance="*"))

            return wanted_metrics
        else:
            # The metadata cache contains only metrics of the desired level, so use it to filter the metrics to keep
            return [
                vim.PerformanceManager.MetricId(counterId=counter_id, instance="*")
                for counter_id in available_metrics
                if self.metadata_cache.contains(i_key, counter_id)
            ]
893198
def available_metrics(self):
        
        req = self.request(self.mist_client.uri+"/clouds/"+self.cloud.id+"/machines/"+self.id+"/metrics")
        metrics = req.get().json()
        return metrics
1248506
def visdom_send_metrics(vis, metrics, update='replace'):
    
    visited = {}

    sorted_metrics = sorted(metrics.columns, key=_column_original_name)
    for metric_basename, metric_list in it.groupby(sorted_metrics, key=_column_original_name):
        metric_list = list(metric_list)

        for metric in metric_list:
            if vis.win_exists(metric_basename) and (not visited.get(metric, False)):
                update = update
            elif not vis.win_exists(metric_basename):
                update = None
            else:
                update = 'append'

            vis.line(
                metrics[metric].values,
                metrics.index.values,
                win=metric_basename,
                name=metric,
                opts={
                    'title': metric_basename,
                    'showlegend': True
                },
                update=update
            )

            if metric_basename != metric and len(metric_list) > 1:
                if vis.win_exists(metric):
                    update = update
                else:
                    update = None

                vis.line(
                    metrics[metric].values,
                    metrics.index.values,
                    win=metric,
                    name=metric,
                    opts={
                        'title': metric,
                        'showlegend': True
                    },
                    update=update
                )
1024586
def _set_request_referer_metric(self, request):
        
        if 'HTTP_REFERER' in request.META and request.META['HTTP_REFERER']:
            monitoring.set_custom_metric('request_referer', request.META['HTTP_REFERER'])
533003
def refresh(self, updated_self):

		'''
		
		'''

		logger.debug('refreshing binary attributes')
		self.mimetype = updated_self.binary.mimetype
		self.data = updated_self.binary.data
28807
def refresh_user_type_metadata(self, keyspace, user_type, max_schema_agreement_wait=None):
        
        if not self.control_connection.refresh_schema(target_type=SchemaTargetType.TYPE, keyspace=keyspace, type=user_type,
                                                      schema_agreement_wait=max_schema_agreement_wait, force=True):
            raise DriverException("User Type metadata was not refreshed. See log for details.")
62370
private void startMetricsCacheChecker() {
    final int checkIntervalSec =
        TypeUtils.getInteger(sinkConfig.get(KEY_TMASTER_LOCATION_CHECK_INTERVAL_SEC));

    Runnable runnable = new Runnable() {
      @Override
      public void run() {
        TopologyMaster.MetricsCacheLocation location =
            (TopologyMaster.MetricsCacheLocation) SingletonRegistry.INSTANCE.getSingleton(
                MetricsManagerServer.METRICSCACHE_LOCATION_BEAN_NAME);

        if (location != null) {
          if (currentMetricsCacheLocation == null
              || !location.equals(currentMetricsCacheLocation)) {
            LOG.info("Update current MetricsCacheLocation to: " + location);
            currentMetricsCacheLocation = location;
            metricsCacheClientService.updateMetricsCacheLocation(currentMetricsCacheLocation);
            metricsCacheClientService.startNewMasterClient();

            // Update Metrics
            sinkContext.exportCountMetric(METRICSMGR_LOCATION_UPDATE_COUNT, 1);
          }
        }

        // Schedule itself in future
        tMasterLocationStarter.schedule(this, checkIntervalSec, TimeUnit.SECONDS);
      }
    };

    // First Entry
    tMasterLocationStarter.schedule(runnable, checkIntervalSec, TimeUnit.SECONDS);
    LOG.info("MetricsCacheChecker started with interval: " + checkIntervalSec);
  }
1337149
public void syncTopologyMetaForFollower() {
        // sys meta, use remote only
        syncSysMetaFromRemote();

        // normal topology meta, local + remote
        for (Entry<String, TopologyMetricContext> entry : context.getTopologyMetricContexts().entrySet()) {
            String topology = entry.getKey();
            TopologyMetricContext metricContext = entry.getValue();

            if (!JStormMetrics.SYS_TOPOLOGY_SET.contains(topology)) {
                try {
                    syncMetaFromCache(topology, metricContext);
                    syncNonSysMetaFromRemote(topology, metricContext);
                } catch (Exception e1) {
                    LOG.warn("failed to sync meta for topology:{}", topology);
                }
            }
        }
    }
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);
  }
681633
function(time, metrics) {
	var metricTypes = ['gauges', 'timer_data', 'timers', 'counters', 'sets'];

	metricTypes.forEach(function(type, i){
		var obj;

		for (var key in metrics[type]) {
			obj = aggregate[type](time, key, metrics[type][key]);

			insert(obj.db, obj.col, obj.data, function(err){
				if (err) console.log(err);
			});
		};
	});
}