use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class CubridJdbcUrlParser method parse.
@Override
public DatabaseInfo parse(String jdbcUrl) {
if (jdbcUrl == null) {
logger.info("jdbcUrl may not be null");
return UnKnownDatabaseInfo.INSTANCE;
}
final Matcher matcher = PREFIX_PATTERN.matcher(jdbcUrl);
if (!matcher.find()) {
logger.info("jdbcUrl has invalid prefix.(url:{}, prefix-pattern:{})", jdbcUrl, URL_PREFIX_PATTERN);
return UnKnownDatabaseInfo.INSTANCE;
}
DatabaseInfo result = null;
try {
result = parse0(jdbcUrl);
} catch (Exception e) {
logger.info("CubridJdbcUrl parse error. url: {}, Caused: {}", jdbcUrl, e.getMessage(), e);
result = UnKnownDatabaseInfo.createUnknownDataBase(CubridConstants.CUBRID, CubridConstants.CUBRID_EXECUTE_QUERY, jdbcUrl);
}
return result;
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class CubridConnectionStringParserTest method parseFailTest2.
@Test
public void parseFailTest2() {
String cubrid = "jdbc:mysql:10.99.196.126:34001:nrdwapw:::?charset=utf-8:";
DatabaseInfo dbInfo = parser.parse(cubrid);
Assert.assertFalse(dbInfo.isParsingComplete());
Assert.assertEquals(ServiceType.UNKNOWN_DB, dbInfo.getType());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class CubridConnectionStringParserTest method testParse2.
@Test
public void testParse2() {
String cubrid = "jdbc:cubrid-mysql:10.99.196.126:34001:nrdwapw:::?charset=utf-8:";
DatabaseInfo dbInfo = parser.parse(cubrid);
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(CubridConstants.CUBRID, dbInfo.getType());
Assert.assertEquals("10.99.196.126:34001", dbInfo.getHost().get(0));
Assert.assertEquals("nrdwapw", dbInfo.getDatabaseId());
Assert.assertEquals("jdbc:cubrid-mysql:10.99.196.126:34001:nrdwapw:::", dbInfo.getUrl());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class CubridConnectionStringParserTest method testParse3.
@Test
public void testParse3() {
String cubrid = "jdbc:cubrid-oracle:10.99.196.126:34001:nrdwapw:::?charset=utf-8:";
DatabaseInfo dbInfo = parser.parse(cubrid);
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(CubridConstants.CUBRID, dbInfo.getType());
Assert.assertEquals("10.99.196.126:34001", dbInfo.getHost().get(0));
Assert.assertEquals("nrdwapw", dbInfo.getDatabaseId());
Assert.assertEquals("jdbc:cubrid-oracle:10.99.196.126:34001:nrdwapw:::", dbInfo.getUrl());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class CassandraDriverConnectInterceptor method prepareAfterTrace.
@Override
protected void prepareAfterTrace(Object target, Object[] args, Object result, Throwable throwable) {
final boolean success = InterceptorUtils.isSuccess(throwable);
// Must not check if current transaction is trace target or not. Connection can be made by other thread.
List<String> hostList = new ArrayList<String>();
if (target instanceof Cluster) {
Cluster cluster = (Cluster) target;
final Set<Host> hosts = cluster.getMetadata().getAllHosts();
final int port = cluster.getConfiguration().getProtocolOptions().getPort();
for (Host host : hosts) {
final String hostAddress = host.getAddress().getHostAddress() + ":" + port;
hostList.add(hostAddress);
}
}
if (args == null) {
return;
}
final String keyspace = (String) args[0];
DatabaseInfo databaseInfo = createDatabaseInfo(keyspace, hostList);
if (success) {
if (recordConnection) {
if (result instanceof DatabaseInfoAccessor) {
((DatabaseInfoAccessor) result)._$PINPOINT$_setDatabaseInfo(databaseInfo);
}
}
}
}
Aggregations