Search in sources :

Example 1 with DomainAlreadyExistsError

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;
    }
}
Also used : TException(org.apache.thrift.TException) Scope(com.uber.m3.tally.Scope) DomainAlreadyExistsError(com.uber.cadence.DomainAlreadyExistsError) Stopwatch(com.uber.m3.tally.Stopwatch) WorkflowExecutionAlreadyStartedError(com.uber.cadence.WorkflowExecutionAlreadyStartedError) EntityNotExistsError(com.uber.cadence.EntityNotExistsError) WorkflowExecutionAlreadyCompletedError(com.uber.cadence.WorkflowExecutionAlreadyCompletedError) QueryFailedError(com.uber.cadence.QueryFailedError) BadRequestError(com.uber.cadence.BadRequestError)

Aggregations

BadRequestError (com.uber.cadence.BadRequestError)1 DomainAlreadyExistsError (com.uber.cadence.DomainAlreadyExistsError)1 EntityNotExistsError (com.uber.cadence.EntityNotExistsError)1 QueryFailedError (com.uber.cadence.QueryFailedError)1 WorkflowExecutionAlreadyCompletedError (com.uber.cadence.WorkflowExecutionAlreadyCompletedError)1 WorkflowExecutionAlreadyStartedError (com.uber.cadence.WorkflowExecutionAlreadyStartedError)1 Scope (com.uber.m3.tally.Scope)1 Stopwatch (com.uber.m3.tally.Stopwatch)1 TException (org.apache.thrift.TException)1