use of com.predic8.membrane.core.rules.StatisticCollector in project service-proxy by membrane.
the class ElasticSearchExchangeStore method getStatistics.
@Override
public StatisticCollector getStatistics(RuleKey ruleKey) {
StatisticCollector statistics = new StatisticCollector(false);
List<AbstractExchange> exchangesList = Arrays.asList(getExchanges(ruleKey));
if (exchangesList == null || exchangesList.isEmpty())
return statistics;
for (int i = 0; i < exchangesList.size(); i++) statistics.collectFrom(exchangesList.get(i));
return statistics;
}
use of com.predic8.membrane.core.rules.StatisticCollector in project service-proxy by membrane.
the class LimitedMemoryExchangeStore method getStatistics.
public synchronized StatisticCollector getStatistics(RuleKey key) {
StatisticCollector statistics = new StatisticCollector(false);
List<AbstractExchange> exchangesList = getExchangeList(key);
if (exchangesList == null || exchangesList.isEmpty())
return statistics;
for (int i = 0; i < exchangesList.size(); i++) statistics.collectFrom(exchangesList.get(i));
return statistics;
}
use of com.predic8.membrane.core.rules.StatisticCollector in project service-proxy by membrane.
the class MemoryExchangeStore method getStatistics.
public StatisticCollector getStatistics(RuleKey key) {
StatisticCollector statistics = new StatisticCollector(false);
List<AbstractExchange> exchangesList = exchangesMap.get(key);
if (exchangesList == null || exchangesList.isEmpty())
return statistics;
for (int i = 0; i < exchangesList.size(); i++) statistics.collectFrom(exchangesList.get(i));
return statistics;
}
use of com.predic8.membrane.core.rules.StatisticCollector in project service-proxy by membrane.
the class AMStatisticsCollector method collectStatisticFrom.
private String collectStatisticFrom(Exchange exc, String apiKey) throws IOException {
StatisticCollector statistics = new StatisticCollector(false);
statistics.collectFrom(exc);
JsonGenerator gen = getAndResetJsonGenerator();
try {
gen.writeStartObject();
gen.writeObjectField("excId", exc.getId());
gen.writeObjectField("excTime", exc.getTime().toInstant().toString());
gen.writeObjectField("excApiKey", apiKey);
gen.writeObjectField("service", exc.getRule().getName());
gen.writeObjectField("uri", exc.getOriginalRequestUri());
gen.writeObjectField("method", exc.getRequest().getMethod());
gen.writeObjectField("excStatus", exc.getStatus().toString());
gen.writeObjectField("code", exc.getResponse().getStatusCode());
gen.writeObjectField("time", getInflightTime(exc));
gen.writeEndObject();
} catch (IOException e) {
e.printStackTrace();
}
return getStringFromJsonGenerator();
}
use of com.predic8.membrane.core.rules.StatisticCollector in project service-proxy by membrane.
the class Node method getStatisticCollectorByStatusCode.
private StatisticCollector getStatisticCollectorByStatusCode(int code) {
StatisticCollector sc = statusCodes.get(code);
if (sc == null) {
sc = new StatisticCollector(true);
StatisticCollector sc2 = statusCodes.putIfAbsent(code, sc);
if (sc2 != null)
sc = sc2;
}
return sc;
}
Aggregations