<code>map&lt;string, .alluxio.grpc.meta.MetricValue&gt; metrics = 1;</code>
175071
public alluxio.grpc.MetricValue getMetricsOrDefault(
      java.lang.String key,
      alluxio.grpc.MetricValue defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, alluxio.grpc.MetricValue> map =
        internalGetMetrics().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
1253571
public static Map<Metric, String> sortByValue(Map<Metric, String> map, final String reducerType) {
		List<Map.Entry<Metric, String>> list = new LinkedList<>(map.entrySet());

		Collections.sort(list, new Comparator<Map.Entry<Metric, String>>() {

			@Override
			public int compare(Map.Entry<Metric, String> o1, Map.Entry<Metric, String> o2) {
				if(reducerType.equals("name")) {
					return o1.getValue().compareTo(o2.getValue());
				}

				Double d1 = Double.parseDouble(o1.getValue());
				Double d2 = Double.parseDouble(o2.getValue());
				return (d1.compareTo(d2));
			}
		});

		Map<Metric, String> result = new LinkedHashMap<>();

		for (Map.Entry<Metric, String> entry : list) {
			result.put(entry.getKey(), entry.getValue());
		}
		return result;
	}
23044
@ReadOperation
    public Map<String, Map> allMetrics() {

        Map<String, Map> results = new HashMap<>();
        // JVM stats
        results.put("jvm", this.jvmMemoryMetrics());
        // HTTP requests stats
        results.put("http.server.requests", this.httpRequestsMetrics());
        // Cache stats
        results.put("cache", this.cacheMetrics());
        // Service stats
        results.put("services", this.serviceMetrics());
        // Database stats
        results.put("databases", this.databaseMetrics());
        // Garbage collector
        results.put("garbageCollector", this.garbageCollectorMetrics());
        // Process stats
        results.put("processMetrics", this.processMetrics());

        return results;
    }
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;
    }
448332
public <S extends Number> Metric<S> set(S value) {
        return new Metric<>(this.getName(), value);
    }
477831
@Override
	public List<Metric> transform(QueryContext queryContext, List<Metric> metrics, List<String> constants) {
		if (constants == null || constants.isEmpty()) {
			return transform(queryContext, metrics);
		}

		if (constants.size() == 1) {
			if (constants.get(0).toUpperCase().equals(FULLJOIN)){
				fulljoinIndicator=true;
				return transform(queryContext, metrics);
			}else if(constants.get(0).toUpperCase().equals(INTERSECT)) {
				fulljoinIndicator=false;
				return transform(queryContext, metrics);
			}
		}
		return mapping(metrics, constants);
	}
141359
@java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.Long> getValues() {
    return getValuesMap();
  }
873395
static byte[] rowKeyTemplate(final TSDB tsdb, final String metric,
      final Map<String, String> tags) {
    final short metric_width = tsdb.metrics.width();
    final short tag_name_width = tsdb.tag_names.width();
    final short tag_value_width = tsdb.tag_values.width();
    final short num_tags = (short) tags.size();

    int row_size = (Const.SALT_WIDTH() + metric_width + Const.TIMESTAMP_BYTES 
        + tag_name_width * num_tags + tag_value_width * num_tags);
    final byte[] row = new byte[row_size];

    short pos = (short) Const.SALT_WIDTH();

    copyInRowKey(row, pos,
        (tsdb.config.auto_metric() ? tsdb.metrics.getOrCreateId(metric)
            : tsdb.metrics.getId(metric)));
    pos += metric_width;

    pos += Const.TIMESTAMP_BYTES;

    for (final byte[] tag : Tags.resolveOrCreateAll(tsdb, tags)) {
      copyInRowKey(row, pos, tag);
      pos += tag.length;
    }
    return row;
  }
162228
@Override
    public Map<Long, Double> mapping(Map<Long, Double> originalDatapoints) {
        List<String> constants = new ArrayList<String>();

        constants.add("10");
        return mapping(originalDatapoints, constants);
    }
544739
@Override
    public int size() {
        Map<String, GroovyRunner> map = getMap();
        readLock.lock();
        try {
            return map.size();
        } finally {
            readLock.unlock();
        }
    }
458675
public static Map<String, Double> getMetrics(Map conf, String topologyName, MetaType metricType, Integer window) {
        NimbusClientWrapper nimbusClient = null;
        Iface client = null;
        Map<String, Double> summary = new HashMap<>();

        try {
            nimbusClient = new NimbusClientWrapper();
            nimbusClient.init(conf);

            client = nimbusClient.getClient();

            String topologyId = client.getTopologyId(topologyName);

            if (metricType == null) {
                metricType = MetaType.TASK;
            }

            List<MetricInfo> allTaskMetrics = client.getMetrics(topologyId, metricType.getT());
            if (allTaskMetrics == null) {
                throw new RuntimeException("Failed to get metrics");
            }

            if (window == null || !AsmWindow.TIME_WINDOWS.contains(window)) {
                window = AsmWindow.M1_WINDOW;
            }

            for (MetricInfo taskMetrics : allTaskMetrics) {

                Map<String, Map<Integer, MetricSnapshot>> metrics = taskMetrics.get_metrics();
                if (metrics == null) {
                    System.out.println("Failed to get task metrics");
                    continue;
                }
                for (Entry<String, Map<Integer, MetricSnapshot>> entry : metrics.entrySet()) {
                    String key = entry.getKey();

                    MetricSnapshot metric = entry.getValue().get(window);
                    if (metric == null) {
                        throw new RuntimeException("Failed to get one minute metrics of " + key);
                    }

                    if (metric.get_metricType() == MetricType.COUNTER.getT()) {
                        summary.put(key, (double) metric.get_longValue());
                    } else if (metric.get_metricType() == MetricType.GAUGE.getT()) {
                        summary.put(key, metric.get_doubleValue());
                    } else {
                        summary.put(key, metric.get_mean());
                    }
                }
            }

            return summary;

        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            if (client != null) {
                nimbusClient.cleanup();
            }
        }
    }
544225
@Override
    public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
        // For MP Metrics 1.0, MetricType.from(Class in) does not support lambdas or proxy classes
        return register(name, metric, new Metadata(name, from(metric)));
    }
1236685
public Map<String, String> getStringMap(final Map<String, String> map) {
		final int len = getVInt();
		for (int i = 0; i < len; i++) {
			map.put(getString(), getString());
		}
		return map;
	}
1241648
private Map<MetricQuery, List<Metric>> getSubQueryMetrics(List<MetricQuery> queries) {
		Map<MetricQuery, Future<List<Metric>>> queryFutureMap = new HashMap<>();

		for (MetricQuery query : queries) {
			String requestBody = fromEntity(query);
			String requestUrl = query.getMetricQueryContext().getReadEndPoint() + "/api/query";
			queryFutureMap.put(query, _executorService.submit(new QueryWorker(requestUrl, query.getMetricQueryContext().getReadEndPoint(), requestBody)));
		}

		Map<MetricQuery, List<Metric>> subQueryMetricsMap = new HashMap<>();

		for (Entry<MetricQuery, Future<List<Metric>>> entry : queryFutureMap.entrySet()) {
			List<Metric> metrics = new ArrayList<>();
			List<Metric> m = null;
			try {
				m = entry.getValue().get();
			} catch (InterruptedException | ExecutionException e) {
				_logger.warn("Failed to get metrics from TSDB. Reason: " + e.getMessage());
				try {
					String readBackupEndPoint = _readBackupEndPointsMap.get(entry.getKey().getMetricQueryContext().getReadEndPoint()); 
					if (!readBackupEndPoint.isEmpty()) {
						_logger.warn("Trying to read from Backup endpoint");
						m = new QueryWorker(readBackupEndPoint + "/api/query", readBackupEndPoint, fromEntity(entry.getKey())).call();
					}
				} catch (Exception ex) {
					_logger.warn("Failed to get metrics from Backup TSDB. Reason: " + ex.getMessage());
					continue;
				}
			}

			if (m != null) {
				for (Metric metric : m) {
					if (metric != null) {
						metric.setQuery(entry.getKey());
						metrics.add(metric);
					}
				}
			}

			subQueryMetricsMap.put(entry.getKey(), metrics);
		}
		return subQueryMetricsMap;
	}
717798
public Group withMetrics(java.util.Map<String, MetricValue> metrics) {
        setMetrics(metrics);
        return this;
    }
155253
public @NotNull Map<String, Integer> getStats() {
        int in = 0;
        int out = 0;
        for (Peer peer : peers.values()) {
            Map<String, Integer> connStats = peer.getStats();
            in += connStats.get("connections.in");
            out += connStats.get("connections.out");
        }

        Map<String, Integer> result = Maps.newHashMapWithExpectedSize(2);
        result.put("connections.in", in);
        result.put("connections.out", out);
        return result;
    }
595718
public java.util.List<MetricCollectionType> getMetrics() {
        if (metrics == null) {
            metrics = new com.amazonaws.internal.SdkInternalList<MetricCollectionType>();
        }
        return metrics;
    }