@Override public Number getValue() { return properties.metricsRollingStatisticalWindowInMilliseconds().get(); } });
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); }
public static RollingCommandMaxConcurrencyStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(commandKey, numCounterBuckets, counterBucketSizeInMs); }
public static CumulativeCommandEventCounterStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(commandKey, numCounterBuckets, counterBucketSizeInMs); }
public static RollingCommandEventCounterStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(commandKey, numCounterBuckets, counterBucketSizeInMs); }
@Test public void testIntegerBuilderOverride() { HystrixCommandProperties properties = new TestPropertiesCommand(TestKey.TEST, new HystrixCommandProperties.Setter().withMetricsRollingStatisticalWindowInMilliseconds(5000), "unitTestPrefix"); // the builder override should take precedence over the default assertEquals(5000, properties.metricsRollingStatisticalWindowInMilliseconds().get().intValue()); }
@Test public void testIntegerCodeDefault() { HystrixCommandProperties properties = new TestPropertiesCommand(TestKey.TEST, new HystrixCommandProperties.Setter(), "unitTestPrefix"); assertEquals(HystrixCommandProperties.default_metricsRollingStatisticalWindow, properties.metricsRollingStatisticalWindowInMilliseconds().get()); }
@Test public void testIntegerGlobalDynamicOverrideOfCodeDefault() throws Exception { HystrixCommandProperties properties = new TestPropertiesCommand(TestKey.TEST, new HystrixCommandProperties.Setter(), "unitTestPrefix"); ConfigurationManager.getConfigInstance().setProperty("unitTestPrefix.command.default.metrics.rollingStats.timeInMilliseconds", 1234); // the global dynamic property should take precedence over the default assertEquals(1234, properties.metricsRollingStatisticalWindowInMilliseconds().get().intValue()); // cleanup ConfigurationManager.getConfigInstance().clearProperty("unitTestPrefix.command.default.metrics.rollingStats.timeInMilliseconds"); }
@Test public void testIntegerInstanceBuilderOverrideOfGlobalDynamicOverride() throws Exception { HystrixCommandProperties properties = new TestPropertiesCommand(TestKey.TEST, new HystrixCommandProperties.Setter().withMetricsRollingStatisticalWindowInMilliseconds(5000), "unitTestPrefix"); ConfigurationManager.getConfigInstance().setProperty("unitTestPrefix.command.default.rollingStats.timeInMilliseconds", 3456); // the builder injected should take precedence over the global dynamic property assertEquals(5000, properties.metricsRollingStatisticalWindowInMilliseconds().get().intValue()); // cleanup ConfigurationManager.getConfigInstance().clearProperty("unitTestPrefix.command.default.rollingStats.timeInMilliseconds"); }
@Test public void testIntegerInstanceDynamicOverrideOfEverything() throws Exception { HystrixCommandProperties properties = new TestPropertiesCommand(TestKey.TEST, new HystrixCommandProperties.Setter().withMetricsRollingStatisticalWindowInMilliseconds(5000), "unitTestPrefix"); ConfigurationManager.getConfigInstance().setProperty("unitTestPrefix.command.default.metrics.rollingStats.timeInMilliseconds", 1234); ConfigurationManager.getConfigInstance().setProperty("unitTestPrefix.command.TEST.metrics.rollingStats.timeInMilliseconds", 3456); // the instance specific dynamic property should take precedence over everything assertEquals(3456, properties.metricsRollingStatisticalWindowInMilliseconds().get().intValue()); // cleanup ConfigurationManager.getConfigInstance().clearProperty("unitTestPrefix.command.default.metrics.rollingStats.timeInMilliseconds"); ConfigurationManager.getConfigInstance().clearProperty("unitTestPrefix.command.TEST.metrics.rollingStats.timeInMilliseconds"); }
assertEquals(6, command.getProperties().metricsRollingPercentileBucketSize().get().intValue()); assertEquals(10, command.getProperties().metricsRollingStatisticalWindowBuckets().get().intValue()); assertEquals(500, command.getProperties().metricsRollingStatisticalWindowInMilliseconds().get().intValue()); assertEquals(312, command.getProperties().metricsHealthSnapshotIntervalInMilliseconds().get().intValue()); assertEquals(false, command.getProperties().requestCacheEnabled().get().booleanValue());
commandProperties.metricsRollingPercentileWindowInMilliseconds().get(), commandProperties.metricsRollingStatisticalWindowBuckets().get(), commandProperties.metricsRollingStatisticalWindowInMilliseconds().get() );
@Override public Number call() { return properties.metricsRollingStatisticalWindowInMilliseconds().get(); } });
@Override public Number getValue() { return properties.metricsRollingStatisticalWindowInMilliseconds().get(); } });
@Override public Number value() { return properties.metricsRollingStatisticalWindowInMilliseconds().get(); } });
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); }
@Override public String call() { List<TpsAndLatencyData> tpsAndLatencyData = HystrixCommandMetrics.getInstances().stream().map(instance -> new TpsAndLatencyData(instance.getRollingCount(HystrixEventType.SUCCESS), instance.getRollingCount(HystrixEventType.FAILURE) , instance.getExecutionTimeMean(), instance.getProperties().metricsRollingStatisticalWindowInMilliseconds().get())) .collect(Collectors.toList()); return calculateTpsAndLatency(tpsAndLatencyData); } };
public static RollingCommandEventCounterStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(commandKey, numCounterBuckets, counterBucketSizeInMs); }
public static RollingCommandMaxConcurrencyStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(commandKey, numCounterBuckets, counterBucketSizeInMs); }
public static CumulativeCommandEventCounterStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(commandKey, numCounterBuckets, counterBucketSizeInMs); }