use of com.yahoo.metrics.MetricsmanagerConfig in project vespa by vespa-engine.
the class ClusterTest method testConfiguredMetrics.
@Test
public void testConfiguredMetrics() throws Exception {
String xml = "" + "<services>" + "<content version=\"1.0\" id=\"storage\">\n" + " <redundancy>1</redundancy>\n" + " <documents>" + " <document type=\"type1\" mode='index'/>\n" + " <document type=\"type2\" mode='index'/>\n" + " </documents>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + " </group>\n" + "</content>" + "<admin version=\"2.0\">" + " <logserver hostalias=\"node0\"/>" + " <adminserver hostalias=\"node0\"/>" + " <metric-consumers>" + " <consumer name=\"foobar\">" + " <metric name=\"storage.foo.bar\"/>" + " </consumer>" + " <consumer name=\"log\">" + " <metric name=\"extralogmetric\"/>" + " <metric name=\"extralogmetric3\"/>" + " </consumer>" + " <consumer name=\"fleetcontroller\">" + " <metric name=\"extraextra\"/>" + " </consumer>" + " </metric-consumers>" + "</admin>" + "</services>";
List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1", "type2");
VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), xml, sds).create();
{
MetricsmanagerConfig.Builder builder = new MetricsmanagerConfig.Builder();
model.getConfig(builder, "storage/storage/0");
MetricsmanagerConfig config = new MetricsmanagerConfig(builder);
assertEquals("[storage.foo.bar]", getConsumer("foobar", config).addedmetrics().toString());
String expected = "[extralogmetric\n" + "extralogmetric3\n" + "vds.filestor.alldisks.allthreads.put.sum\n" + "vds.filestor.alldisks.allthreads.get.sum\n" + "vds.filestor.alldisks.allthreads.remove.sum\n" + "vds.filestor.alldisks.allthreads.update.sum\n" + "vds.datastored.alldisks.docs\n" + "vds.datastored.alldisks.bytes\n" + "vds.filestor.alldisks.queuesize\n" + "vds.filestor.alldisks.averagequeuewait.sum\n" + "vds.visitor.cv_queuewaittime\n" + "vds.visitor.allthreads.averagequeuewait\n" + "vds.visitor.allthreads.averagevisitorlifetime\n" + "vds.visitor.allthreads.created.sum]";
String actual = getConsumer("log", config).addedmetrics().toString().replaceAll(", ", "\n");
assertEquals(expected, actual);
assertEquals("[logdefault]", getConsumer("log", config).tags().toString());
expected = "[extraextra\n" + "vds.datastored.alldisks.docs\n" + "vds.datastored.alldisks.bytes\n" + "vds.datastored.alldisks.buckets]";
actual = getConsumer("fleetcontroller", config).addedmetrics().toString().replaceAll(", ", "\n");
assertEquals(expected, actual);
}
{
MetricsmanagerConfig.Builder builder = new MetricsmanagerConfig.Builder();
model.getConfig(builder, "storage/distributor/0");
MetricsmanagerConfig config = new MetricsmanagerConfig(builder);
assertEquals("[storage.foo.bar]", getConsumer("foobar", config).addedmetrics().toString());
assertEquals("[extralogmetric, extralogmetric3, vds.distributor.docsstored, vds.distributor.bytesstored, vds.idealstate.delete_bucket.done_ok, vds.idealstate.merge_bucket.done_ok, vds.idealstate.split_bucket.done_ok, vds.idealstate.join_bucket.done_ok, vds.idealstate.buckets_rechecking]", getConsumer("log", config).addedmetrics().toString());
assertEquals("[logdefault]", getConsumer("log", config).tags().toString());
assertEquals("[extraextra]", getConsumer("fleetcontroller", config).addedmetrics().toString());
}
}
use of com.yahoo.metrics.MetricsmanagerConfig in project vespa by vespa-engine.
the class ClusterTest method testMetrics.
@Test
public void testMetrics() {
MetricsmanagerConfig.Builder builder = new MetricsmanagerConfig.Builder();
ContentCluster cluster = parse("<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " </group>\n" + "</content>");
cluster.getConfig(builder);
MetricsmanagerConfig config = new MetricsmanagerConfig(builder);
assertEquals(6, config.consumer().size());
assertEquals("status", config.consumer(0).name());
assertEquals("*", config.consumer(0).addedmetrics(0));
assertEquals("partofsum", config.consumer(0).removedtags(0));
assertEquals("log", config.consumer(1).name());
assertEquals("logdefault", config.consumer(1).tags().get(0));
assertEquals("loadtype", config.consumer(1).removedtags(0));
assertEquals("yamas", config.consumer(2).name());
assertEquals("yamasdefault", config.consumer(2).tags().get(0));
assertEquals("loadtype", config.consumer(2).removedtags(0));
assertEquals("health", config.consumer(3).name());
assertEquals("statereporter", config.consumer(5).name());
assertEquals("*", config.consumer(5).addedmetrics(0));
assertEquals("thread", config.consumer(5).removedtags(0));
assertEquals("disk", config.consumer(5).tags(0));
cluster.getStorageNodes().getConfig(builder);
config = new MetricsmanagerConfig(builder);
assertEquals(6, config.consumer().size());
assertEquals("fleetcontroller", config.consumer(4).name());
assertEquals(3, config.consumer(4).addedmetrics().size());
assertEquals("vds.datastored.alldisks.docs", config.consumer(4).addedmetrics(0));
assertEquals("vds.datastored.alldisks.bytes", config.consumer(4).addedmetrics(1));
assertEquals("vds.datastored.alldisks.buckets", config.consumer(4).addedmetrics(2));
}
use of com.yahoo.metrics.MetricsmanagerConfig in project vespa by vespa-engine.
the class StorageModelTestCase method testMetricsSnapshotIntervalYAMAS.
@Test
public void testMetricsSnapshotIntervalYAMAS() throws Exception {
VespaModel vespaModel = createModel("src/test/cfg/storage/clustercontroller_advanced");
ContentCluster contentCluster = vespaModel.getContentClusters().values().iterator().next();
assertNotNull(contentCluster);
MetricsmanagerConfig.Builder builder = new MetricsmanagerConfig.Builder();
contentCluster.getConfig(builder);
MetricsmanagerConfig config = new MetricsmanagerConfig(builder);
assertThat(config.snapshot().periods(0), is(60));
}
Aggregations