private DataSource collectDataSource(DataSourceMonitorWrapper dataSourceMonitor) {
        final DataSource dataSource = new DataSource(dataSourceMonitor.getId());
        dataSource.setServiceTypeCode(dataSourceMonitor.getServiceType().getCode());

        String jdbcUrl = dataSourceMonitor.getUrl();
        if (jdbcUrl != null) {
            dataSource.setUrl(jdbcUrl);

            DatabaseInfo databaseInfo = jdbcUrlParsingService.getDatabaseInfo(jdbcUrl);
            if (databaseInfo != null) {
                dataSource.setDatabaseName(databaseInfo.getDatabaseId());
            }
        }

        int activeConnectionSize = dataSourceMonitor.getActiveConnectionSize();
        // this field is optional (default value is 0)
        if (activeConnectionSize != 0) {
            dataSource.setActiveConnectionSize(activeConnectionSize);
        }

        dataSource.setMaxConnectionSize(dataSourceMonitor.getMaxConnectionSize());

        return dataSource;
    }
@author Taejin Koo
@author HyunGil Jeong
agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/datasource/DefaultDataSourceMetric.java