use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class TProtocolReadMessageEndInterceptor method recordRootSpan.
private void recordRootSpan(final Trace trace, final ThriftRequestProperty parentTraceInfo, Object target) {
// begin root span
SpanRecorder recorder = trace.getSpanRecorder();
recorder.recordServiceType(ThriftConstants.THRIFT_SERVER);
recorder.recordApi(this.thriftServerEntryMethodDescriptor);
if (!trace.isRoot()) {
recordParentInfo(recorder, parentTraceInfo);
}
// record connection information here as the socket may be closed by the time the Span is popped in
// TBaseAsyncProcessorProcessInterceptor's after section.
TTransport transport = ((TProtocol) target).getTransport();
recordConnection(recorder, transport);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class DefaultSpanRecorderTest method testRecordApiId.
@Test
public void testRecordApiId() throws Exception {
Span span = new Span(traceRoot);
SpanRecorder recorder = new DefaultSpanRecorder(span, true, true, stringMetaDataService, sqlMetaDataService, errorHandler);
final int API_ID = 1000;
recorder.recordApiId(API_ID);
Assert.assertEquals("API ID", span.getApiId(), API_ID);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class DefaultSpanRecorderTest method testRecordEndPoint.
@Test
public void testRecordEndPoint() throws Exception {
when(traceRoot.getShared()).thenReturn(shared);
Span span = new Span(traceRoot);
SpanRecorder recorder = new DefaultSpanRecorder(span, true, true, stringMetaDataService, sqlMetaDataService, errorHandler);
final String endPoint = "endPoint";
recorder.recordEndPoint(endPoint);
verify(traceRoot.getShared()).setEndPoint(endPoint);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class RabbitMQConsumerHandleCompleteInboundCommandInterceptor method createTrace.
private Trace createTrace(AMQChannel amqChannel, AMQCommand amqCommand) {
AMQConnection connection = amqChannel.getConnection();
if (connection == null) {
logger.debug("connection is null, skipping trace");
}
Method method = amqCommand.getMethod();
AMQP.Basic.GetOk getOk = (AMQP.Basic.GetOk) method;
String exchange = getOk.getExchange();
if (RabbitMQClientPluginConfig.isExchangeExcluded(exchange, excludeExchangeFilter)) {
if (isDebug) {
logger.debug("exchange {} is excluded", exchange);
}
return null;
}
String routingKey = getOk.getRoutingKey();
Map<String, Object> headers = getHeadersFromContentHeader(amqCommand.getContentHeader());
// If this transaction is not traceable, mark as disabled.
if (headers.get(RabbitMQClientConstants.META_SAMPLED) != null) {
return traceContext.disableSampling();
}
final TraceId traceId = populateTraceIdFromRequest(headers);
// If there's no trasanction id, a new trasaction begins here.
final Trace trace = traceId == null ? traceContext.newTraceObject() : traceContext.continueTraceObject(traceId);
if (trace.canSampled()) {
final SpanRecorder recorder = trace.getSpanRecorder();
recordRootSpan(recorder, connection, exchange, routingKey, headers);
}
return trace;
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class RabbitMQConsumerDispatchInterceptor method createTrace.
private Trace createTrace(Object target, Object[] args) {
final Channel channel = ((ChannelGetter) target)._$PINPOINT$_getChannel();
if (channel == null) {
logger.debug("channel is null, skipping trace");
return null;
}
final Connection connection = channel.getConnection();
if (connection == null) {
logger.debug("connection is null, skipping trace");
return null;
}
Envelope envelope = ArrayArgumentUtils.getArgument(args, 2, Envelope.class);
String exchange = envelope.getExchange();
if (RabbitMQClientPluginConfig.isExchangeExcluded(exchange, excludeExchangeFilter)) {
if (isDebug) {
logger.debug("exchange {} is excluded", exchange);
}
return null;
}
// args[3] may be null
AMQP.BasicProperties properties = (AMQP.BasicProperties) args[3];
Map<String, Object> headers = getHeadersFromBasicProperties(properties);
// If this transaction is not traceable, mark as disabled.
if (headers.get(RabbitMQClientConstants.META_SAMPLED) != null) {
return traceContext.disableSampling();
}
final TraceId traceId = populateTraceIdFromRequest(headers);
// If there's no trasanction id, a new trasaction begins here.
final Trace trace = traceId == null ? traceContext.newTraceObject() : traceContext.continueTraceObject(traceId);
if (trace.canSampled()) {
final SpanRecorder recorder = trace.getSpanRecorder();
recordRootSpan(recorder, connection, envelope, headers);
}
return trace;
}
Aggregations