Hi felixbarny,
below is my code but still I can't see the stats.
public class TestAPM
{
public static void main(String[] args)
{
String TransactionID = args[0];
String SpanID = args[1];
Transaction transaction = ElasticApm.startTransaction();
try
{
transaction.setName("TransactionID");
transaction.setType(Transaction.TYPE_REQUEST);
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/billing", "devuser", "devuser");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select uname,esmeaddr from custdb.Users LIMIT 5");
while (rs.next())
{
System.out.println(rs.getString("uname") + rs.getString("esmeaddr"));
TimeUnit.SECONDS.sleep(5);
}
}
catch (Exception e)
{
transaction.captureException(e);
try
{
throw e;
}
catch (Exception e1)
{
e1.printStackTrace();
}
}
finally
{
try
{
TimeUnit.SECONDS.sleep(10);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
transaction.end();
}
}
}
LOG:
2018-12-19T13:07:34.896+0530 INFO [request] beater/common_handlers.go:272 handled request {"request_id": "ac290c88-f3ca-459c-b3d6-a3ddd198ec85", "method": "GET", "URL": "/", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "Java/1.8.0_171", "response_code": 200}
2018-12-19T13:08:11.295+0530 INFO [request] beater/v2_handler.go:111 error handling request {"request_id": "3428ca85-9528-4862-b6f2-f0d299596292", "method": "POST", "URL": "/intake/v2/events", "content_length": -1, "remote_address": "127.0.0.1", "user-agent": "java-agent/1.1.0", "error": "read tcp 127.0.0.1:8200->127.0.0.1:54510: wsarecv: An existing connection was forcibly closed by the remote host."}