Search in sources :

Example 1 with LoggingInfo

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

the class PluginVerifierExternalAdaptor method verifyIsLoggingTransactionInfo.

@Override
public void verifyIsLoggingTransactionInfo(LoggingInfo loggingInfo) {
    final Item<SpanType> item = popItem();
    if (item == null) {
        throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "]" + " but loggingTransactionInfo value invalid.");
    }
    final TraceRoot traceRoot = item.getTraceRoot();
    final byte loggingTransactionInfo = traceRoot.getShared().getLoggingInfo();
    if (loggingTransactionInfo != loggingInfo.getCode()) {
        LoggingInfo code = LoggingInfo.searchByCode(loggingTransactionInfo);
        String codeName = getCodeName(code);
        AssertionErrorBuilder builder = new AssertionErrorBuilder("Span.isLoggingTransactionInfo value", loggingInfo.getName(), codeName);
        builder.setComparison(loggingInfo.getName(), codeName);
        builder.throwAssertionError();
    }
}
Also used : SpanType(com.navercorp.pinpoint.profiler.context.SpanType) AssertionErrorBuilder(com.navercorp.pinpoint.test.util.AssertionErrorBuilder) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) LoggingInfo(com.navercorp.pinpoint.common.trace.LoggingInfo)

Example 2 with LoggingInfo

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

the class PluginTestAgent method verifyIsLoggingTransactionInfo.

@Override
public void verifyIsLoggingTransactionInfo(LoggingInfo loggingInfo) {
    Object actual = popSpan();
    Span span = null;
    if (actual instanceof Span) {
        span = (Span) actual;
    } else if (actual instanceof SpanEvent) {
        span = ((SpanEvent) actual).getSpan();
    } else {
        throw new IllegalArgumentException("Unexpected type: " + getActual(actual));
    }
    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.");
        }
    }
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) Span(com.navercorp.pinpoint.profiler.context.Span) LoggingInfo(com.navercorp.pinpoint.common.trace.LoggingInfo)

Aggregations

LoggingInfo (com.navercorp.pinpoint.common.trace.LoggingInfo)2 Span (com.navercorp.pinpoint.profiler.context.Span)1 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)1 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)1 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)1 AssertionErrorBuilder (com.navercorp.pinpoint.test.util.AssertionErrorBuilder)1 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)1 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)1