test_class.declarator: context
test_class.original_string: HystrixRequestContext context;
test_class.type: HystrixRequestContext
test_class.var_name: context
test_class.declarator: stream
test_class.original_string: HealthCountsStream stream;
test_class.type: HealthCountsStream
test_class.var_name: stream
test_class.declarator: groupKey = HystrixCommandGroupKey.Factory.asKey("HealthCounts")
test_class.modifier: static
test_class.original_string: static HystrixCommandGroupKey groupKey = HystrixCommandGroupKey.Factory.asKey("HealthCounts");
test_class.type: HystrixCommandGroupKey
test_class.var_name: groupKey
test_class.file: hystrix-core/src/test/java/com/netflix/hystrix/metric/consumer/HealthCountsStreamTest.java
test_class.identifier: HealthCountsStreamTest
test_class.superclass: extends CommandStreamTest
test_case.body: @Test
      public void testMultipleEventsOverTimeGetStoredAndAgeOut() {
          HystrixCommandKey key = HystrixCommandKey.Factory.asKey("CMD-Health-M");
          stream = HealthCountsStream.getInstance(key, 10, 100);
  
          //by doing a take(30), we ensure that all rolling counts go back to 0
  
          final CountDownLatch latch = new CountDownLatch(1);
          stream.observe().take(30).subscribe(getSubscriber(latch));
  
          CommandStreamTest.Command cmd1 = CommandStreamTest.Command.from(groupKey, key, HystrixEventType.SUCCESS, 20);
          CommandStreamTest.Command cmd2 = CommandStreamTest.Command.from(groupKey, key, HystrixEventType.FAILURE, 10);
  
          cmd1.observe();
          cmd2.observe();
  
          try {
              assertTrue(latch.await(10000, TimeUnit.MILLISECONDS));
          } catch (InterruptedException ex) {
              fail("Interrupted ex");
          }
          System.out.println("ReqLog : " + HystrixRequestLog.getCurrentRequest().getExecutedCommandsAsString());
          assertEquals(0L, stream.getLatest().getErrorCount());
          assertEquals(0L, stream.getLatest().getTotalRequests());
      }
test_case.class_method_signature: HealthCountsStreamTest.testMultipleEventsOverTimeGetStoredAndAgeOut()
test_case.full_signature: @Test public void testMultipleEventsOverTimeGetStoredAndAgeOut()
test_case.identifier: testMultipleEventsOverTimeGetStoredAndAgeOut
test_case.invocations: asKey getInstance subscribe take observe getSubscriber from from observe observe assertTrue await fail println getExecutedCommandsAsString getCurrentRequest assertEquals getErrorCount getLatest assertEquals getTotalRequests getLatest
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMultipleEventsOverTimeGetStoredAndAgeOut()
focal_class.declarator: streams = new ConcurrentHashMap<String, HealthCountsStream>()
focal_class.modifier: private static final
focal_class.original_string: private static final ConcurrentMap<String, HealthCountsStream> streams = new ConcurrentHashMap<String, HealthCountsStream>();
focal_class.type: ConcurrentMap<String, HealthCountsStream>
focal_class.var_name: streams
focal_class.declarator: NUM_EVENT_TYPES = HystrixEventType.values().length
focal_class.modifier: private static final
focal_class.original_string: private static final int NUM_EVENT_TYPES = HystrixEventType.values().length;
focal_class.type: int
focal_class.var_name: NUM_EVENT_TYPES
focal_class.declarator: healthCheckAccumulator = new Func2<HystrixCommandMetrics.HealthCounts, long[], HystrixCommandMetrics.HealthCounts>() {
          @Override
          public HystrixCommandMetrics.HealthCounts call(HystrixCommandMetrics.HealthCounts healthCounts, long[] bucketEventCounts) {
              return healthCounts.plus(bucketEventCounts);
          }
      }
focal_class.modifier: private static final
focal_class.original_string: private static final Func2<HystrixCommandMetrics.HealthCounts, long[], HystrixCommandMetrics.HealthCounts> healthCheckAccumulator = new Func2<HystrixCommandMetrics.HealthCounts, long[], HystrixCommandMetrics.HealthCounts>() {
          @Override
          public HystrixCommandMetrics.HealthCounts call(HystrixCommandMetrics.HealthCounts healthCounts, long[] bucketEventCounts) {
              return healthCounts.plus(bucketEventCounts);
          }
      };
focal_class.type: Func2<HystrixCommandMetrics.HealthCounts, long[], HystrixCommandMetrics.HealthCounts>
focal_class.var_name: healthCheckAccumulator
focal_class.file: hystrix-core/src/main/java/com/netflix/hystrix/metric/consumer/HealthCountsStream.java
focal_class.identifier: HealthCountsStream
focal_class.class_method_signature: HealthCountsStream.getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties)
focal_class.full_signature: public static HealthCountsStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties)
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: (HystrixCommandKey commandKey, HystrixCommandProperties properties)
focal_class.return: HealthCountsStream
focal_class.signature: HealthCountsStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties)
focal_class.class_method_signature: HealthCountsStream.getInstance(HystrixCommandKey commandKey, int numBuckets, int bucketSizeInMs)
focal_class.full_signature: public static HealthCountsStream getInstance(HystrixCommandKey commandKey, int numBuckets, int bucketSizeInMs)
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: (HystrixCommandKey commandKey, int numBuckets, int bucketSizeInMs)
focal_class.return: HealthCountsStream
focal_class.signature: HealthCountsStream getInstance(HystrixCommandKey commandKey, int numBuckets, int bucketSizeInMs)
focal_class.class_method_signature: HealthCountsStream.reset()
focal_class.full_signature: public static void reset()
focal_class.identifier: reset
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void reset()
focal_class.class_method_signature: HealthCountsStream.removeByKey(HystrixCommandKey key)
focal_class.full_signature: public static void removeByKey(HystrixCommandKey key)
focal_class.identifier: removeByKey
focal_class.modifiers: public static
focal_class.parameters: (HystrixCommandKey key)
focal_class.return: void
focal_class.signature: void removeByKey(HystrixCommandKey key)
focal_class.class_method_signature: HealthCountsStream.HealthCountsStream(final HystrixCommandKey commandKey, final int numBuckets, final int bucketSizeInMs,
                                 Func2<long[], HystrixCommandCompletion, long[]> reduceCommandCompletion)
focal_class.full_signature: private  HealthCountsStream(final HystrixCommandKey commandKey, final int numBuckets, final int bucketSizeInMs,
                                 Func2<long[], HystrixCommandCompletion, long[]> reduceCommandCompletion)
focal_class.identifier: HealthCountsStream
focal_class.modifiers: private
focal_class.parameters: (final HystrixCommandKey commandKey, final int numBuckets, final int bucketSizeInMs,
                                 Func2<long[], HystrixCommandCompletion, long[]> reduceCommandCompletion)
focal_class.signature:  HealthCountsStream(final HystrixCommandKey commandKey, final int numBuckets, final int bucketSizeInMs,
                                 Func2<long[], HystrixCommandCompletion, long[]> reduceCommandCompletion)
focal_class.class_method_signature: HealthCountsStream.getEmptyBucketSummary()
focal_class.full_signature: @Override long[] getEmptyBucketSummary()
focal_class.identifier: getEmptyBucketSummary
focal_class.modifiers: @Override
focal_class.parameters: ()
focal_class.return: long[]
focal_class.signature: long[] getEmptyBucketSummary()
focal_class.class_method_signature: HealthCountsStream.getEmptyOutputValue()
focal_class.full_signature: @Override HystrixCommandMetrics.HealthCounts getEmptyOutputValue()
focal_class.identifier: getEmptyOutputValue
focal_class.modifiers: @Override
focal_class.parameters: ()
focal_class.return: HystrixCommandMetrics.HealthCounts
focal_class.signature: HystrixCommandMetrics.HealthCounts getEmptyOutputValue()
focal_class.superclass: extends BucketedRollingCounterStream<HystrixCommandCompletion, long[], HystrixCommandMetrics.HealthCounts>
focal_method.body: public static HealthCountsStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties) {
          final int healthCountBucketSizeInMs = properties.metricsHealthSnapshotIntervalInMilliseconds().get();
          if (healthCountBucketSizeInMs == 0) {
              throw new RuntimeException("You have set the bucket size to 0ms.  Please set a positive number, so that the metric stream can be properly consumed");
          }
          final int numHealthCountBuckets = properties.metricsRollingStatisticalWindowInMilliseconds().get() / healthCountBucketSizeInMs;
  
          return getInstance(commandKey, numHealthCountBuckets, healthCountBucketSizeInMs);
      }
focal_method.class_method_signature: HealthCountsStream.getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties)
focal_method.full_signature: public static HealthCountsStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties)
focal_method.identifier: getInstance
focal_method.invocations: get metricsHealthSnapshotIntervalInMilliseconds get metricsRollingStatisticalWindowInMilliseconds getInstance
focal_method.modifiers: public static
focal_method.parameters: (HystrixCommandKey commandKey, HystrixCommandProperties properties)
focal_method.return: HealthCountsStream
focal_method.signature: HealthCountsStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties)