@Override
    public UsagePerPlanBean getUsagePerPlan(String organizationId, String apiId, String version,
            DateTime from, DateTime to) {
        try {
            QueryRunner run = new QueryRunner(ds);
            String sql = "SELECT `plan`, count(*) FROM gw_requests WHERE api_org_id = ? AND api_id = ? AND api_version = ? AND rstart >= ? AND rstart < ? GROUP BY  `plan`"; //$NON-NLS-1$
            ResultSetHandler<UsagePerPlanBean> handler = new UsagePerPlanHandler();
            return run.query(sql, handler,  organizationId, apiId, version, from.getMillis(), to.getMillis());
        } catch (SQLException e) {
            e.printStackTrace();
            return new UsagePerPlanBean();
        }
    }
@see io.apiman.manager.api.core.IMetricsAccessor#getUsagePerPlan(java.lang.String, java.lang.String, java.lang.String, org.joda.time.DateTime, org.joda.time.DateTime)
manager/api/jdbc/src/main/java/io/apiman/manager/api/jdbc/JdbcMetricsAccessor.java