Search in sources :

Example 61 with DatabaseInfo

use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.

the class JtdsJdbcUrlParserTest method testParse2.

@Test
public void testParse2() throws Exception {
    String url = "jdbc:jtds:sqlserver://10.xx.xx.xx:1433/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/CAFECHAT");
}
Also used : DatabaseInfo(com.navercorp.pinpoint.bootstrap.context.DatabaseInfo) Test(org.junit.Test)

Example 62 with DatabaseInfo

use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.

the class JtdsJdbcUrlParserTest method testParse4.

@Test
public void testParse4() throws Exception {
    String url = "jdbc:jtds:sqlserver://10.xx.xx.xx:1433";
    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(), "");
    Assert.assertEquals(info.getUrl(), "jdbc:jtds:sqlserver://10.xx.xx.xx:1433");
}
Also used : DatabaseInfo(com.navercorp.pinpoint.bootstrap.context.DatabaseInfo) Test(org.junit.Test)

Example 63 with DatabaseInfo

use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.

the class MariaDBJdbcUrlParser method parse.

@Override
public DatabaseInfo parse(String jdbcUrl) {
    if (jdbcUrl == null) {
        logger.info("jdbcUrl may not be null");
        return UnKnownDatabaseInfo.INSTANCE;
    }
    Type type = Type.findType(jdbcUrl);
    if (type == null) {
        logger.info("jdbcUrl has invalid prefix.(url:{}, prefix:{}, {})", jdbcUrl, URL_PREFIX, MYSQL_URL_PREFIX);
        return UnKnownDatabaseInfo.INSTANCE;
    }
    DatabaseInfo result = null;
    try {
        result = parse0(jdbcUrl, type);
    } catch (Exception e) {
        logger.info("MaridDBJdbcUrl parse error. url: {}, Caused: {}", jdbcUrl, e.getMessage(), e);
        result = UnKnownDatabaseInfo.createUnknownDataBase(MariaDBConstants.MARIADB, MariaDBConstants.MARIADB_EXECUTE_QUERY, jdbcUrl);
    }
    return result;
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) UnKnownDatabaseInfo(com.navercorp.pinpoint.bootstrap.plugin.jdbc.UnKnownDatabaseInfo) DatabaseInfo(com.navercorp.pinpoint.bootstrap.context.DatabaseInfo) DefaultDatabaseInfo(com.navercorp.pinpoint.bootstrap.plugin.jdbc.DefaultDatabaseInfo)

Example 64 with DatabaseInfo

use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.

the class MariaDBUrlParserTest method mariadbParseCookierunMaster.

@Test
public void mariadbParseCookierunMaster() {
    DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:mariadb://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(), MariaDBConstants.MARIADB);
    Assert.assertEquals(dbInfo.getHost().get(0), "10.115.8.209:5605");
    Assert.assertEquals(dbInfo.getDatabaseId(), "db_cookierun");
    Assert.assertEquals(dbInfo.getUrl(), "jdbc:mariadb://10.115.8.209:5605/db_cookierun");
    logger.info(dbInfo.toString());
}
Also used : DatabaseInfo(com.navercorp.pinpoint.bootstrap.context.DatabaseInfo) Test(org.junit.Test)

Example 65 with DatabaseInfo

use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.

the class MariaDBUrlParserTest method parseFailTest1.

@Test
public void parseFailTest1() {
    DatabaseInfo dbInfo = jdbcUrlParser.parse(null);
    Assert.assertFalse(dbInfo.isParsingComplete());
    Assert.assertEquals(ServiceType.UNKNOWN_DB, dbInfo.getType());
}
Also used : DatabaseInfo(com.navercorp.pinpoint.bootstrap.context.DatabaseInfo) Test(org.junit.Test)

Aggregations

DatabaseInfo (com.navercorp.pinpoint.bootstrap.context.DatabaseInfo)74 Test (org.junit.Test)48 UnKnownDatabaseInfo (com.navercorp.pinpoint.bootstrap.plugin.jdbc.UnKnownDatabaseInfo)25 DatabaseInfoAccessor (com.navercorp.pinpoint.bootstrap.plugin.jdbc.DatabaseInfoAccessor)20 DefaultDatabaseInfo (com.navercorp.pinpoint.bootstrap.plugin.jdbc.DefaultDatabaseInfo)8 ParsingResult (com.navercorp.pinpoint.bootstrap.context.ParsingResult)4 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)4 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)4 ParsingResultAccessor (com.navercorp.pinpoint.bootstrap.plugin.jdbc.ParsingResultAccessor)4 RegularStatement (com.datastax.driver.core.RegularStatement)2 BindValueAccessor (com.navercorp.pinpoint.bootstrap.plugin.jdbc.BindValueAccessor)2 BoundStatement (com.datastax.driver.core.BoundStatement)1 Cluster (com.datastax.driver.core.Cluster)1 Host (com.datastax.driver.core.Host)1 InstrumentClass (com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass)1 InstrumentException (com.navercorp.pinpoint.bootstrap.instrument.InstrumentException)1 Instrumentor (com.navercorp.pinpoint.bootstrap.instrument.Instrumentor)1 TransformCallback (com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback)1 JdbcUrlParserV2 (com.navercorp.pinpoint.bootstrap.plugin.jdbc.JdbcUrlParserV2)1 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1