use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.
the class DefaultApiMetaDataService method cacheApi.
@Override
public int cacheApi(final MethodDescriptor methodDescriptor) {
final String fullName = methodDescriptor.getFullName();
final Result result = this.apiCache.put(fullName);
methodDescriptor.setApiId(result.getId());
if (result.isNewValue()) {
final TApiMetaData apiMetadata = new TApiMetaData();
apiMetadata.setAgentId(agentId);
apiMetadata.setAgentStartTime(agentStartTime);
apiMetadata.setApiId(result.getId());
apiMetadata.setApiInfo(methodDescriptor.getApiDescriptor());
apiMetadata.setLine(methodDescriptor.getLineNumber());
apiMetadata.setType(methodDescriptor.getType());
this.enhancedDataSender.request(apiMetadata);
}
return result.getId();
}
use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.
the class TcpDataSenderReconnectTest method connectAndSend.
@Test
public void connectAndSend() throws InterruptedException {
TestPinpointServerAcceptor oldTestPinpointServerAcceptor = new TestPinpointServerAcceptor(new LoggingServerMessageListenerFactory(true));
int bindPort = oldTestPinpointServerAcceptor.bind();
PinpointClientFactory clientFactory = createPinpointClientFactory();
TcpDataSender sender = new TcpDataSender(this.getClass().getName(), TestPinpointServerAcceptor.LOCALHOST, bindPort, clientFactory);
oldTestPinpointServerAcceptor.assertAwaitClientConnected(5000);
oldTestPinpointServerAcceptor.close();
waitClientDisconnected(sender);
logger.debug("Server start------------------");
TestPinpointServerAcceptor newTestPinpointServerAcceptor = new TestPinpointServerAcceptor(new LoggingServerMessageListenerFactory(true));
newTestPinpointServerAcceptor.bind(bindPort);
newTestPinpointServerAcceptor.assertAwaitClientConnected(5000);
logger.debug("sendMessage------------------");
sender.send(new TApiMetaData("test", System.currentTimeMillis(), 1, "TestApi"));
Thread.sleep(500);
logger.debug("sender stop------------------");
sender.stop();
newTestPinpointServerAcceptor.close();
clientFactory.release();
}
use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.
the class TcpDataSenderTest method connectAndSend.
@Test
public void connectAndSend() {
TestServerMessageListenerFactory testServerMessageListenerFactory = new TestServerMessageListenerFactory(TestServerMessageListenerFactory.HandshakeType.DUPLEX, true);
TestServerMessageListenerFactory.TestServerMessageListener serverMessageListener = testServerMessageListenerFactory.create();
TestPinpointServerAcceptor testPinpointServerAcceptor = new TestPinpointServerAcceptor(testServerMessageListenerFactory);
int bindPort = testPinpointServerAcceptor.bind();
PinpointClientFactory clientFactory = createPinpointClientFactory();
TcpDataSender<Object> sender = new TcpDataSender<>(this.getClass().getName(), TestPinpointServerAcceptor.LOCALHOST, bindPort, clientFactory);
try {
sender.send(new TApiMetaData("test", System.currentTimeMillis(), 1, "TestApi"));
sender.send(new TApiMetaData("test", System.currentTimeMillis(), 1, "TestApi"));
serverMessageListener.awaitAssertExpectedSendCount(2, 1000);
} finally {
sender.stop();
if (clientFactory != null) {
clientFactory.release();
}
testPinpointServerAcceptor.close();
}
}
use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.
the class DefaultTBaseLocator method addBodyFactory.
public static void addBodyFactory(TypeLocatorBuilder<TBase<?, ?>> builder) {
builder.addBodyFactory(SPAN, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TSpan();
}
});
builder.addBodyFactory(AGENT_INFO, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TAgentInfo();
}
});
builder.addBodyFactory(AGENT_STAT, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TAgentStat();
}
});
builder.addBodyFactory(AGENT_STAT_BATCH, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TAgentStatBatch();
}
});
builder.addBodyFactory(SPANCHUNK, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TSpanChunk();
}
});
builder.addBodyFactory(SPANEVENT, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TSpanEvent();
}
});
builder.addBodyFactory(SQLMETADATA, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TSqlMetaData();
}
});
builder.addBodyFactory(APIMETADATA, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TApiMetaData();
}
});
builder.addBodyFactory(RESULT, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TResult();
}
});
builder.addBodyFactory(STRINGMETADATA, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TStringMetaData();
}
});
builder.addBodyFactory(NETWORK_CHECK, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new NetworkAvailabilityCheckPacket();
}
});
builder.addBodyFactory(CHUNK, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return null;
}
});
}
use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.
the class TestTcpDataSender method addData.
private void addData(TBase<?, ?> data) {
if (data instanceof TApiMetaData) {
TApiMetaData md = (TApiMetaData) data;
final String javaMethodDescriptor = toJavaMethodDescriptor(md);
apiIdMap.put(md.getApiId(), javaMethodDescriptor);
} else if (data instanceof TSqlMetaData) {
TSqlMetaData md = (TSqlMetaData) data;
int id = md.getSqlId();
String sql = md.getSql();
sqlIdMap.put(id, sql);
} else if (data instanceof TStringMetaData) {
TStringMetaData md = (TStringMetaData) data;
int id = md.getStringId();
String string = md.getStringValue();
stringIdMap.put(id, string);
}
datas.add(data);
}
Aggregations