use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer in project vespa by vespa-engine.
the class MetricsBuilder method buildMetrics.
public Metrics buildMetrics(Element metricsElement) {
Metrics metrics = new Metrics();
for (Element consumerElement : XML.getChildren(metricsElement, "consumer")) {
String consumerId = consumerElement.getAttribute(ID_ATTRIBUTE);
throwIfIllegalConsumerId(metrics, consumerId);
MetricSet metricSet = buildMetricSet(consumerId, consumerElement);
metrics.addConsumer(new MetricsConsumer(consumerId, metricSet));
}
return metrics;
}
use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer in project vespa by vespa-engine.
the class DomMetricBuilderHelper method buildMetricsConsumers.
/**
* Build metricConsumer config
*
* @param spec xml element
* @return a map from metric name to a {@link MetricsConsumer}
*/
protected static Map<String, MetricsConsumer> buildMetricsConsumers(Element spec) {
Map<String, MetricsConsumer> metricsConsumers = new LinkedHashMap<>();
List<Element> consumersElem = XML.getChildren(spec, "consumer");
for (Element consumer : consumersElem) {
String consumerName = getConsumerName(consumer);
Set<Metric> metrics = new LinkedHashSet<>();
List<Element> metricsEl = XML.getChildren(consumer, "metric");
if (metricsEl != null) {
for (Element metric : metricsEl) {
String metricName = metric.getAttribute("name");
String outputName = metric.getAttribute("output-name");
metrics.add(new Metric(metricName, outputName));
}
}
MetricsConsumer metricsConsumer = new MetricsConsumer(consumerName, new MetricSet(metricSetId(consumerName), metrics));
metricsConsumers.put(consumerName, metricsConsumer);
}
return metricsConsumers;
}
use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer in project vespa by vespa-engine.
the class ContentCluster method getConfig.
@Override
public void getConfig(MetricsmanagerConfig.Builder builder) {
Monitoring monitoring = getMonitoringService();
if (monitoring != null) {
builder.snapshot(new MetricsmanagerConfig.Snapshot.Builder().periods(monitoring.getIntervalSeconds()).periods(300));
}
builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("status").addedmetrics("*").removedtags("partofsum"));
builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("log").tags("logdefault").removedtags("loadtype"));
builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("yamas").tags("yamasdefault").removedtags("loadtype"));
builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("health"));
builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("fleetcontroller"));
builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("statereporter").addedmetrics("*").removedtags("thread").tags("disk"));
Map<String, MetricsConsumer> consumers = getRoot().getAdmin().getLegacyUserMetricsConsumers();
if (consumers != null) {
for (Map.Entry<String, MetricsConsumer> e : consumers.entrySet()) {
MetricsmanagerConfig.Consumer.Builder b = getMetricBuilder(e.getKey(), builder);
for (Metric m : e.getValue().getMetrics().values()) {
b.addedmetrics(m.name);
}
}
}
}
use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer in project vespa by vespa-engine.
the class DomAdminBuilderBase method doBuild.
@Override
protected Admin doBuild(AbstractConfigProducer parent, Element adminElement) {
Monitoring monitoring = getMonitoring(getChildWithFallback(adminElement, "monitoring", "yamas"));
Metrics metrics = new MetricsBuilder(applicationType, predefinedMetricSets).buildMetrics(XML.getChild(adminElement, "metrics"));
Map<String, MetricsConsumer> legacyMetricsConsumers = DomMetricBuilderHelper.buildMetricsConsumers(XML.getChild(adminElement, "metric-consumers"));
FileDistributionConfigProducer fileDistributionConfigProducer = getFileDistributionConfigProducer(parent);
Admin admin = new Admin(parent, monitoring, metrics, legacyMetricsConsumers, multitenant, fileDistributionConfigProducer);
admin.setApplicationType(applicationType);
doBuildAdmin(admin, adminElement);
new ModelConfigProvider(admin);
return admin;
}
use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer in project vespa by vespa-engine.
the class DedicatedAdminV4Test method testModelBuilding.
@Test
public void testModelBuilding() throws IOException, SAXException {
String services = "<services>" + " <admin version='4.0'>" + " <slobroks><nodes count='2' dedicated='true'/></slobroks>" + " <logservers><nodes count='1' dedicated='true'/></logservers>" + " <yamas systemname='vespa.routing' interval='60' />" + " <metrics>" + " <consumer id='slingstone'>" + " <metric id='foobar.count' display-name='foobar'/>" + " </consumer>" + " </metrics>" + " <metric-consumers>" + " <consumer name='yamas'>" + " <metric name='upstreams_generated' />" + " <metric name='upstreams_nginx_reloads' />" + " <metric name='nginx.upstreams.down.last' output-name='nginx.upstreams.down'/>" + " </consumer>" + " </metric-consumers>" + " <identity>" + " <domain>mydomain</domain>" + " <service>myservice</service>" + " </identity>" + " </admin>" + "</services>";
VespaModel model = createModel(hosts, services);
assertEquals(3, model.getHosts().size());
assertHostContainsServices(model, "hosts/myhost0", "slobrok", "logd");
assertHostContainsServices(model, "hosts/myhost1", "slobrok", "logd");
assertHostContainsServices(model, "hosts/myhost2", "logserver", "logd");
Monitoring monitoring = model.getAdmin().getMonitoring();
assertEquals("vespa.routing", monitoring.getClustername());
assertEquals(60L, (long) monitoring.getIntervalSeconds());
MetricsConsumer consumer = model.getAdmin().getUserMetrics().getConsumers().get("slingstone");
assertNotNull(consumer);
Metric metric = consumer.getMetrics().get("foobar.count");
assertNotNull(metric);
assertEquals("foobar", metric.outputName);
consumer = model.getAdmin().getLegacyUserMetricsConsumers().get(VESPA_CONSUMER_ID);
assertNotNull(consumer);
assertEquals(3, consumer.getMetrics().size());
metric = consumer.getMetrics().get("nginx.upstreams.down.last");
assertNotNull(metric);
assertEquals("nginx.upstreams.down", metric.outputName);
}
Aggregations