Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Commit bc5a851

Browse files
author
Florian Lautenschlager
committed
Fixed some mesages.
1 parent 7dfd249 commit bc5a851

File tree

2 files changed

+19
-5
lines changed
  • chronix-timeseries-exploration/src/main

2 files changed

+19
-5
lines changed

chronix-timeseries-exploration/src/main/java/de/qaware/chronix/examples/exploration/ui/MainController.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ public void initChronix(String solrUrl) {
105105
@Override
106106
public Void call() {
107107

108-
LOGGER.info("Setting up Chronix with an remote solr to url {}", solrUrl);
108+
LOGGER.info("Setting up Chronix with a remote Solr to URL {}", solrUrl);
109109
solr = new HttpSolrClient(solrUrl);
110110

111111
boolean solrAvailable = solrAvailable();
112-
LOGGER.info("Checking connection to solr. Result {}", solrAvailable);
112+
LOGGER.info("Checking connection to Solr. Result {}", solrAvailable);
113113

114114
if (solrAvailable) {
115115
Platform.runLater(() -> connectedState.setFill(Color.GREEN));
@@ -122,6 +122,9 @@ public Void call() {
122122
Function<MetricTimeSeries, String> groupBy = MainController.this::join;
123123

124124
BinaryOperator<MetricTimeSeries> reduce = (timeSeries, timeSeries2) -> {
125+
if (timeSeries == null || timeSeries2 == null) {
126+
return new MetricTimeSeries.Builder("empty").build();
127+
}
125128
timeSeries.addAll(timeSeries2.getPoints());
126129
return timeSeries;
127130
};
@@ -159,7 +162,7 @@ protected Void call() throws Exception {
159162
long queryStart = System.currentTimeMillis();
160163
List<MetricTimeSeries> result = chronix.stream(solr, query).collect(Collectors.toList());
161164
long queryEnd = System.currentTimeMillis();
162-
LOGGER.info("Query took: {} ms", (queryEnd - queryStart));
165+
LOGGER.info("Query took: {} ms for {} points", (queryEnd - queryStart), size(result));
163166

164167
queryStart = System.currentTimeMillis();
165168
result.forEach(ts -> {
@@ -178,6 +181,13 @@ protected Void call() throws Exception {
178181

179182
}
180183

184+
private int size(List<MetricTimeSeries> result) {
185+
if (result == null) {
186+
return 0;
187+
}
188+
return result.stream().mapToInt(MetricTimeSeries::size).sum();
189+
}
190+
181191
private void convertTsToSeries(MetricTimeSeries ts, XYChart.Series<DateAxis, NumberAxis> series) {
182192
MetricDataPoint former = null;
183193

@@ -202,6 +212,9 @@ private void convertTsToSeries(MetricTimeSeries ts, XYChart.Series<DateAxis, Num
202212
}
203213

204214
private String join(MetricTimeSeries ts) {
215+
if (ts == null) {
216+
return "";
217+
}
205218
return String.valueOf(ts.attribute("host")) + "-" +
206219
ts.attribute("source") + "-" +
207220
ts.attribute("group") + "-" +

chronix-timeseries-exploration/src/main/resources/de/qaware/chronix/examples/exploration/ui/Main.fxml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@
5959
promptText="Enter your Query here. The following fields are available: start, end, metric, and host. An example query is: metric:*usage* AND host:prod*. Press enter to execute the query."
6060

6161
/>
62-
<TextArea fx:id="fqQuery" disable="false" editable="true" prefHeight="50.0" prefWidth="400.0"
62+
<TextArea fx:id="fqQuery" disable="false" editable="true" prefHeight="50.0"
63+
prefWidth="400.0"
6364
visible="true" wrapText="true"
6465

65-
promptText="Enter your filter query to aggregate results, e.g., {! Aggregation ag=max}"
66+
promptText="Enter your filter query to analyze results, e.g., ag=max, ag=dev, analysis=trend"
6667

6768
/>
6869
</children>

0 commit comments

Comments
 (0)