use of org.apache.jena.fuseki.server.CounterSet in project jena by apache.
the class ActionService method executeLifecycle.
/**
* Add counters to the validate-execute lifecycle.
*/
@Override
protected void executeLifecycle(HttpAction action) {
// And also HTTP counter
CounterSet csService = (action.getDataService() == null) ? null : action.getDataService().getCounters();
CounterSet csOperation = null;
if (action.getEndpoint() != null)
// Direct naming GSP does not have an "endpoint".
csOperation = action.getEndpoint().getCounters();
incCounter(csService, Requests);
incCounter(csOperation, Requests);
// or in execution in perform.
try {
validate(action);
} catch (ActionErrorException ex) {
incCounter(csOperation, RequestsBad);
incCounter(csService, RequestsBad);
throw ex;
}
try {
execute(action);
// Success
incCounter(csOperation, RequestsGood);
incCounter(csService, RequestsGood);
} catch (ActionErrorException | QueryCancelledException | RuntimeIOException ex) {
incCounter(csOperation, RequestsBad);
incCounter(csService, RequestsBad);
throw ex;
}
}
use of org.apache.jena.fuseki.server.CounterSet in project jena by apache.
the class FusekiRequestsMetrics method bindTo.
@Override
public void bindTo(MeterRegistry registry) {
DataService dataService = dataAccessPoint.getDataService();
for (Operation operation : dataService.getOperations()) {
List<Endpoint> endpoints = dataService.getEndpoints(operation);
for (Endpoint endpoint : endpoints) {
CounterSet counters = endpoint.getCounters();
for (CounterName counterName : counters.counters()) {
Counter counter = counters.get(counterName);
Gauge.builder("fuseki_" + counterName.getFullName(), counter, Counter::value).tags(new String[] { "dataset", dataAccessPoint.getName(), "endpoint", endpoint.getName(), "operation", operation.getName(), "description", operation.getDescription() }).register(registry);
}
}
}
}
Aggregations