Search in sources :

Example 1 with ProxyRequestType

use of com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType in project pinpoint by naver.

the class AnnotationRecordFormatter method buildProxyHttpHeaderAnnotationArguments.

String buildProxyHttpHeaderAnnotationArguments(final LongIntIntByteByteStringValue value, final long startTimeMillis) {
    final ProxyRequestType type = this.proxyRequestTypeRegistryService.findByCode(value.getIntValue1());
    final StringBuilder sb = new StringBuilder(150);
    if (value.getLongValue() != 0) {
        sb.append(toDifferenceTimeFormat(value.getLongValue(), startTimeMillis));
    }
    if (value.getIntValue2() != -1) {
        appendComma(sb);
        sb.append(toDurationTimeFormat(value.getIntValue2()));
    }
    if (value.getByteValue1() != -1) {
        appendComma(sb);
        sb.append("idle: ").append(value.getByteValue1()).append("%");
    }
    if (value.getByteValue2() != -1) {
        appendComma(sb);
        sb.append("busy: ").append(value.getByteValue2()).append("%");
    }
    if (type.useApp()) {
        if (StringUtils.hasLength(value.getStringValue())) {
            appendComma(sb);
            sb.append("app: ").append(value.getStringValue());
        }
    }
    return sb.toString();
}
Also used : ProxyRequestType(com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType)

Example 2 with ProxyRequestType

use of com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType in project pinpoint by naver.

the class AnnotationRecordFormatter method formatTitle.

public String formatTitle(final AnnotationKey annotationKey, final AnnotationBo annotationBo, Align align) {
    if (annotationKey.getCode() == AnnotationKey.PROXY_HTTP_HEADER.getCode()) {
        if (!(annotationBo.getValue() instanceof LongIntIntByteByteStringValue)) {
            return proxyRequestTypeRegistryService.unknown().getDisplayName();
        }
        final LongIntIntByteByteStringValue value = (LongIntIntByteByteStringValue) annotationBo.getValue();
        final ProxyRequestType type = this.proxyRequestTypeRegistryService.findByCode(value.getIntValue1());
        return type.getDisplayName(value.getStringValue());
    }
    return annotationKey.getName();
}
Also used : ProxyRequestType(com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)

Example 3 with ProxyRequestType

use of com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType in project pinpoint by naver.

the class ProxyRequestTypeRegistryServiceImpl method init.

@PostConstruct
public void init() {
    final ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
    final ServiceLoader<ProxyRequestMetadataProvider> serviceLoader = ServiceLoader.load(ProxyRequestMetadataProvider.class, classLoader);
    final List<ProxyRequestType> proxyRequestTypeList = new ArrayList<ProxyRequestType>();
    for (ProxyRequestMetadataProvider provider : serviceLoader) {
        final ProxyRequestMetadataSetupContext context = new ProxyRequestMetadataSetupContext() {

            @Override
            public void addProxyHttpHeaderType(ProxyRequestType type) {
                proxyRequestTypeList.add(type);
            }
        };
        provider.setup(context);
    }
    logger.info("Loading ProxyRequestTypeProvider {}", proxyRequestTypeList);
    for (ProxyRequestType type : proxyRequestTypeList) {
        logger.info("Add ProxyRequestType {}", type);
        final ProxyRequestType exist = this.codeLookupTable.put(type.getCode(), type);
        if (exist != null) {
            logger.warn("Duplicated ProxyRequestType {}/{}", type, exist);
        }
    }
}
Also used : ProxyRequestMetadataSetupContext(com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataSetupContext) ProxyRequestType(com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType) ProxyRequestMetadataProvider(com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataProvider) ArrayList(java.util.ArrayList) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ProxyRequestType (com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType)3 ProxyRequestMetadataProvider (com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataProvider)1 ProxyRequestMetadataSetupContext (com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataSetupContext)1 LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)1 ArrayList (java.util.ArrayList)1 PostConstruct (javax.annotation.PostConstruct)1