Auto reports any metrics that are missing a value from the current iteration
@param autoMetrics The metrics that need to me auto reported as zero
10770
public void autoReportZero(final Set<MetricIdentity> autoMetrics) {
		Preconditions.checkNotNull(autoMetrics);
		
		for (MetricIdentity identity : autoMetrics) {
			if (!aggregateExistsForCurrentMinute(identity)) {
				MetricAggregate aggregate = getAggregate(identity);
				
				aggregate.setCount(1);
				aggregate.setValue(0.0);
			}
		}
	}
266863
private AbstractSigarMetricSet<?> init(AbstractSigarMetricSet<?> metrics) {
		try {
			metrics.getSnapshot();
			return metrics;
		} catch (RuntimeException e) {
			logger.warn(e.getMessage() + ". (This exception is ignored)", e);
			return new EmptySigarMetricSet();
		}
	}
284607
public void addMetric(final IMetric<?> metric) {
    // metric null or already present
    if (metric == null) {
      throw new IllegalArgumentException("Cannot add a null metric");
    }

    if (getMetricFromName(metric.getName()) == null) {
      logger.debug(String.format("Adding %s metric in Metric Manager", metric.getName()));
      this.metrics.add(metric);
      metric.updateMetricManager(this);
    } else {
      logger.error("Failed to add metric");
    }
  }
1215476
public void release()
    {
        for(String name : allMetrics) 
        {
            Metrics.defaultRegistry().removeMetric(factory.createMetricName(name));
        }
        // latency metrics contain multiple metrics internally and need to be released manually
        readLatency.release();
        writeLatency.release();
        rangeLatency.release();
    }
745023
public void addMetricException(TopologyMaster.PublishMetrics metrics) {
    synchronized (CacheCore.class) {
      for (TopologyMaster.MetricDatum metricDatum : metrics.getMetricsList()) {
        addMetric(metricDatum);
      }
      for (TopologyMaster.TmasterExceptionLog exceptionLog : metrics.getExceptionsList()) {
        addException(exceptionLog);
      }
    }
  }
1069397
public PublicEndpoint withMetrics(java.util.Map<String, Double> metrics) {
        setMetrics(metrics);
        return this;
    }
717798
public Group withMetrics(java.util.Map<String, MetricValue> metrics) {
        setMetrics(metrics);
        return this;
    }
1343148
@POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/metrics")
    @Description("Submits externally collected metric data.")
    public Map<String, Object> submitMetrics(@Context HttpServletRequest req, final List<MetricDto> metricDtos) {
        PrincipalUser remoteUser = getRemoteUser(req);

        SystemAssert.requireArgument(metricDtos != null, "Cannot submit null timeseries metrics list.");

        List<Metric> legalMetrics = new ArrayList<>();
        List<MetricDto> illegalMetrics = new ArrayList<>();
        List<String> errorMessages = new ArrayList<>();

        for (MetricDto metricDto : metricDtos) {
            try {
                Metric metric = new Metric(metricDto.getScope(), metricDto.getMetric());
                metric.setTags(metricDto.getTags());
                if (metricDto.getMetatags() != null) {
                    metric.setMetatagsRecord(new MetatagsRecord(metricDto.getMetatags(), metricDto.getMetatagsKey()));
                }

                copyProperties(metric, metricDto);
                legalMetrics.add(metric);
            } catch (Exception e) {
                illegalMetrics.add(metricDto);
                errorMessages.add(e.getMessage());
            }
        }
        _collectionService.submitMetrics(remoteUser, legalMetrics);

        Map<String, Object> result = new HashMap<>();

        result.put("Success", legalMetrics.size() + " metrics");
        result.put("Error", illegalMetrics.size() + " metrics");
        result.put("Error Messages", errorMessages);
        return result;
    }
716271
public void setAutoVerifiedAttributes(java.util.Collection<String> autoVerifiedAttributes) {
        if (autoVerifiedAttributes == null) {
            this.autoVerifiedAttributes = null;
            return;
        }

        this.autoVerifiedAttributes = new java.util.ArrayList<String>(autoVerifiedAttributes);
    }
1216783
private void setAliveDeadMetrics() {
    clusterManager.getMetrics().setAliveNodes(nameToNode.size());
    int totalHosts = hostsReader.getHosts().size();
    if (totalHosts > 0) {
      clusterManager.getMetrics().setDeadNodes(
          totalHosts - nameToNode.size());
    }
  }
548293
protected void regenerateMetrics() {
    if(isInstrumentationEnabled()) {
      this.recordsMeter = Optional.of(this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_IN_METER));
      this.passedRecordsMeter = Optional.of(
          this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_PASSED_METER));
      this.failedRecordsMeter = Optional.of(
          this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_FAILED_METER));
      this.policyTimer = Optional.<Timer>of(
          this.metricContext.timer(MetricNames.RowLevelPolicyMetrics.CHECK_TIMER));
    } else {
      this.recordsMeter = Optional.absent();
      this.passedRecordsMeter = Optional.absent();
      this.failedRecordsMeter = Optional.absent();
      this.policyTimer = Optional.absent();
    }
  }
883567
public void submitMetrics(MetricsRecord metricsRecord) {
    List<PoolMetadata> poolMetadatas = getPoolMetadataList();
    PoolFairnessCalculator.calculateFairness(poolMetadatas, metricsRecord);
    for (SchedulerForType scheduler: schedulersForTypes.values()) {
      scheduler.submitMetrics();
    }
  }
108583
private static void printMetrics(MetricArray metrics) {
        System.out.println();

        if (metrics.size() == 0) {
            System.out.println("No metrics found.");
            return;
        }

        List<List<String>> data = new ArrayList<>();
        List<String> flags = Arrays.asList("", "-");

        for (Metric metric : metrics) {
            data.add(Arrays.asList(metric.getName(), metric.getValue()));
        }

        new CliTablePrinter.Builder()
                .data(data)
                .flags(flags)
                .delimiterWidth(2)
                .build()
                .printTable();
    }
242906
public void setCurrentShardLevelMetrics(java.util.Collection<String> currentShardLevelMetrics) {
        if (currentShardLevelMetrics == null) {
            this.currentShardLevelMetrics = null;
            return;
        }

        this.currentShardLevelMetrics = new com.amazonaws.internal.SdkInternalList<String>(currentShardLevelMetrics);
    }
688507
protected void autoReportLast() {
		
		MetricCollector collector = MetricManager.getCollector();
		
		if (collector != null) {
			collector.autoReportLast(identity);
		}
	}
1209813
@Override
    public void submitMetric(PrincipalUser submitter, Metric metric) {
        submitMetrics(submitter, Arrays.asList(new Metric[] { metric }));
    }
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);
            }
        }
    }