test_class.file: src/server/src/test/java/io/cassandrareaper/service/MetricsServiceTest.java
test_class.identifier: MetricsServiceTest
test_case.body: @Test
    public void testGetTpstats()
        throws InterruptedException, ReaperException, JMException, IOException, ClassNotFoundException {
  
      AppContext cxt = new AppContext();
      ClusterFacade clusterFacade = Mockito.mock(ClusterFacade.class);
      Mockito.doReturn(Collections.singletonList("")).when(clusterFacade).getTpStats(any());
      cxt.config = new ReaperApplicationConfiguration();
      cxt.config.setJmxConnectionTimeoutInSeconds(10);
      cxt.jmxConnectionFactory = mock(JmxConnectionFactory.class);
      JmxProxy jmx = (JmxProxy) mock(Class.forName("io.cassandrareaper.jmx.JmxProxyImpl"));
      when(cxt.jmxConnectionFactory.connectAny(any(Collection.class))).thenReturn(jmx);
      MBeanServerConnection serverConn = mock(MBeanServerConnection.class);
      JmxProxyTest.mockGetMBeanServerConnection(jmx, serverConn);
  
      // @todo capture objectName and return valid set of objectNames,
      // to properly test MetricsProxy.collectMetrics(..) and MetricsService.convertToThreadPoolStats(..)
      when(serverConn.queryNames(Mockito.any(ObjectName.class), Mockito.isNull())).thenReturn(Collections.emptySet());
  
      Node node = Node.builder().withHostname("127.0.0.1").build();
      MetricsService.create(cxt, () -> clusterFacade).getTpStats(node);
      Mockito.verify(clusterFacade, Mockito.times(1)).getTpStats(Mockito.any());
    }
test_case.class_method_signature: MetricsServiceTest.testGetTpstats()
test_case.full_signature: @Test public void testGetTpstats()
test_case.identifier: testGetTpstats
test_case.invocations: mock getTpStats when doReturn singletonList any setJmxConnectionTimeoutInSeconds mock mock forName thenReturn when connectAny any mock mockGetMBeanServerConnection thenReturn when queryNames any isNull emptySet build withHostname builder getTpStats create getTpStats verify times any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetTpstats()
focal_class.declarator: LOG = LoggerFactory.getLogger(MetricsService.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(MetricsService.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: COLLECTED_METRICS = {
      "org.apache.cassandra.metrics:type=ThreadPools,path=request,*",
      "org.apache.cassandra.metrics:type=ThreadPools,path=internal,*",
      "org.apache.cassandra.metrics:type=ClientRequest,*",
      "org.apache.cassandra.metrics:type=DroppedMessage,*"
    }
focal_class.modifier: private static final
focal_class.original_string: private static final String[] COLLECTED_METRICS = {
      "org.apache.cassandra.metrics:type=ThreadPools,path=request,*",
      "org.apache.cassandra.metrics:type=ThreadPools,path=internal,*",
      "org.apache.cassandra.metrics:type=ClientRequest,*",
      "org.apache.cassandra.metrics:type=DroppedMessage,*"
    };
focal_class.type: String[]
focal_class.var_name: COLLECTED_METRICS
focal_class.declarator: context
focal_class.modifier: private final
focal_class.original_string: private final AppContext context;
focal_class.type: AppContext
focal_class.var_name: context
focal_class.declarator: clusterFacade
focal_class.modifier: private final
focal_class.original_string: private final ClusterFacade clusterFacade;
focal_class.type: ClusterFacade
focal_class.var_name: clusterFacade
focal_class.declarator: objectMapper = new ObjectMapper()
focal_class.modifier: private final
focal_class.original_string: private final ObjectMapper objectMapper = new ObjectMapper();
focal_class.type: ObjectMapper
focal_class.var_name: objectMapper
focal_class.declarator: localClusterName
focal_class.modifier: private final
focal_class.original_string: private final String localClusterName;
focal_class.type: String
focal_class.var_name: localClusterName
focal_class.file: src/server/src/main/java/io/cassandrareaper/service/MetricsService.java
focal_class.identifier: MetricsService
focal_class.class_method_signature: MetricsService.MetricsService(AppContext context, Supplier<ClusterFacade> clusterFacadeSupplier)
focal_class.full_signature: private  MetricsService(AppContext context, Supplier<ClusterFacade> clusterFacadeSupplier)
focal_class.identifier: MetricsService
focal_class.modifiers: private
focal_class.parameters: (AppContext context, Supplier<ClusterFacade> clusterFacadeSupplier)
focal_class.signature:  MetricsService(AppContext context, Supplier<ClusterFacade> clusterFacadeSupplier)
focal_class.class_method_signature: MetricsService.create(AppContext context, Supplier<ClusterFacade> supplier)
focal_class.full_signature: @VisibleForTesting static MetricsService create(AppContext context, Supplier<ClusterFacade> supplier)
focal_class.identifier: create
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (AppContext context, Supplier<ClusterFacade> supplier)
focal_class.return: MetricsService
focal_class.signature: MetricsService create(AppContext context, Supplier<ClusterFacade> supplier)
focal_class.class_method_signature: MetricsService.create(AppContext context)
focal_class.full_signature: public static MetricsService create(AppContext context)
focal_class.identifier: create
focal_class.modifiers: public static
focal_class.parameters: (AppContext context)
focal_class.return: MetricsService
focal_class.signature: MetricsService create(AppContext context)
focal_class.class_method_signature: MetricsService.getTpStats(Node host)
focal_class.full_signature: public List<ThreadPoolStat> getTpStats(Node host)
focal_class.identifier: getTpStats
focal_class.modifiers: public
focal_class.parameters: (Node host)
focal_class.return: List<ThreadPoolStat>
focal_class.signature: List<ThreadPoolStat> getTpStats(Node host)
focal_class.class_method_signature: MetricsService.getDroppedMessages(Node host)
focal_class.full_signature: public List<DroppedMessages> getDroppedMessages(Node host)
focal_class.identifier: getDroppedMessages
focal_class.modifiers: public
focal_class.parameters: (Node host)
focal_class.return: List<DroppedMessages>
focal_class.signature: List<DroppedMessages> getDroppedMessages(Node host)
focal_class.class_method_signature: MetricsService.getClientRequestLatencies(Node host)
focal_class.full_signature: public List<MetricsHistogram> getClientRequestLatencies(Node host)
focal_class.identifier: getClientRequestLatencies
focal_class.modifiers: public
focal_class.parameters: (Node host)
focal_class.return: List<MetricsHistogram>
focal_class.signature: List<MetricsHistogram> getClientRequestLatencies(Node host)
focal_class.class_method_signature: MetricsService.convertToGenericMetrics(Map<String, List<JmxStat>> jmxStats, Node node)
focal_class.full_signature: public List<GenericMetric> convertToGenericMetrics(Map<String, List<JmxStat>> jmxStats, Node node)
focal_class.identifier: convertToGenericMetrics
focal_class.modifiers: public
focal_class.parameters: (Map<String, List<JmxStat>> jmxStats, Node node)
focal_class.return: List<GenericMetric>
focal_class.signature: List<GenericMetric> convertToGenericMetrics(Map<String, List<JmxStat>> jmxStats, Node node)
focal_class.class_method_signature: MetricsService.grabAndStoreGenericMetrics()
focal_class.full_signature:  void grabAndStoreGenericMetrics()
focal_class.identifier: grabAndStoreGenericMetrics
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void grabAndStoreGenericMetrics()
focal_class.class_method_signature: MetricsService.grabAndStoreCompactionStats()
focal_class.full_signature:  void grabAndStoreCompactionStats()
focal_class.identifier: grabAndStoreCompactionStats
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void grabAndStoreCompactionStats()
focal_class.class_method_signature: MetricsService.grabAndStoreActiveStreams()
focal_class.full_signature:  void grabAndStoreActiveStreams()
focal_class.identifier: grabAndStoreActiveStreams
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void grabAndStoreActiveStreams()
focal_method.body: public List<ThreadPoolStat> getTpStats(Node host) throws ReaperException {
      return clusterFacade.getTpStats(host);
    }
focal_method.class_method_signature: MetricsService.getTpStats(Node host)
focal_method.full_signature: public List<ThreadPoolStat> getTpStats(Node host)
focal_method.identifier: getTpStats
focal_method.invocations: getTpStats
focal_method.modifiers: public
focal_method.parameters: (Node host)
focal_method.return: List<ThreadPoolStat>
focal_method.signature: List<ThreadPoolStat> getTpStats(Node host)