@Override protected SelectedMetric selectMetric(final MetricName from) { Map<String, Object> context = null; if (namePattern != null) { final Matcher nameMatcher = namePattern.matcher(from.getName()); if (!nameMatcher.matches()) { return null; } context = addGroups(nameMatcher, "name", context); } if (descriptionPattern != null) { final Matcher descriptionMatcher = descriptionPattern.matcher(from.getDescription()); if (!descriptionMatcher.matches()) { return null; } context = addGroups(descriptionMatcher, "description", context); } addVariables(context); final String newName = replaceVariables(config.getKeyExpression(), context); return new SelectedMetric(from, newName); }
@Override protected SelectedMetric selectMetric(final MetricName from) { Map<String, Object> context = null; if (namePattern != null) { final Matcher nameMatcher = namePattern.matcher(from.getName()); if (!nameMatcher.matches()) { return null; } context = addGroups(nameMatcher, "name", context); } if (descriptionPattern != null) { final Matcher descriptionMatcher = descriptionPattern.matcher(from.getDescription()); if (!descriptionMatcher.matches()) { return null; } context = addGroups(descriptionMatcher, "description", context); } addVariables(context); final String newName = replaceVariables(config.getKeyExpression(), context); return new SelectedMetric(from, newName); }
@Override protected void runBootstrapped() { final Set<String> names = new HashSet<>(); names.addAll(inputs); final GlobalObjectFactory factory = bootstrapper; for(final InputConfig input : bootstrapper.getConfiguration().getInputs()) { SamplerStats.init(); if (names.isEmpty() || names.contains(input.getName())) { final MetricsReader reader = factory.newReaderForInput(input); reader.open(); System.out.println("Reader: " + input.getName()); for(final MetricName item : reader.readNames()) { System.out.println("\tName:" + item.getName()); System.out.println("\tDescription:" + item.getDescription()); } reader.close(); SamplerStats.unset(); } } } }
@Override protected void runBootstrapped() { final Set<String> names = new HashSet<>(); names.addAll(inputs); final GlobalObjectFactory factory = bootstrapper; for(final InputConfig input : bootstrapper.getConfiguration().getInputs()) { SamplerStats.init(); if (names.isEmpty() || names.contains(input.getName())) { final MetricsReader reader = factory.newReaderForInput(input); reader.open(); System.out.println("Reader: " + input.getName()); for(final MetricName item : reader.readNames()) { System.out.println("\tName:" + item.getName()); System.out.println("\tDescription:" + item.getDescription()); } reader.close(); SamplerStats.unset(); } } } }
protected Metrics readAllAndSelect(final BulkMetricsReader reader) { final Metrics result = new Metrics(); final Metrics metrics = reader.readAllMetrics(); for (final Metric entry : metrics) { final SelectedMetric metric = selectMetric(entry.getName()); if (metric != null) { result.add(metric.getName(), entry.getName().getDescription(), entry.getValue()); } } return result; }
protected Metrics readAllAndSelect(final BulkMetricsReader reader) { final Metrics result = new Metrics(); final Metrics metrics = reader.readAllMetrics(); for (final Metric entry : metrics) { final SelectedMetric metric = selectMetric(entry.getName()); if (metric != null) { result.add(metric.getName(), entry.getName().getDescription(), entry.getValue()); } } return result; }