예제 #1
0
  @Test
  public void mysqlParse2() {

    DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:mysql://10.98.133.22:3306/test_lucy_db");
    Assert.assertEquals(dbInfo.getType(), MySqlConstants.MYSQL);
    Assert.assertEquals(dbInfo.getHost().get(0), "10.98.133.22:3306");

    Assert.assertEquals(dbInfo.getDatabaseId(), "test_lucy_db");
    Assert.assertEquals(dbInfo.getUrl(), "jdbc:mysql://10.98.133.22:3306/test_lucy_db");
    logger.info(dbInfo.toString());
    logger.info(dbInfo.getMultipleHost());
  }
  @Override
  protected void doInAfterTrace(
      SpanEventRecorder recorder,
      Object target,
      Object[] args,
      Object result,
      Throwable throwable) {
    DatabaseInfo databaseInfo = databaseInfoAccessor.get(target, UnKnownDatabaseInfo.INSTANCE);

    recorder.recordServiceType(databaseInfo.getType());
    recorder.recordEndPoint(databaseInfo.getMultipleHost());
    recorder.recordDestinationId(databaseInfo.getDatabaseId());

    recorder.recordApi(methodDescriptor, args);
    recorder.recordException(throwable);
  }