Add error field to Series
Change how results are handled when measurement does not exist in Influxdb. Change-Id: I89bb12ffc661e0826e27eb6105c51520b72930af
This commit is contained in:
parent
d559e6cf66
commit
99d8ca92ab
|
@ -99,25 +99,7 @@ public class InfluxV9RepoReader {
|
|||
this.influxName, this.influxUrl);
|
||||
|
||||
HttpEntity entity = response.getEntity();
|
||||
|
||||
if (entity != null) {
|
||||
|
||||
String entityString = EntityUtils.toString(entity);
|
||||
|
||||
if (entityString.equals("{\"results\":[{\"error\":\"measurement not found\"}]}")) {
|
||||
|
||||
logger.debug("Translating 'measurement not found' message to empty list");
|
||||
return "{\"results\":[{}]}";
|
||||
|
||||
} else {
|
||||
|
||||
return entityString;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
return null;
|
||||
}
|
||||
return entity != null ? EntityUtils.toString(entity) : null;
|
||||
|
||||
} finally {
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ package monasca.api.infrastructure.persistence.influxdb;
|
|||
public class Series {
|
||||
|
||||
public SeriesElement[] results;
|
||||
public String error;
|
||||
|
||||
boolean isEmpty() {
|
||||
|
||||
|
@ -27,11 +28,17 @@ public class Series {
|
|||
return this.results[0].series;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
|
||||
return this.error;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class SeriesElement {
|
||||
|
||||
public Serie[] series;
|
||||
public String error;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue