The methods that you are invoking assume that the Phoenix JDBC driver
(the java class org.apache.phoenix.jdbc.PhoenixDriver) is in use. It's
not, so you get this error.
The Phoenix "thick" JDBC driver is what's running inside of the Phoenix
Query Server, just not in your local JVM. As such, you need to look at
PQS for metrics.
You probably want to look at what was done in
https://issues.apache.org/jira/browse/PHOENIX-3655.
On 10/16/18 2:49 PM, Monil Gandhi wrote:
Hello,
I am trying to collect some metrics on certain queries. Here is the code
that I have
Properties props =new Properties();
props.setProperty(QueryServices.COLLECT_REQUEST_LEVEL_METRICS, "true");
props.setProperty("phoenix.trace.frequency", "always");
try (Connection conn = DriverManager.getConnection(url, props)) {
conn.setAutoCommit(true);
PreparedStatement stmt = conn.prepareStatement(query);
Map<org.apache.phoenix.monitoring.MetricType, Long> overAllQueryMetrics =null;
Map<String, Map<org.apache.phoenix.monitoring.MetricType, Long>>
requestReadMetrics =null;
try (ResultSet rs = stmt.executeQuery()) {
rs.next();
requestReadMetrics = PhoenixRuntime.getRequestReadMetricInfo(rs);
// log or report metrics as needed
PhoenixRuntime.resetMetrics(rs);
rs.close();
}
}
However, rs.next() throws the following error
java.sql.SQLException: does not implement 'class
org.apache.phoenix.jdbc.PhoenixResultSet'
I am not sure why the error is happening. Are metrics not supported with
thin client?
If not how do I get query level metrics?
Thanks