Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ShardEvents and ShardBulkDocs null metrics #283

Merged
merged 5 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
khushbr marked this conversation as resolved.
Show resolved Hide resolved

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"));
assertEquals(1519.0, (Double) record.get("ShardEvents"), 0.0);
assertEquals(507096.0, (Double) record.get("ShardBulkDocs"), 0.0);
shardbulkEncountered = true;
}
}

assertTrue(shardbulkEncountered);

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

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