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();
}
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();
}
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);
}
}
}
Aggregations