use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class MariaDBUrlParserTest method mariadbParseCookierunSlave.
@Test
public void mariadbParseCookierunSlave() {
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:mariadb:loadbalance://10.118.222.35:5605/db_cookierun?useUnicode=true&characterEncoding=UTF-8&noAccessToProcedureBodies=true&autoDeserialize=true&elideSetAutoCommits=true&sessionVariables=time_zone='%2B09:00',tx_isolation='READ-UNCOMMITTED'");
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(dbInfo.getType(), MariaDBConstants.MARIADB);
Assert.assertEquals(dbInfo.getHost().get(0), "10.118.222.35:5605");
Assert.assertEquals(dbInfo.getDatabaseId(), "db_cookierun");
Assert.assertEquals(dbInfo.getUrl(), "jdbc:mariadb:loadbalance://10.118.222.35:5605/db_cookierun");
logger.info(dbInfo.toString());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class MySQLConnectionCreateInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
if (args == null || args.length != 5) {
return;
}
final String hostToConnectTo = getString(args[0]);
final Integer portToConnectTo = getInteger(args[1]);
final String databaseId = getString(args[3]);
// In case of loadbalance, connectUrl is modified.
// final String url = getString(args[4]);
DatabaseInfo databaseInfo = null;
if (hostToConnectTo != null && portToConnectTo != null && databaseId != null) {
// It's dangerous to use this url directly
databaseInfo = createDatabaseInfo(hostToConnectTo, portToConnectTo, databaseId);
if (InterceptorUtils.isSuccess(throwable)) {
// Set only if connection is success.
if (target instanceof DatabaseInfoAccessor) {
((DatabaseInfoAccessor) target)._$PINPOINT$_setDatabaseInfo(databaseInfo);
}
}
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
SpanEventRecorder recorder = trace.currentSpanEventRecorder();
// We must do this if current transaction is being recorded.
if (databaseInfo != null) {
recorder.recordServiceType(databaseInfo.getType());
recorder.recordEndPoint(databaseInfo.getMultipleHost());
recorder.recordDestinationId(databaseInfo.getDatabaseId());
}
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class MySqlUrlParserTest method mysqlParseCookierunMaster.
@Test
public void mysqlParseCookierunMaster() {
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:mysql://10.115.8.209:5605/db_cookierun?useUnicode=true&characterEncoding=UTF-8&noAccessToProcedureBodies=true&autoDeserialize=true&elideSetAutoCommits=true&sessionVariables=time_zone='%2B09:00',tx_isolation='READ-COMMITTED'");
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(dbInfo.getType(), MySqlConstants.MYSQL);
Assert.assertEquals(dbInfo.getHost().get(0), "10.115.8.209:5605");
Assert.assertEquals(dbInfo.getDatabaseId(), "db_cookierun");
Assert.assertEquals(dbInfo.getUrl(), "jdbc:mysql://10.115.8.209:5605/db_cookierun");
logger.info(dbInfo.toString());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class JtdsJdbcUrlParserTest method testParse6.
@Test
public void testParse6() throws Exception {
// jdbc:jtds:sqlserver://server[:port][/database][;property=value[;...]]
// jdbc:jtds:sqlserver://server/db;user=userName;password=password
String url = "jdbc:jtds:sqlserver://10.xx.xx.xx";
DatabaseInfo info = parser.parse(url);
Assert.assertTrue(info.isParsingComplete());
Assert.assertEquals(info.getType(), JtdsConstants.MSSQL);
Assert.assertEquals(info.getMultipleHost(), "10.xx.xx.xx");
Assert.assertEquals(info.getDatabaseId(), "");
Assert.assertEquals(info.getUrl(), "jdbc:jtds:sqlserver://10.xx.xx.xx");
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class JtdsJdbcUrlParserTest method testParse1.
@Test
public void testParse1() throws Exception {
// jdbc:jtds:sqlserver://server[:port][/database][;property=value[;...]]
// jdbc:jtds:sqlserver://server/db;user=userName;password=password
String url = "jdbc:jtds:sqlserver://10.xx.xx.xx:1433;DatabaseName=CAFECHAT;sendStringParametersAsUnicode=false;useLOBs=false;loginTimeout=3";
DatabaseInfo info = parser.parse(url);
Assert.assertTrue(info.isParsingComplete());
Assert.assertEquals(info.getType(), JtdsConstants.MSSQL);
Assert.assertEquals(info.getMultipleHost(), "10.xx.xx.xx:1433");
Assert.assertEquals(info.getDatabaseId(), "CAFECHAT");
Assert.assertEquals(info.getUrl(), "jdbc:jtds:sqlserver://10.xx.xx.xx:1433");
}
Aggregations