Search in sources :

Example 1 with AnnotationKeyMatcher

use of com.navercorp.pinpoint.common.trace.AnnotationKeyMatcher in project pinpoint by naver.

the class TransactionInfoServiceImpl method getDisplayArgument0.

private AnnotationBo getDisplayArgument0(Event event) {
    // TODO needs a more generalized implementation for Arcus
    List<AnnotationBo> list = event.getAnnotationBoList();
    if (list == null) {
        return null;
    }
    final AnnotationKeyMatcher matcher = annotationKeyMatcherService.findAnnotationKeyMatcher(event.getServiceType());
    if (matcher == null) {
        return null;
    }
    for (AnnotationBo annotation : list) {
        int key = annotation.getKey();
        if (matcher.matches(key)) {
            return annotation;
        }
    }
    return null;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) AnnotationKeyMatcher(com.navercorp.pinpoint.common.trace.AnnotationKeyMatcher)

Example 2 with AnnotationKeyMatcher

use of com.navercorp.pinpoint.common.trace.AnnotationKeyMatcher in project pinpoint by naver.

the class DefaultAnnotationKeyMatcherService method build.

private AnnotationKeyMatcherRegistry build(TraceMetadataLoaderService typeLoaderService) {
    AnnotationKeyMatcherRegistry.Builder builder = new AnnotationKeyMatcherRegistry.Builder();
    StaticFieldLookUp<DisplayArgumentMatcher> staticFieldLookUp = new StaticFieldLookUp<>(DefaultDisplayArgument.class, DisplayArgumentMatcher.class);
    List<DisplayArgumentMatcher> lookup = staticFieldLookUp.lookup();
    for (DisplayArgumentMatcher displayArgumentMatcher : lookup) {
        AnnotationKeyMatcher annotationKeyMatcher = displayArgumentMatcher.getAnnotationKeyMatcher();
        if (annotationKeyMatcher == null) {
            continue;
        }
        logger.debug("add DefaultAnnotationKeyMatcher ServiceType:{}, AnnotationKeyMatcher:{}", displayArgumentMatcher.getServiceType(), annotationKeyMatcher);
        builder.addAnnotationMatcher(displayArgumentMatcher.getServiceType(), annotationKeyMatcher);
    }
    List<ServiceTypeInfo> types = typeLoaderService.getServiceTypeInfos();
    for (ServiceTypeInfo type : types) {
        if (type.getPrimaryAnnotationKeyMatcher() == null) {
            continue;
        }
        logger.debug("add AnnotationKeyMatcher ServiceType:{}, AnnotationKeyMatcher:{}", type.getServiceType(), type.getPrimaryAnnotationKeyMatcher());
        builder.addAnnotationMatcher(type.getServiceType(), type.getPrimaryAnnotationKeyMatcher());
    }
    return builder.build();
}
Also used : StaticFieldLookUp(com.navercorp.pinpoint.common.util.StaticFieldLookUp) AnnotationKeyMatcher(com.navercorp.pinpoint.common.trace.AnnotationKeyMatcher) ServiceTypeInfo(com.navercorp.pinpoint.common.trace.ServiceTypeInfo) AnnotationKeyMatcherRegistry(com.navercorp.pinpoint.web.util.AnnotationKeyMatcherRegistry) DisplayArgumentMatcher(com.navercorp.pinpoint.common.util.DisplayArgumentMatcher)

Aggregations

AnnotationKeyMatcher (com.navercorp.pinpoint.common.trace.AnnotationKeyMatcher)2 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)1 ServiceTypeInfo (com.navercorp.pinpoint.common.trace.ServiceTypeInfo)1 DisplayArgumentMatcher (com.navercorp.pinpoint.common.util.DisplayArgumentMatcher)1 StaticFieldLookUp (com.navercorp.pinpoint.common.util.StaticFieldLookUp)1 AnnotationKeyMatcherRegistry (com.navercorp.pinpoint.web.util.AnnotationKeyMatcherRegistry)1