use of com.uber.cadence.DomainAlreadyExistsError in project cadence-client by uber-java.
the class WorkflowServiceTChannel method measureRemoteCallWithTags.
private <T> T measureRemoteCallWithTags(String scopeName, RemoteCall<T> call, Map<String, String> tags) throws TException {
Scope scope = options.getMetricsScope().subScope(scopeName);
if (tags != null) {
scope = scope.tagged(tags);
}
scope.counter(MetricsType.CADENCE_REQUEST).inc(1);
Stopwatch sw = scope.timer(MetricsType.CADENCE_LATENCY).start();
try {
T resp = call.apply();
sw.stop();
return resp;
} catch (EntityNotExistsError | WorkflowExecutionAlreadyCompletedError | BadRequestError | DomainAlreadyExistsError | WorkflowExecutionAlreadyStartedError | QueryFailedError e) {
sw.stop();
scope.counter(MetricsType.CADENCE_INVALID_REQUEST).inc(1);
throw e;
} catch (TException e) {
sw.stop();
scope.counter(MetricsType.CADENCE_ERROR).inc(1);
throw e;
}
}
Aggregations