Search in sources :

Example 1 with AnnotationKey

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

the class RecordFactory method getAnnotations.

public List<Record> getAnnotations(final int depth, final int parentId, SpanAlign align) {
    List<Record> list = new ArrayList<>();
    for (AnnotationBo annotation : align.getAnnotationBoList()) {
        final AnnotationKey key = findAnnotationKey(annotation.getKey());
        if (key.isViewInRecordSet()) {
            final Record record = new Record(depth, getNextId(), parentId, false, key.getName(), annotation.getValue().toString(), 0L, 0L, 0, null, null, null, null, false, false, null, 0, 0, MethodTypeEnum.DEFAULT, annotation.isAuthorized());
            list.add(record);
        }
    }
    return list;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ArrayList(java.util.ArrayList) AnnotationKey(com.navercorp.pinpoint.common.trace.AnnotationKey)

Example 2 with AnnotationKey

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

the class RecordFactory method getApi.

private Api getApi(final SpanAlign align) {
    final AnnotationBo annotation = AnnotationUtils.findAnnotationBo(align.getAnnotationBoList(), AnnotationKey.API_METADATA);
    if (annotation != null) {
        final Api api = new Api();
        final ApiMetaDataBo apiMetaData = (ApiMetaDataBo) annotation.getValue();
        String apiInfo = getApiInfo(apiMetaData);
        api.setTitle(apiInfo);
        api.setDescription(apiInfo);
        if (apiMetaData.getMethodTypeEnum() == MethodTypeEnum.DEFAULT) {
            try {
                ApiDescription apiDescription = apiDescriptionParser.parse(api.description);
                api.setTitle(apiDescription.getSimpleMethodDescription());
                api.setClassName(apiDescription.getSimpleClassName());
            } catch (Exception e) {
                logger.debug("Failed to api parse. {}", api.description, e);
            }
        }
        api.setMethodTypeEnum(apiMetaData.getMethodTypeEnum());
        return api;
    } else {
        final Api api = new Api();
        AnnotationKey apiMetaDataError = getApiMetaDataError(align.getAnnotationBoList());
        api.setTitle(apiMetaDataError.getName());
        return api;
    }
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) AnnotationKey(com.navercorp.pinpoint.common.trace.AnnotationKey) ApiMetaDataBo(com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo) ApiDescription(com.navercorp.pinpoint.common.util.ApiDescription)

Example 3 with AnnotationKey

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

the class AnnotationKeyTest method testValueOf.

@Test
public void testValueOf() {
    AnnotationKeyRegistryService annotationKeyRegistryService = new DefaultAnnotationKeyRegistryService();
    annotationKeyRegistryService.findAnnotationKeyByName(AnnotationKey.ARGS0.getName());
    AnnotationKey valueof = annotationKeyRegistryService.findAnnotationKeyByName(AnnotationKey.ARGS0.getName());
    Assert.assertSame(AnnotationKey.ARGS0, valueof);
}
Also used : DefaultAnnotationKeyRegistryService(com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService) AnnotationKeyRegistryService(com.navercorp.pinpoint.common.service.AnnotationKeyRegistryService) AnnotationKey(com.navercorp.pinpoint.common.trace.AnnotationKey) DefaultAnnotationKeyRegistryService(com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService) Test(org.junit.Test)

Example 4 with AnnotationKey

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

the class ServiceTypeInitializerTest method testDuplicated3.

@Test(expected = RuntimeException.class)
public void testDuplicated3() {
    List<TraceMetadataProvider> providers = Arrays.<TraceMetadataProvider>asList(new TestProvider(TEST_TYPES, TEST_KEYS), new TestProvider(TEST_TYPES, new AnnotationKey[0]));
    TraceMetadataLoader loader = new TraceMetadataLoader();
    loader.load(providers);
}
Also used : TraceMetadataProvider(com.navercorp.pinpoint.common.trace.TraceMetadataProvider) TraceMetadataLoader(com.navercorp.pinpoint.common.trace.TraceMetadataLoader) AnnotationKey(com.navercorp.pinpoint.common.trace.AnnotationKey) Test(org.junit.Test)

Example 5 with AnnotationKey

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

the class ServiceTypeInitializerTest method testDuplicated2.

@Test(expected = RuntimeException.class)
public void testDuplicated2() {
    List<TraceMetadataProvider> providers = Arrays.<TraceMetadataProvider>asList(new TestProvider(TEST_TYPES, TEST_KEYS), new TestProvider(TEST_TYPES, new AnnotationKey[0]));
    TraceMetadataLoader loader = new TraceMetadataLoader();
    loader.load(providers);
}
Also used : TraceMetadataProvider(com.navercorp.pinpoint.common.trace.TraceMetadataProvider) TraceMetadataLoader(com.navercorp.pinpoint.common.trace.TraceMetadataLoader) AnnotationKey(com.navercorp.pinpoint.common.trace.AnnotationKey) Test(org.junit.Test)

Aggregations

AnnotationKey (com.navercorp.pinpoint.common.trace.AnnotationKey)8 Test (org.junit.Test)4 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)2 AnnotationKeyRegistryService (com.navercorp.pinpoint.common.service.AnnotationKeyRegistryService)2 DefaultAnnotationKeyRegistryService (com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService)2 TraceMetadataLoader (com.navercorp.pinpoint.common.trace.TraceMetadataLoader)2 TraceMetadataProvider (com.navercorp.pinpoint.common.trace.TraceMetadataProvider)2 ExpectedAnnotation (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation)1 ExpectedSql (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedSql)1 ApiMetaDataBo (com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo)1 DefaultTraceMetadataLoaderService (com.navercorp.pinpoint.common.service.DefaultTraceMetadataLoaderService)1 TraceMetadataLoaderService (com.navercorp.pinpoint.common.service.TraceMetadataLoaderService)1 AnnotationKeyRegistry (com.navercorp.pinpoint.common.trace.AnnotationKeyRegistry)1 ApiDescription (com.navercorp.pinpoint.common.util.ApiDescription)1 StaticFieldLookUp (com.navercorp.pinpoint.common.util.StaticFieldLookUp)1 TAnnotation (com.navercorp.pinpoint.thrift.dto.TAnnotation)1 ArrayList (java.util.ArrayList)1