@NonNullApi public class CountedAspect extends Object
Counted
annotation and record a few counter metrics about their execution status.Counted| Constructor and Description |
|---|
CountedAspect(MeterRegistry meterRegistry)
Construct a new aspect with the given
meterRegistry along with a default
tags provider. |
CountedAspect(MeterRegistry meterRegistry,
Function<ProceedingJoinPoint,Iterable<Tag>> tagsBasedOnJoinPoint)
Constructs a new aspect with the given
meterRegistry and tags provider function. |
| Modifier and Type | Method and Description |
|---|---|
Object |
interceptAndRecord(ProceedingJoinPoint pjp,
Counted counted)
Intercept methods annotated with the
Counted annotation and expose a few counters about
their execution status. |
public CountedAspect(MeterRegistry meterRegistry)
meterRegistry along with a default
tags provider.meterRegistry - Where we're going register metrics.public CountedAspect(MeterRegistry meterRegistry, Function<ProceedingJoinPoint,Iterable<Tag>> tagsBasedOnJoinPoint)
meterRegistry and tags provider function.meterRegistry - Where we're going register metrics.tagsBasedOnJoinPoint - A function to generate tags given a join point.public Object interceptAndRecord(ProceedingJoinPoint pjp, Counted counted) throws Throwable
Counted annotation and expose a few counters about
their execution status. By default, this aspect records both failed and successful attempts. If the
Counted.recordFailuresOnly() is set to true, then the aspect would record only
failed attempts. In case of a failure, the aspect tags the counter with the simple name of the thrown
exception.pjp - Encapsulates some information about the intercepted area.counted - The annotation.Throwable - When the intercepted method throws one.Copyright © 2020 LeanCloud. All rights reserved.