Return a fully-qualified metric string.
483604
def metric_path(cls, project, metric):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/metrics/{metric}", project=project, metric=metric
        )
385459
def process_metrics(self, snmp_data):
        ""
        self.metrics = {}
        for i in range(0, len(snmp_data)):
            metric_id = self.models[self.modem_type]['metrics'][i]
            value = int(snmp_data[i])
            self.metrics[metric_id] = value
1212910
private String getQualifiedMetricName(String metricName) {
    try {
      if (SecurityUtils.isAuthenticationEnabled(mConfiguration)
          && AuthenticatedClientUser.get(mConfiguration) != null) {
        return Metric.getMetricNameWithTags(metricName, CommonMetrics.TAG_USER,
            AuthenticatedClientUser.get(mConfiguration).getName(), WorkerMetrics.TAG_UFS,
            MetricsSystem.escape(new AlluxioURI(mPath)), WorkerMetrics.TAG_UFS_TYPE,
            mUnderFileSystem.getUnderFSType());
      }
    } catch (IOException e) {
      // fall through
    }
    return Metric.getMetricNameWithTags(metricName, WorkerMetrics.TAG_UFS,
        MetricsSystem.escape(new AlluxioURI(mPath)), WorkerMetrics.TAG_UFS_TYPE,
        mUnderFileSystem.getUnderFSType());
  }
381061
function metriclcs(s1, s2) {
  if (typeof s1 !== "string" || typeof s1 !== "string") return NaN;
  if (s1 === s2) return 1;

  const mlen = Math.max(s1.length, s2.length);
  if (mlen === 0) return 1;
  return lcsLength(s1, s2) / mlen;
}
131839
static Map<String, Double> processMetrics(String prefix, Iterable<MetricsInfo> metrics) {
    Map<String, Double> map = new HashMap<>();
    for (MetricsInfo r : metrics) {
      try {
        map.put(prefix + r.getName(), Double.valueOf(r.getValue()));
      } catch (NumberFormatException ne) {
        LOG.log(Level.SEVERE, "Could not parse metric, Name: "
            + r.getName() + " Value: " + r.getValue(), ne);
      }
    }
    return map;
  }
488965
def delete_metric(name):
    """"""

    with LOCK:
        old_metric = REGISTRY.pop(name, None)

        # look for the metric name in the tags and remove it
        for _, tags in py3comp.iteritems(TAGS):
            if name in tags:
                tags.remove(name)

    return old_metric
1125033
def get_metric_index(self, metric_cls):
        
        ds = self.class2ds[metric_cls.ds]
        if self.index_dict[ds]:
            index_name = self.index_dict[ds]
        else:
            index_name = self.ds2index[metric_cls.ds]
        return index_name
1285207
def _get_xml(self, metric):
        """"""
        self._opener = urllib2.build_opener()
        self._opener.addheaders = [('User-agent', self.user_agent)]

        if metric:
            url = self.base_url + '?w={0}&u=c'.format(self.woeid)
        else:
            url = self.base_url + '?w={0}'.format(self.woeid)

        return etree.parse(
            self._opener.open(url)
        ).getroot()[0]
815860
def _fmt_metric(value, show_stdv=True):
    """"""
    if len(value) == 2:
        return '%s:%g' % (value[0], value[1])
    if len(value) == 3:
        if show_stdv:
            return '%s:%g+%g' % (value[0], value[1], value[2])
        return '%s:%g' % (value[0], value[1])
    raise ValueError("wrong metric value")
442496
public Metric updateMetric(String metricName) {
    // [START updateMetric]
    MetricInfo metricInfo =
        MetricInfo.newBuilder(metricName, "severity>=ERROR")
            .setDescription("new description")
            .build();
    Metric metric = logging.update(metricInfo);
    // [END updateMetric]
    return metric;
  }
622209
def metric_from_cell(cell):
    """"""
    cell = np.asarray(cell, dtype=float)
    return np.dot(cell, cell.T)
948993
public IMetric<?> getMetricFromName(final String name) {
    IMetric<?> metric = null;
    if (name != null) {
      for (final IMetric<?> currentMetric : this.metrics) {
        if (currentMetric.getName().equals(name)) {
          metric = currentMetric;
          break;
        }
      }
    }
    return metric;
  }
966442
def compute_metric(self, components):
        """"""
        numerator = components[RECALL_RELEVANT_RETRIEVED]
        denominator = components[RECALL_RELEVANT]
        if denominator == 0.:
            if numerator == 0:
                return 1.
            else:
                raise ValueError('')
        else:
            return numerator/denominator
317469
def _normalize(self, metric_name, submit_method, prefix):
        
        metric_prefix = "mongodb." if not prefix else "mongodb.{0}.".format(prefix)
        metric_suffix = "ps" if submit_method == RATE else ""

        # Replace case-sensitive metric name characters
        for pattern, repl in iteritems(self.CASE_SENSITIVE_METRIC_NAME_SUFFIXES):
            metric_name = re.compile(pattern).sub(repl, metric_name)

        # Normalize, and wrap
        return u"{metric_prefix}{normalized_metric_name}{metric_suffix}".format(
            normalized_metric_name=self.normalize(metric_name.lower()),
            metric_prefix=metric_prefix,
            metric_suffix=metric_suffix,
        )
6521
def get_metric(self, slug):
        
        results = OrderedDict()
        granularities = self._granularities()
        keys = self._build_keys(slug)
        for granularity, key in zip(granularities, keys):
            results[granularity] = self.r.get(key)
        return results
695380
def metric(slug, num=1, category=None, expire=None, date=None):
    """"""
    get_r().metric(slug, num=num, category=category, expire=expire, date=date)
266599
def _match_metric(self, metric):
        
        if len(self._compiled_filters) == 0:
            return True
        for (collector, filter_regex) in self._compiled_filters:
            if collector != metric.getCollectorPath():
                continue
            if filter_regex.match(metric.getMetricPath()):
                return True
        return False