Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214199323
  
    --- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixLoggingMetricsIT.java
 ---
    @@ -154,6 +154,35 @@ private void verifyQueryLevelMetricsLogging(String 
query) throws SQLException {
             assertTrue(logRequestReadMetricsFuncCallCount == 1);
         }
     
    +    @Test
    +    public void testPhoenixMetricsLoggedOnAutoCommit() throws Exception {
    +        // Autocommit is turned on explicitly
    +        loggedConn.setAutoCommit(true);
    +        //with executeUpdate() method
    +        // run SELECT to verify read metrics are logged
    +        String query = "SELECT * FROM " + tableName1;
    +        verifyQueryLevelMetricsLogging(query);
    +        // run UPSERT SELECT to verify mutation metrics are logged
    +        String upsertSelect = "UPSERT INTO " + tableName2 + " SELECT * 
FROM " + tableName1;
    +        loggedConn.createStatement().executeUpdate(upsertSelect);
    +        // Autocommit is turned on explicitly
    +        // Hence mutation metrics are expected during implicit commit
    +        assertTrue("Mutation write metrics are not logged for " + 
tableName2,
    +                mutationWriteMetricsMap.size()  > 0);
    +        assertTrue("Mutation read metrics for not found for " + tableName1,
    +                mutationReadMetricsMap.get(tableName1).size() > 0);
    +        //with execute() method
    --- End diff --
    
    `clearAllTestMetricMaps()` should be called here to ensure we are getting 
metrics.


---

Reply via email to