mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
PR fixes from comments
This commit is contained in:
@@ -42,6 +42,51 @@
|
|||||||
</includes>
|
</includes>
|
||||||
</testResource>
|
</testResource>
|
||||||
</testResources>
|
</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>
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -720,7 +720,7 @@ public class GrafanaClient {
|
|||||||
"query=" + URLEncoder.encode(expr) + "&start=" + start + "&end=" + end + "&step=300",
|
"query=" + URLEncoder.encode(expr) + "&start=" + start + "&end=" + end + "&step=300",
|
||||||
new TypeToken<PromQueryResult<PMatrixData>>() {
|
new TypeToken<PromQueryResult<PMatrixData>>() {
|
||||||
});
|
});
|
||||||
System.out.println(vectorData);
|
logger.info(vectorData);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("data source " + datasource + " is not yet supported.");
|
throw new RuntimeException("data source " + datasource + " is not yet supported.");
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import io.nosqlbench.engine.clients.grafana.GStitcher;
|
|||||||
import io.nosqlbench.engine.clients.grafana.GrafanaClient;
|
import io.nosqlbench.engine.clients.grafana.GrafanaClient;
|
||||||
import io.nosqlbench.engine.clients.grafana.GrafanaClientConfig;
|
import io.nosqlbench.engine.clients.grafana.GrafanaClientConfig;
|
||||||
import io.nosqlbench.engine.clients.grafana.transfer.*;
|
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.nio.file.Path;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@@ -36,16 +38,16 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class GrafanaRegionAnalyzer implements Runnable {
|
public class GrafanaRegionAnalyzer implements Runnable {
|
||||||
|
|
||||||
|
private final Logger logger = LogManager.getLogger(GrafanaRegionAnalyzer.class);
|
||||||
|
|
||||||
private String baseUrl = "";
|
private String baseUrl = "";
|
||||||
// private String dashboardId = "";
|
// private String dashboardId = "";
|
||||||
private GrafanaClient gclient;
|
private GrafanaClient gclient;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
GrafanaRegionAnalyzer analyzer = new GrafanaRegionAnalyzer();
|
GrafanaRegionAnalyzer analyzer = new GrafanaRegionAnalyzer();
|
||||||
analyzer.setBaseUrl("http://44.242.139.57:3000/");
|
analyzer.setBaseUrl("http://<host>:<port>/");
|
||||||
//
|
// analyzer.setDashboardId("<<dashboard_id>>");
|
||||||
//
|
|
||||||
// analyzer.setDashboardId("aIIX1f6Wz");
|
|
||||||
analyzer.run();
|
analyzer.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,21 +131,21 @@ public class GrafanaRegionAnalyzer implements Runnable {
|
|||||||
Map<String, Object> fieldConfig = mainpanel.getFieldConfig();
|
Map<String, Object> fieldConfig = mainpanel.getFieldConfig();
|
||||||
Map<String, String> options = mainpanel.getOptions();
|
Map<String, String> options = mainpanel.getOptions();
|
||||||
List<GPanelDef.GTarget> targets = mainpanel.getTargets();
|
List<GPanelDef.GTarget> targets = mainpanel.getTargets();
|
||||||
System.out.println("targets:\n" + targets);
|
logger.info("targets:\n" + targets);
|
||||||
|
|
||||||
for (GPanelDef.GTarget target : targets) {
|
for (GPanelDef.GTarget target : targets) {
|
||||||
String expr = target.getExpr();
|
String expr = target.getExpr();
|
||||||
expr = stitcher.stitchRegex(expr);
|
expr = stitcher.stitchRegex(expr);
|
||||||
// expr = GStitcher.resolve(expr,tplValues,GStitcher.Regex);
|
// 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());
|
GRangeResult result = getClient().doRangeQuery(mainpanel.getDatasource(), expr, db.getTime().getFrom(), db.getTime().getTo());
|
||||||
// GQueryResult gqr = getClient().doProxyQuery(mainpanel.getDatasource(), expr, new TypeToken<GQueryResult>() {});
|
// 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/
|
//http://44.242.139.57:3000/api/datasources/proxy/1/
|
||||||
// api/v1/query_range?query= result{
|
// api/v1/query_range?query= result{
|
||||||
@@ -175,7 +177,7 @@ public class GrafanaRegionAnalyzer implements Runnable {
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// for (GAnnotation anno : mainActivityAnno) {
|
// for (GAnnotation anno : mainActivityAnno) {
|
||||||
// System.out.println("creating data snapshot for " + anno);
|
// logger.info("creating data snapshot for " + anno);
|
||||||
// long start = anno.getTime();
|
// long start = anno.getTime();
|
||||||
// long end = anno.getTimeEnd();
|
// long end = anno.getTimeEnd();
|
||||||
// String snapshotKey = "ss-" + dashboardId + "-" + anno.getId();
|
// String snapshotKey = "ss-" + dashboardId + "-" + anno.getId();
|
||||||
@@ -185,7 +187,7 @@ public class GrafanaRegionAnalyzer implements Runnable {
|
|||||||
// GSnapshot newsnapshot = client.findSnapshotBykey(info.getKey());
|
// GSnapshot newsnapshot = client.findSnapshotBykey(info.getKey());
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
System.out.println("end");
|
logger.info("end");
|
||||||
}
|
}
|
||||||
|
|
||||||
public GDashboard getDashboard(String dbUid) {
|
public GDashboard getDashboard(String dbUid) {
|
||||||
|
|||||||
@@ -17,12 +17,16 @@
|
|||||||
package io.nosqlbench.engine.clients.grafana;
|
package io.nosqlbench.engine.clients.grafana;
|
||||||
|
|
||||||
import io.nosqlbench.engine.clients.grafana.transfer.GAnnotation;
|
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.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GrafanaClientTest {
|
public class GrafanaClientTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(GrafanaClientTest.class);
|
||||||
|
|
||||||
private static final String testurl = "http://localhost:3000/";
|
private static final String testurl = "http://localhost:3000/";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -34,7 +38,7 @@ public class GrafanaClientTest {
|
|||||||
a.setDashboardId(2);
|
a.setDashboardId(2);
|
||||||
a.setText("testingAnnotation");
|
a.setText("testingAnnotation");
|
||||||
GAnnotation created = client.createAnnotation(a);
|
GAnnotation created = client.createAnnotation(a);
|
||||||
System.out.println(created);
|
logger.info(created);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -43,7 +47,7 @@ public class GrafanaClientTest {
|
|||||||
GrafanaClient client = new GrafanaClient(testurl);
|
GrafanaClient client = new GrafanaClient(testurl);
|
||||||
client.getConfig().basicAuth("admin", "admin");
|
client.getConfig().basicAuth("admin", "admin");
|
||||||
List<GAnnotation> annotations = client.findAnnotations(By.id(1));
|
List<GAnnotation> annotations = client.findAnnotations(By.id(1));
|
||||||
System.out.println(annotations);
|
logger.info(annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -52,6 +56,6 @@ public class GrafanaClientTest {
|
|||||||
GrafanaClient client = new GrafanaClient(testurl);
|
GrafanaClient client = new GrafanaClient(testurl);
|
||||||
client.getConfig().basicAuth("admin", "admin");
|
client.getConfig().basicAuth("admin", "admin");
|
||||||
ApiToken token = client.createApiToken("nosqlbench", "Admin", Long.MAX_VALUE);
|
ApiToken token = client.createApiToken("nosqlbench", "Admin", Long.MAX_VALUE);
|
||||||
System.out.println(token);
|
logger.info(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user