Examples of ExceptionMetered


Examples of com.codahale.metrics.annotation.ExceptionMetered

    private static final Logger LOG = LoggerFactory.getLogger(ExceptionMeteredMetricsFilter.class);
    private final Meter meter;
    private final Class<? extends Throwable> exceptionClass;

    public ExceptionMeteredMetricsFilter(MetricRegistry metricRegistry, ResourceInfo resourceInfo) {
        final ExceptionMetered annotation = resourceInfo.getResourceMethod().getAnnotation(ExceptionMetered.class);
        meter = metricRegistry.meter(chooseName(annotation.name(), annotation.absolute(), resourceInfo.getResourceMethod(), ExceptionMetered.DEFAULT_NAME_SUFFIX));
        exceptionClass = annotation.cause();
    }
View Full Code Here

Examples of com.codahale.metrics.annotation.ExceptionMetered

    }

    private void registerExceptionMeteredAnnotations(final ImmutableMap.Builder<Method, ExceptionMeterMetric> builder,
                                                     final ResourceMethod method) {
        final Method definitionMethod = method.getInvocable().getDefinitionMethod();
        final ExceptionMetered annotation = definitionMethod.getAnnotation(ExceptionMetered.class);

        if (annotation != null) {
            builder.put(definitionMethod, new ExceptionMeterMetric(metrics, method, annotation));
        }
    }
View Full Code Here

Examples of com.codahale.metrics.annotation.ExceptionMetered

            final Meter meter = registry.meter(name);
            dispatcher = new MeteredRequestDispatcher(dispatcher, meter);
        }

        if (method.getMethod().isAnnotationPresent(ExceptionMetered.class)) {
            final ExceptionMetered annotation = method.getMethod()
                                                      .getAnnotation(ExceptionMetered.class);
            final String name = chooseName(annotation.name(),
                                           annotation.absolute(),
                                           method,
                                           ExceptionMetered.DEFAULT_NAME_SUFFIX);
            final Meter meter = registry.meter(name);
            dispatcher = new ExceptionMeteredRequestDispatcher(dispatcher,
                                                               meter,
                                                               annotation.cause());
        }

        return dispatcher;
    }
View Full Code Here

Examples of com.codahale.metrics.annotation.ExceptionMetered

* method's name, if none was provided), and which measures the rate at which the annotated method
* throws exceptions of a given type.
*/
class ExceptionMeteredInterceptor implements MethodInterceptor {
    static MethodInterceptor forMethod(MetricRegistry metricRegistry, Class<?> klass, Method method) {
        final ExceptionMetered annotation = method.getAnnotation(ExceptionMetered.class);
        if (annotation != null) {
            final Meter meter = metricRegistry.meter(determineName(annotation, klass, method));
            return new ExceptionMeteredInterceptor(meter, annotation.cause());
        }
        return null;
    }
View Full Code Here

Examples of com.codahale.metrics.annotation.ExceptionMetered

                Meter meter = metricRegistry.meter(name);
                taskExecutor = new MeteredTask(taskExecutor, meter);
            }

            if(executeMethod.isAnnotationPresent(ExceptionMetered.class)) {
                ExceptionMetered annotation = executeMethod.getAnnotation(ExceptionMetered.class);
                String name = chooseName(annotation.name(),
                                        annotation.absolute(),
                                        task,
                                        ExceptionMetered.DEFAULT_NAME_SUFFIX);
                Meter exceptionMeter = metricRegistry.meter(name);
                taskExecutor = new ExceptionMeteredTask(taskExecutor, exceptionMeter, annotation.cause());
            }
        } catch (NoSuchMethodException e) {
        }

        taskExecutors.put(task, taskExecutor);
View Full Code Here

Examples of com.codahale.metrics.annotation.ExceptionMetered

            final Meter meter = registry.meter(name);
            dispatcher = new MeteredRequestDispatcher(dispatcher, meter);
        }

        if (method.getMethod().isAnnotationPresent(ExceptionMetered.class)) {
            final ExceptionMetered annotation = method.getMethod()
                                                      .getAnnotation(ExceptionMetered.class);
            final String name = chooseName(annotation.name(),
                                           annotation.absolute(),
                                           method,
                                           ExceptionMetered.DEFAULT_NAME_SUFFIX);
            final Meter meter = registry.meter(name);
            dispatcher = new ExceptionMeteredRequestDispatcher(dispatcher,
                                                               meter,
                                                               annotation.cause());
        }

        return dispatcher;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.