use of org.wikidata.query.rdf.tool.rdf.CollectedUpdateMetrics in project wikidata-query-rdf by wikimedia.
the class UpdateMetricsResponseHandler method extractMetrics.
private CollectedUpdateMetrics extractMetrics(String[] lines) throws IOException {
CollectedUpdateMetrics collectedUpdateMetrics = new CollectedUpdateMetrics();
Iterator<String> lineIterator = getPerQueryResponses(lines);
for (MultiSyncStep step : requiredSteps) {
if (lineIterator.hasNext()) {
collectedUpdateMetrics.merge(step, getUpdateMetrics(lineIterator.next()));
} else {
throw new IOException("Response didn't match the query!");
}
}
Map<String, String> summaryMetrics = extractSummaryMetrics(lines);
Integer commitTotalElapsed = asInt(summaryMetrics.get(COMMIT_TOTAL_ELAPSED));
if (commitTotalElapsed != null)
collectedUpdateMetrics.setCommitTotalElapsed(commitTotalElapsed);
Integer mutationCount = asInt(summaryMetrics.get(MUTATION_COUNT));
if (mutationCount == null)
throw new IOException("Couldn't find the mutation count!");
collectedUpdateMetrics.setMutationCount(mutationCount);
return collectedUpdateMetrics;
}
use of org.wikidata.query.rdf.tool.rdf.CollectedUpdateMetrics in project wikidata-query-rdf by wikimedia.
the class UpdateMetricsResponseHandler method parse.
@Override
public CollectedUpdateMetrics parse(ContentResponse entity) throws IOException {
String content = entity.getContentAsString();
String[] lines = content.split("\\r?\\n");
CollectedUpdateMetrics collectedUpdateMetrics = extractMetrics(lines);
log.debug("Received metrics from update: {}", collectedUpdateMetrics);
return collectedUpdateMetrics;
}
Aggregations