Adds to the "used" metric for the given quota.
345482
def tally(self, name, value):
        """"""
        value = value or 0  # Protection against None.
        # Start at 0 if this is the first value.
        if 'used' not in self.usages[name]:
            self.usages[name]['used'] = 0
        # Increment our usage and update the "available" metric.
        self.usages[name]['used'] += int(value)  # Fail if can't coerce to int.
        self.update_available(name)
538256
def add_metric(*args, **kwargs):
    """"""
    _args = ['add-metric']
    _kvpairs = []
    _kvpairs.extend(args)
    _kvpairs.extend(['{}={}'.format(k, v) for k, v in kwargs.items()])
    _args.extend(sorted(_kvpairs))
    try:
        subprocess.check_call(_args)
        return
    except EnvironmentError as e:
        if e.errno != errno.ENOENT:
            raise
    log_message = 'add-metric failed: {}'.format(' '.join(_kvpairs))
    log(log_message, level='INFO')
340872
def process(self, metric):
        

        self.queue.append(metric)
        if len(self.queue) >= self.queue_size:
            logging.debug("Queue is full, sending logs to Logentries")
            self._send()
897246
def add_reporter(self, reporter):
        """"""
        with self._lock:
            reporter.init(list(self.metrics.values()))
            self._reporters.append(reporter)
138941
public void addMetric(Metric metric)
    {
        if(this.metrics == null)
            this.metrics = new ArrayList<Metric>();
        this.metrics.add(metric);
    }
416966
def accumulate_metric(cls, name, value):
        
        metrics_cache = cls._get_metrics_cache()
        metrics_cache.setdefault(name, 0)
        metrics_cache.set(name, value)
813752
private void addMetric(
      List<Metric> metrics,
      String name,
      TagList tags,
      Object value) {
    long now = System.currentTimeMillis();
    if (onlyNumericMetrics) {
      value = asNumber(value);
    }
    if (value != null) {

      TagList newTags = counters.matches(MonitorConfig.builder(name).withTags(tags).build())
          ? getTagListWithAdditionalTag(tags, DataSourceType.COUNTER)
          : getTagListWithAdditionalTag(tags, DataSourceType.GAUGE);
      Metric m = new Metric(name, newTags, now, value);
      metrics.add(m);
    }
  }
9475
public void accumulate(List<? extends StandardMetricResult> metricValues) {
        if (metricValues == null || metricValues.isEmpty()) return;
        for (StandardMetricResult v : metricValues) {
            if (lastOffset < v.offset) values.put(v.value.intValue());
        }
        lastOffset = ListUtils.last(metricValues).offset;
    }
1053865
public void doUpdates(MetricsContext unused) {

    // get all statistic from the LooksideCache object,
    // this does not need any locking.
    LocalMetrics stats = LookasideCache.copyZeroLocalMetrics();

    synchronized (this) {
      if (stats != null) {
        this.numAddCache.set(stats.numAdd);
        this.numAddNewCache.set(stats.numAddNew);
        this.numAddExistingCache.set(stats.numAddExisting);
        this.numRenameCache.set(stats.numRename);
        this.numRemoveCache.set(stats.numRemove);
        this.numEvictCache.set(stats.numEvict);
        this.numGetAttempts.set(stats.numGetAttempts);
        this.numGetHits.set(stats.numGetHits);

        // push it
        this.numAddCache.pushMetric(this.metricsRecord);
        this.numAddNewCache.pushMetric(this.metricsRecord);
        this.numAddExistingCache.pushMetric(this.metricsRecord);
        this.numRenameCache.pushMetric(this.metricsRecord);
        this.numRemoveCache.pushMetric(this.metricsRecord);
        this.numEvictCache.pushMetric(this.metricsRecord);
        this.numGetAttempts.pushMetric(this.metricsRecord);
        this.numGetHits.pushMetric(this.metricsRecord);
      }
    }
    metricsRecord.update();
  }
1174873
protected void registerMetrics() {
    if (metricType.equals(MetricType.DEBUG)
      || metricType.equals(MetricType.PERFORMANCE)) {
      metrics.addHistogram(OVERALL_AVG_BYTES_READ_METRIC);
      metrics.addHistogram(OVERALL_AVG_BYTES_WRITE_METRIC);
      metrics.addHistogram(OVERALL_AVG_TIME_ON_WIRE_METRIC);
      metrics.addMeter(OVERALL_RESPONSE_METRIC);
      metrics.addMeter(OVERALL_REQUEST_METRIC);

      if (metricType.equals(MetricType.DEBUG)) {
        metrics.addCounter(RECON_QUEUE_METRIC);
        metrics.addCounter(SHUTD_QUEUE_METRIC);
        metrics.addMeter(OVERALL_RESPONSE_RETRY_METRIC);
        metrics.addMeter(OVERALL_RESPONSE_SUCC_METRIC);
        metrics.addMeter(OVERALL_RESPONSE_FAIL_METRIC);
      }
    }
  }
1035956
public <T> void addMetric(String name, MetricTimeslice<T> timeslice)
    {
        metrics.put(name, timeslice);
    }
667104
public void addMeasure(Key key, int value) {

        if (key != null) {
            measures.put(key, value);
        } else {
            // TODO for now, we just ignore the value
        }
    }
907252
public void addMemoryUsage(long memoryUsed) {
        totalMemoryUsage.increaseByLong(memoryUsed);
        minMemoryUsage.setValueIfLesserThanCurrentAsLong(memoryUsed);
        maxMemoryUsage.setValueIfGreaterThanCurrentAsLong(memoryUsed);
    }
21212
public void commitMeasurements() {
         if (!getFilter().noMeasurementsAvailable()) {
             double runningAverage = getFilter().calculateRssi();
             mBeacon.setRunningAverageRssi(runningAverage);
             mBeacon.setRssiMeasurementCount(getFilter().getMeasurementCount());
             LogManager.d(TAG, "calculated new runningAverageRssi: %s", runningAverage);
        }
        else {
            LogManager.d(TAG, "No measurements available to calculate running average");
        }
        mBeacon.setPacketCount(packetCount);
        packetCount = 0;
    }
268147
public TenantUsage addUsageData(final String key, final String value) {
        getLazyUsageData().put(key, value);
        return this;
    }
678663
def add_metrics(self, metrics: Iterable[float]) -> None:
        
        for metric in metrics:
            self.add_metric(metric)
836608
private boolean register(String name, Metric metric)
    { 
        boolean ret = allColumnFamilyMetrics.putIfAbsent(name,  new HashSet<Metric>()) == null;
        allColumnFamilyMetrics.get(name).add(metric);
        all.add(name);
        return ret;
    }