use of com.codahale.metrics.annotation.ResponseMetered in project metrics by dropwizard.
the class InstrumentedResourceMethodApplicationListener method registerMetricsForModel.
private void registerMetricsForModel(ResourceModel resourceModel) {
for (final Resource resource : resourceModel.getResources()) {
final Timed classLevelTimed = getClassLevelAnnotation(resource, Timed.class);
final Metered classLevelMetered = getClassLevelAnnotation(resource, Metered.class);
final ExceptionMetered classLevelExceptionMetered = getClassLevelAnnotation(resource, ExceptionMetered.class);
final ResponseMetered classLevelResponseMetered = getClassLevelAnnotation(resource, ResponseMetered.class);
for (final ResourceMethod method : resource.getAllMethods()) {
registerTimedAnnotations(method, classLevelTimed);
registerMeteredAnnotations(method, classLevelMetered);
registerExceptionMeteredAnnotations(method, classLevelExceptionMetered);
registerResponseMeteredAnnotations(method, classLevelResponseMetered);
}
for (final Resource childResource : resource.getChildResources()) {
final Timed classLevelTimedChild = getClassLevelAnnotation(childResource, Timed.class);
final Metered classLevelMeteredChild = getClassLevelAnnotation(childResource, Metered.class);
final ExceptionMetered classLevelExceptionMeteredChild = getClassLevelAnnotation(childResource, ExceptionMetered.class);
final ResponseMetered classLevelResponseMeteredChild = getClassLevelAnnotation(childResource, ResponseMetered.class);
for (final ResourceMethod method : childResource.getAllMethods()) {
registerTimedAnnotations(method, classLevelTimedChild);
registerMeteredAnnotations(method, classLevelMeteredChild);
registerExceptionMeteredAnnotations(method, classLevelExceptionMeteredChild);
registerResponseMeteredAnnotations(method, classLevelResponseMeteredChild);
}
}
}
}
use of com.codahale.metrics.annotation.ResponseMetered in project metrics by dropwizard.
the class InstrumentedResourceMethodApplicationListener method registerResponseMeteredAnnotations.
private void registerResponseMeteredAnnotations(final ResourceMethod method, final ResponseMetered classLevelResponseMetered) {
final Method definitionMethod = method.getInvocable().getDefinitionMethod();
if (classLevelResponseMetered != null) {
responseMeters.putIfAbsent(definitionMethod, new ResponseMeterMetric(metrics, method, classLevelResponseMetered));
return;
}
final ResponseMetered annotation = definitionMethod.getAnnotation(ResponseMetered.class);
if (annotation != null) {
responseMeters.putIfAbsent(definitionMethod, new ResponseMeterMetric(metrics, method, annotation));
}
}
use of com.codahale.metrics.annotation.ResponseMetered in project metrics by dropwizard.
the class InstrumentedResourceMethodApplicationListener method registerMetricsForModel.
private void registerMetricsForModel(ResourceModel resourceModel) {
for (final Resource resource : resourceModel.getResources()) {
final Timed classLevelTimed = getClassLevelAnnotation(resource, Timed.class);
final Metered classLevelMetered = getClassLevelAnnotation(resource, Metered.class);
final ExceptionMetered classLevelExceptionMetered = getClassLevelAnnotation(resource, ExceptionMetered.class);
final ResponseMetered classLevelResponseMetered = getClassLevelAnnotation(resource, ResponseMetered.class);
for (final ResourceMethod method : resource.getAllMethods()) {
registerTimedAnnotations(method, classLevelTimed);
registerMeteredAnnotations(method, classLevelMetered);
registerExceptionMeteredAnnotations(method, classLevelExceptionMetered);
registerResponseMeteredAnnotations(method, classLevelResponseMetered);
}
for (final Resource childResource : resource.getChildResources()) {
final Timed classLevelTimedChild = getClassLevelAnnotation(childResource, Timed.class);
final Metered classLevelMeteredChild = getClassLevelAnnotation(childResource, Metered.class);
final ExceptionMetered classLevelExceptionMeteredChild = getClassLevelAnnotation(childResource, ExceptionMetered.class);
final ResponseMetered classLevelResponseMeteredChild = getClassLevelAnnotation(childResource, ResponseMetered.class);
for (final ResourceMethod method : childResource.getAllMethods()) {
registerTimedAnnotations(method, classLevelTimedChild);
registerMeteredAnnotations(method, classLevelMeteredChild);
registerExceptionMeteredAnnotations(method, classLevelExceptionMeteredChild);
registerResponseMeteredAnnotations(method, classLevelResponseMeteredChild);
}
}
}
}
use of com.codahale.metrics.annotation.ResponseMetered in project metrics by dropwizard.
the class InstrumentedResourceMethodApplicationListener method registerResponseMeteredAnnotations.
private void registerResponseMeteredAnnotations(final ResourceMethod method, final ResponseMetered classLevelResponseMetered) {
final Method definitionMethod = method.getInvocable().getDefinitionMethod();
if (classLevelResponseMetered != null) {
responseMeters.putIfAbsent(definitionMethod, new ResponseMeterMetric(metrics, method, classLevelResponseMetered));
return;
}
final ResponseMetered annotation = definitionMethod.getAnnotation(ResponseMetered.class);
if (annotation != null) {
responseMeters.putIfAbsent(definitionMethod, new ResponseMeterMetric(metrics, method, annotation));
}
}
Aggregations