mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-15 07:46:19 +10:00
[#694] change data type for logginginfo for transaction
This commit is contained in:
@@ -2,6 +2,7 @@ package com.navercorp.pinpoint.bootstrap.context;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.MethodDescriptor;
|
||||
import com.navercorp.pinpoint.common.trace.AnnotationKey;
|
||||
import com.navercorp.pinpoint.common.trace.LoggingInfo;
|
||||
import com.navercorp.pinpoint.common.trace.ServiceType;
|
||||
|
||||
public interface SpanRecorder {
|
||||
@@ -44,5 +45,5 @@ public interface SpanRecorder {
|
||||
|
||||
void recordAcceptorHost(String host);
|
||||
|
||||
void recordLogging(boolean isLogging);
|
||||
void recordLogging(LoggingInfo loggingInfo);
|
||||
}
|
||||
+3
-1
@@ -17,6 +17,8 @@ package com.navercorp.pinpoint.bootstrap.plugin.test;
|
||||
import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.common.trace.LoggingInfo;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,5 +38,5 @@ public interface PluginTestVerifier {
|
||||
public void printCache();
|
||||
public void initialize(boolean initializeTraceObject);
|
||||
public void cleanUp(boolean detachTraceObject);
|
||||
public void verifyIsLoggingTransactionInfo(boolean isLoggingTransactionInfo);
|
||||
public void verifyIsLoggingTransactionInfo(LoggingInfo loggingInfo);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
import com.navercorp.pinpoint.common.buffer.AutomaticBuffer;
|
||||
import com.navercorp.pinpoint.common.buffer.Buffer;
|
||||
import com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer;
|
||||
import com.navercorp.pinpoint.common.trace.LoggingInfo;
|
||||
import com.navercorp.pinpoint.common.trace.ServiceType;
|
||||
import com.navercorp.pinpoint.common.util.TransactionId;
|
||||
import com.navercorp.pinpoint.common.util.TransactionIdUtils;
|
||||
@@ -77,7 +78,7 @@ public class SpanBo implements com.navercorp.pinpoint.common.bo.Span {
|
||||
|
||||
private String remoteAddr; // optional
|
||||
|
||||
private boolean loggingTransactionInfo; //optional
|
||||
private byte loggingTransactionInfo; //optional
|
||||
|
||||
public SpanBo(TSpan span) {
|
||||
if (span == null) {
|
||||
@@ -112,7 +113,7 @@ public class SpanBo implements com.navercorp.pinpoint.common.bo.Span {
|
||||
|
||||
this.remoteAddr = span.getRemoteAddr();
|
||||
|
||||
this.loggingTransactionInfo = span.getLoggingTransactionInfo() == 1 ? true : false;
|
||||
this.loggingTransactionInfo = span.getLoggingTransactionInfo();
|
||||
|
||||
// FIXME (2015.03) Legacy - applicationServiceType added in v1.1.0
|
||||
// applicationServiceType is not saved for older versions where applicationServiceType does not exist.
|
||||
@@ -385,11 +386,11 @@ public class SpanBo implements com.navercorp.pinpoint.common.bo.Span {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLoggingTransactionInfo() {
|
||||
public byte getLoggingTransactionInfo() {
|
||||
return loggingTransactionInfo;
|
||||
}
|
||||
|
||||
public void setLoggingTransactionInfo(boolean loggingTransactionInfo) {
|
||||
public void setLoggingTransactionInfo(byte loggingTransactionInfo) {
|
||||
this.loggingTransactionInfo = loggingTransactionInfo;
|
||||
}
|
||||
|
||||
@@ -496,7 +497,7 @@ public class SpanBo implements com.navercorp.pinpoint.common.bo.Span {
|
||||
}
|
||||
|
||||
if (buffer.limit() > 0) {
|
||||
this.loggingTransactionInfo = buffer.readBoolean();
|
||||
this.loggingTransactionInfo = buffer.readByte();
|
||||
}
|
||||
|
||||
return buffer.getOffset();
|
||||
|
||||
+3
-2
@@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
|
||||
import com.navercorp.pinpoint.bootstrap.context.SpanRecorder;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceId;
|
||||
import com.navercorp.pinpoint.common.trace.LoggingInfo;
|
||||
import com.navercorp.pinpoint.common.trace.ServiceType;
|
||||
|
||||
/**
|
||||
@@ -123,9 +124,9 @@ public class DefaultSpanRecorder extends AbstractRecorder implements SpanRecorde
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordLogging(boolean isLogging) {
|
||||
public void recordLogging(LoggingInfo loggingInfo) {
|
||||
if (!span.isSetLoggingTransactionInfo()) {
|
||||
span.setLoggingTransactionInfo((short)(isLogging ? 1 : 0));
|
||||
span.setLoggingTransactionInfo(loggingInfo.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifierHolder;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.test.TraceType;
|
||||
import com.navercorp.pinpoint.common.service.AnnotationKeyRegistryService;
|
||||
import com.navercorp.pinpoint.common.trace.AnnotationKey;
|
||||
import com.navercorp.pinpoint.common.trace.LoggingInfo;
|
||||
import com.navercorp.pinpoint.common.trace.ServiceType;
|
||||
import com.navercorp.pinpoint.profiler.DefaultAgent;
|
||||
import com.navercorp.pinpoint.profiler.context.Span;
|
||||
@@ -754,7 +755,7 @@ public class PluginTestAgent extends DefaultAgent implements PluginTestVerifier
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verifyIsLoggingTransactionInfo(boolean isLoggingTransactionInfo) {
|
||||
public void verifyIsLoggingTransactionInfo(LoggingInfo loggingInfo) {
|
||||
Object actual = popSpan();
|
||||
Span span = null;
|
||||
|
||||
@@ -766,10 +767,16 @@ public class PluginTestAgent extends DefaultAgent implements PluginTestVerifier
|
||||
throw new IllegalArgumentException("Unexpected type: " + actual.getClass());
|
||||
}
|
||||
|
||||
boolean actualValue = span.getLoggingTransactionInfo() == 1 ? true : false;
|
||||
|
||||
if (isLoggingTransactionInfo != actualValue) {
|
||||
throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + isLoggingTransactionInfo + "] but was [" + !isLoggingTransactionInfo + "]. expected: " + isLoggingTransactionInfo + ", was: " + !isLoggingTransactionInfo);
|
||||
if (span.getLoggingTransactionInfo() != loggingInfo.getCode()) {
|
||||
|
||||
LoggingInfo loggingTransactionInfo = LoggingInfo.searchByCode(span.getLoggingTransactionInfo());
|
||||
|
||||
if (loggingTransactionInfo != null) {
|
||||
throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "] but was [" + loggingTransactionInfo.getName() + "]. expected: " + loggingInfo.getName() + ", was: " + loggingTransactionInfo.getName());
|
||||
} else {
|
||||
throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "] but loggingTransactionInfo value invalid.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-6-24")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-7-21")
|
||||
public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, java.io.Serializable, Cloneable, Comparable<TSpan> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSpan");
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
private static final org.apache.thrift.protocol.TField API_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("apiId", org.apache.thrift.protocol.TType.I32, (short)25);
|
||||
private static final org.apache.thrift.protocol.TField EXCEPTION_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("exceptionInfo", org.apache.thrift.protocol.TType.STRUCT, (short)26);
|
||||
private static final org.apache.thrift.protocol.TField APPLICATION_SERVICE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationServiceType", org.apache.thrift.protocol.TType.I16, (short)30);
|
||||
private static final org.apache.thrift.protocol.TField LOGGING_TRANSACTION_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("loggingTransactionInfo", org.apache.thrift.protocol.TType.I16, (short)31);
|
||||
private static final org.apache.thrift.protocol.TField LOGGING_TRANSACTION_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("loggingTransactionInfo", org.apache.thrift.protocol.TType.BYTE, (short)31);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
@@ -90,7 +90,7 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
public int apiId; // optional
|
||||
public TIntStringValue exceptionInfo; // optional
|
||||
public short applicationServiceType; // optional
|
||||
public short loggingTransactionInfo; // optional
|
||||
public byte loggingTransactionInfo; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
@@ -281,7 +281,7 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
tmpMap.put(_Fields.APPLICATION_SERVICE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("applicationServiceType", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
|
||||
tmpMap.put(_Fields.LOGGING_TRANSACTION_INFO, new org.apache.thrift.meta_data.FieldMetaData("loggingTransactionInfo", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSpan.class, metaDataMap);
|
||||
}
|
||||
@@ -978,11 +978,11 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __APPLICATIONSERVICETYPE_ISSET_ID, value);
|
||||
}
|
||||
|
||||
public short getLoggingTransactionInfo() {
|
||||
public byte getLoggingTransactionInfo() {
|
||||
return this.loggingTransactionInfo;
|
||||
}
|
||||
|
||||
public TSpan setLoggingTransactionInfo(short loggingTransactionInfo) {
|
||||
public TSpan setLoggingTransactionInfo(byte loggingTransactionInfo) {
|
||||
this.loggingTransactionInfo = loggingTransactionInfo;
|
||||
setLoggingTransactionInfoIsSet(true);
|
||||
return this;
|
||||
@@ -1183,7 +1183,7 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
if (value == null) {
|
||||
unsetLoggingTransactionInfo();
|
||||
} else {
|
||||
setLoggingTransactionInfo((Short)value);
|
||||
setLoggingTransactionInfo((Byte)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1259,7 +1259,7 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
return Short.valueOf(getApplicationServiceType());
|
||||
|
||||
case LOGGING_TRANSACTION_INFO:
|
||||
return Short.valueOf(getLoggingTransactionInfo());
|
||||
return Byte.valueOf(getLoggingTransactionInfo());
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
@@ -2340,8 +2340,8 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
}
|
||||
break;
|
||||
case 31: // LOGGING_TRANSACTION_INFO
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
|
||||
struct.loggingTransactionInfo = iprot.readI16();
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
|
||||
struct.loggingTransactionInfo = iprot.readByte();
|
||||
struct.setLoggingTransactionInfoIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
@@ -2496,7 +2496,7 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
}
|
||||
if (struct.isSetLoggingTransactionInfo()) {
|
||||
oprot.writeFieldBegin(LOGGING_TRANSACTION_INFO_FIELD_DESC);
|
||||
oprot.writeI16(struct.loggingTransactionInfo);
|
||||
oprot.writeByte(struct.loggingTransactionInfo);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
@@ -2666,7 +2666,7 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
oprot.writeI16(struct.applicationServiceType);
|
||||
}
|
||||
if (struct.isSetLoggingTransactionInfo()) {
|
||||
oprot.writeI16(struct.loggingTransactionInfo);
|
||||
oprot.writeByte(struct.loggingTransactionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2784,7 +2784,7 @@ public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, jav
|
||||
struct.setApplicationServiceTypeIsSet(true);
|
||||
}
|
||||
if (incoming.get(22)) {
|
||||
struct.loggingTransactionInfo = iprot.readI16();
|
||||
struct.loggingTransactionInfo = iprot.readByte();
|
||||
struct.setLoggingTransactionInfoIsSet(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ struct TSpan {
|
||||
26: optional TIntStringValue exceptionInfo;
|
||||
|
||||
30: optional i16 applicationServiceType;
|
||||
31: optional i16 loggingTransactionInfo;
|
||||
31: optional byte loggingTransactionInfo;
|
||||
}
|
||||
|
||||
struct TSpanChunk {
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.navercorp.pinpoint.common.bo.SpanEventBo;
|
||||
import com.navercorp.pinpoint.common.service.AnnotationKeyRegistryService;
|
||||
import com.navercorp.pinpoint.common.service.ServiceTypeRegistryService;
|
||||
import com.navercorp.pinpoint.common.trace.AnnotationKeyMatcher;
|
||||
import com.navercorp.pinpoint.common.trace.LoggingInfo;
|
||||
import com.navercorp.pinpoint.web.calltree.span.CallTreeIterator;
|
||||
import com.navercorp.pinpoint.web.calltree.span.CallTreeNode;
|
||||
import com.navercorp.pinpoint.web.calltree.span.SpanAlign;
|
||||
@@ -168,7 +169,7 @@ public class TransactionInfoServiceImpl implements TransactionInfoService {
|
||||
private boolean findIsLoggingTransactionInfo(List<SpanAlign> spanAlignList) {
|
||||
for (SpanAlign spanAlign : spanAlignList) {
|
||||
if (spanAlign.isSpan()) {
|
||||
if (spanAlign.getSpanBo().isLoggingTransactionInfo()) {
|
||||
if (spanAlign.getSpanBo().getLoggingTransactionInfo() == LoggingInfo.LOGGED.getCode()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user