PR fixes from comments

This commit is contained in:
Jonathan Shook 2023-01-23 13:56:31 -06:00
parent a886ff2f82
commit 0c833f99cb
4 changed files with 66 additions and 15 deletions

View File

@ -42,6 +42,51 @@
</includes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.00</minimum>
<maximum>1.00</maximum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -720,7 +720,7 @@ public class GrafanaClient {
"query=" + URLEncoder.encode(expr) + "&start=" + start + "&end=" + end + "&step=300",
new TypeToken<PromQueryResult<PMatrixData>>() {
});
System.out.println(vectorData);
logger.info(vectorData);
return null;
} else {
throw new RuntimeException("data source " + datasource + " is not yet supported.");

View File

@ -22,6 +22,8 @@ import io.nosqlbench.engine.clients.grafana.GStitcher;
import io.nosqlbench.engine.clients.grafana.GrafanaClient;
import io.nosqlbench.engine.clients.grafana.GrafanaClientConfig;
import io.nosqlbench.engine.clients.grafana.transfer.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.nio.file.Path;
import java.time.Instant;
@ -36,16 +38,16 @@ import java.util.stream.Collectors;
public class GrafanaRegionAnalyzer implements Runnable {
private final Logger logger = LogManager.getLogger(GrafanaRegionAnalyzer.class);
private String baseUrl = "";
// private String dashboardId = "";
private GrafanaClient gclient;
public static void main(String[] args) {
GrafanaRegionAnalyzer analyzer = new GrafanaRegionAnalyzer();
analyzer.setBaseUrl("http://44.242.139.57:3000/");
//
//
// analyzer.setDashboardId("aIIX1f6Wz");
analyzer.setBaseUrl("http://<host>:<port>/");
// analyzer.setDashboardId("<<dashboard_id>>");
analyzer.run();
}
@ -129,21 +131,21 @@ public class GrafanaRegionAnalyzer implements Runnable {
Map<String, Object> fieldConfig = mainpanel.getFieldConfig();
Map<String, String> options = mainpanel.getOptions();
List<GPanelDef.GTarget> targets = mainpanel.getTargets();
System.out.println("targets:\n" + targets);
logger.info("targets:\n" + targets);
for (GPanelDef.GTarget target : targets) {
String expr = target.getExpr();
expr = stitcher.stitchRegex(expr);
// expr = GStitcher.resolve(expr,tplValues,GStitcher.Regex);
System.out.println("expr now:" + expr);
logger.info("expr now:" + expr);
GRangeResult result = getClient().doRangeQuery(mainpanel.getDatasource(), expr, db.getTime().getFrom(), db.getTime().getTo());
// GQueryResult gqr = getClient().doProxyQuery(mainpanel.getDatasource(), expr, new TypeToken<GQueryResult>() {});
System.out.println(result);
logger.info(result);
}
//System.out.println(mainpanel);
//logger.info(mainpanel);
}
System.out.println(mainpanels.size() + " graphs...");
logger.info(mainpanels.size() + " graphs...");
//http://44.242.139.57:3000/api/datasources/proxy/1/
// api/v1/query_range?query= result{
@ -175,7 +177,7 @@ public class GrafanaRegionAnalyzer implements Runnable {
//
//
// for (GAnnotation anno : mainActivityAnno) {
// System.out.println("creating data snapshot for " + anno);
// logger.info("creating data snapshot for " + anno);
// long start = anno.getTime();
// long end = anno.getTimeEnd();
// String snapshotKey = "ss-" + dashboardId + "-" + anno.getId();
@ -185,7 +187,7 @@ public class GrafanaRegionAnalyzer implements Runnable {
// GSnapshot newsnapshot = client.findSnapshotBykey(info.getKey());
// }
// }
System.out.println("end");
logger.info("end");
}
public GDashboard getDashboard(String dbUid) {

View File

@ -17,12 +17,16 @@
package io.nosqlbench.engine.clients.grafana;
import io.nosqlbench.engine.clients.grafana.transfer.GAnnotation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.List;
public class GrafanaClientTest {
private final static Logger logger = LogManager.getLogger(GrafanaClientTest.class);
private static final String testurl = "http://localhost:3000/";
@Test
@ -34,7 +38,7 @@ public class GrafanaClientTest {
a.setDashboardId(2);
a.setText("testingAnnotation");
GAnnotation created = client.createAnnotation(a);
System.out.println(created);
logger.info(created);
}
@Test
@ -43,7 +47,7 @@ public class GrafanaClientTest {
GrafanaClient client = new GrafanaClient(testurl);
client.getConfig().basicAuth("admin", "admin");
List<GAnnotation> annotations = client.findAnnotations(By.id(1));
System.out.println(annotations);
logger.info(annotations);
}
@Test
@ -52,6 +56,6 @@ public class GrafanaClientTest {
GrafanaClient client = new GrafanaClient(testurl);
client.getConfig().basicAuth("admin", "admin");
ApiToken token = client.createApiToken("nosqlbench", "Admin", Long.MAX_VALUE);
System.out.println(token);
logger.info(token);
}
}