Skip to content

Commit

Permalink
Merge 02e13ea into 4734d6d
Browse files Browse the repository at this point in the history
  • Loading branch information
Tjofil authored Jan 27, 2023
2 parents 4734d6d + 02e13ea commit f03a8f0
Show file tree
Hide file tree
Showing 3 changed files with 10,793 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public SelectHavingStep<Record> fetchLatency() {
this.add(DSL.field(DSL.name(Fields.SHARD_ROLE.toString()), String.class));
this.add(DSL.field(DSL.name(Fields.ST.toString()), Long.class));
this.add(DSL.field(DSL.name(Fields.ET.toString()), Long.class));
this.add(DSL.field(DSL.name(Fields.DOC_COUNT.toString()), Long.class));
this.add(DSL.field(DSL.name(Fields.DOC_COUNT.toString()), Double.class));
this.add(
DSL.field(Fields.ET.toString())
.minus(DSL.field(Fields.ST.toString()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
Expand Down Expand Up @@ -53,6 +54,42 @@ public void before() throws Exception {
rootLocation = "build/resources/test/reader/";
}

@Test
public void testShardBulkParseAndQuery() throws Exception {
deleteAll();
ReaderMetricsProcessor mp =
new ReaderMetricsProcessor(rootLocation, true, new AppContext());

mp.processMetrics(rootLocation, 1566413985000L);
mp.processMetrics(rootLocation, 1566413990000L);

Result<Record> res =
mp.getMetricsDB()
.getValue()
.queryMetric(
Arrays.asList("ShardEvents", "ShardBulkDocs"),
Arrays.asList("sum", "sum"),
Arrays.asList("Operation"));

boolean shardbulkEncountered = false;

for (Record record : res) {
if (PerformanceAnalyzerMetrics.sShardBulkPath.equals(record.get("Operation"))) {
assertNotNull(record.get("ShardEvents"));
assertNotNull(record.get("ShardBulkDocs"));
assertTrue((Double) record.get("ShardEvents") >= 1.0);
assertTrue((Double) record.get("ShardBulkDocs") >= 1.0);
shardbulkEncountered = true;
}
}

assertTrue(shardbulkEncountered);

mp.trimOldSnapshots();
mp.trimOldMetricsDBFiles();
mp.deleteDBs();
}

@Test
public void testReaderMetricsProcessorFrequently() throws Exception {
deleteAll();
Expand Down
Loading

0 comments on commit f03a8f0

Please sign in to comment.