mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-19 01:35:58 +10:00
[강운덕] [LUCYSUS-1744] Annotation value에 single Value가 아닌 complexType을 넣을수 있도록 수정.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@2515 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -3,6 +3,7 @@ package com.nhn.pinpoint.profiler.context;
|
||||
import com.nhn.pinpoint.profiler.util.AnnotationValueMapper;
|
||||
import com.nhn.pinpoint.thrift.dto.TAnnotation;
|
||||
import com.nhn.pinpoint.thrift.dto.TAnnotationValue;
|
||||
import com.nhn.pinpoint.thrift.dto.TIntStringValue;
|
||||
|
||||
/**
|
||||
* @author netspider
|
||||
@@ -18,6 +19,11 @@ public class Annotation extends TAnnotation {
|
||||
AnnotationValueMapper.mappingValue(this, value);
|
||||
}
|
||||
|
||||
public Annotation(int key, TIntStringValue value) {
|
||||
super(key);
|
||||
this.setValue(TAnnotationValue.intStringValue(value));
|
||||
}
|
||||
|
||||
public Annotation(int key, String value) {
|
||||
super(key);
|
||||
this.setValue(TAnnotationValue.stringValue(value));
|
||||
|
||||
@@ -5,11 +5,10 @@ import com.nhn.pinpoint.common.ServiceType;
|
||||
import com.nhn.pinpoint.common.util.ParsingResult;
|
||||
import com.nhn.pinpoint.profiler.interceptor.MethodDescriptor;
|
||||
import com.nhn.pinpoint.profiler.util.StringUtils;
|
||||
import com.nhn.pinpoint.thrift.dto.TIntStringValue;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author netspider
|
||||
@@ -224,14 +223,16 @@ public final class DefaultTrace implements Trace {
|
||||
@Override
|
||||
public void recordException(Object result) {
|
||||
if (result instanceof Throwable) {
|
||||
Throwable th = (Throwable) result;
|
||||
String drop = StringUtils.drop(th.getMessage(), 256);
|
||||
final Throwable th = (Throwable) result;
|
||||
final String drop = StringUtils.drop(th.getMessage(), 256);
|
||||
|
||||
// this.currentStackFrame.setExceptionId();
|
||||
recordAttribute(AnnotationKey.EXCEPTION, drop);
|
||||
recordAttribute(AnnotationKey.EXCEPTION_CLASS, th.getClass().getName());
|
||||
|
||||
Span span = getCallStack().getSpan();
|
||||
if (span.getException() == 0) {
|
||||
span.setException(1);
|
||||
final Span span = getCallStack().getSpan();
|
||||
if (span.getErrCode() == 0) {
|
||||
span.setErrCode(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,6 +317,18 @@ public final class DefaultTrace implements Trace {
|
||||
if (output != null && output.length() != 0) {
|
||||
recordAttribute(AnnotationKey.SQL_PARAM, output);
|
||||
}
|
||||
// final String sql = parsingResult.getSql();
|
||||
// final TIntStringValue tSqlValue = new TIntStringValue(sql.hashCode());
|
||||
// final String output = parsingResult.getOutput();
|
||||
// if (output != null && output.length() != 0) {
|
||||
// tSqlValue.setBindValue(output);
|
||||
// }
|
||||
// recordSqlParam(tSqlValue);
|
||||
}
|
||||
|
||||
private void recordSqlParam(TIntStringValue tIntStringValue) {
|
||||
final StackFrame currentStackFrame = this.currentStackFrame;
|
||||
currentStackFrame.addAnnotation(new Annotation(AnnotationKey.SQL_ID.getCode(), tIntStringValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,6 +67,11 @@ public class RootStackFrame implements StackFrame {
|
||||
this.span.setApiId(apiId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptionId(int id) {
|
||||
this.span.setExceptionId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServiceType(short serviceType) {
|
||||
this.span.setServiceType(serviceType);
|
||||
|
||||
@@ -58,12 +58,21 @@ public class Span extends TSpan implements Thriftable {
|
||||
this.addToAnnotations(annotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptionId(int exceptionId) {
|
||||
super.setExceptionId(exceptionId);
|
||||
}
|
||||
|
||||
public int getException() {
|
||||
@Override
|
||||
public int getExceptionId() {
|
||||
return super.getExceptionId();
|
||||
}
|
||||
|
||||
public int getErrCode() {
|
||||
return getErr();
|
||||
}
|
||||
|
||||
public void setException(int exception) {
|
||||
public void setErrCode(int exception) {
|
||||
super.setErr(exception);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,11 @@ public class SpanEventStackFrame implements StackFrame {
|
||||
this.spanEvent.setApiId(apiId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptionId(int id) {
|
||||
this.spanEvent.setExceptionId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServiceType(short serviceType) {
|
||||
spanEvent.setServiceType(serviceType);
|
||||
|
||||
@@ -23,6 +23,8 @@ public interface StackFrame {
|
||||
|
||||
void setApiId(int apiId);
|
||||
|
||||
void setExceptionId(int id);
|
||||
|
||||
void setServiceType(short serviceType);
|
||||
|
||||
void addAnnotation(Annotation annotation);
|
||||
|
||||
Reference in New Issue
Block a user