private static HystrixCommandMetrics initMetrics(HystrixCommandMetrics fromConstructor, HystrixCommandGroupKey groupKey, HystrixThreadPoolKey threadPoolKey, HystrixCommandKey commandKey, HystrixCommandProperties properties) { if (fromConstructor == null) { return HystrixCommandMetrics.getInstance(commandKey, groupKey, threadPoolKey, properties); } else { return fromConstructor; } }
/** * Get or create the {@link HystrixCommandMetrics} instance for a given {@link HystrixCommandKey}. * <p> * This is thread-safe and ensures only 1 {@link HystrixCommandMetrics} per {@link HystrixCommandKey}. * * @param key * {@link HystrixCommandKey} of {@link HystrixCommand} instance requesting the {@link HystrixCommandMetrics} * @param commandGroup * Pass-thru to {@link HystrixCommandMetrics} instance on first time when constructed * @param properties * Pass-thru to {@link HystrixCommandMetrics} instance on first time when constructed * @return {@link HystrixCommandMetrics} */ public static HystrixCommandMetrics getInstance(HystrixCommandKey key, HystrixCommandGroupKey commandGroup, HystrixCommandProperties properties) { return getInstance(key, commandGroup, null, properties); }
/** * Utility method for creating {@link HystrixCommandMetrics} for unit tests. */ private static HystrixCommandMetrics getMetrics(HystrixCommandProperties.Setter properties) { return HystrixCommandMetrics.getInstance(CommandKeyForUnitTest.KEY_ONE, CommandOwnerForUnitTest.OWNER_ONE, ThreadPoolKeyForUnitTest.THREAD_POOL_ONE, HystrixCommandPropertiesTest.asMock(properties)); }
/** * Utility method for creating {@link HystrixCommandMetrics} for unit tests. */ private static HystrixCommandMetrics getMetrics(HystrixCommandKey commandKey, HystrixCommandProperties.Setter properties) { return HystrixCommandMetrics.getInstance(commandKey, CommandOwnerForUnitTest.OWNER_ONE, ThreadPoolKeyForUnitTest.THREAD_POOL_ONE, HystrixCommandPropertiesTest.asMock(properties)); }
public HystrixCommandMetrics getMetrics(String commandKey) { return HystrixCommandMetrics.getInstance(HystrixCommandKey.Factory.asKey(commandKey)); }
private static HystrixCommandMetrics initMetrics(HystrixCommandMetrics fromConstructor, HystrixCommandGroupKey groupKey, HystrixThreadPoolKey threadPoolKey, HystrixCommandKey commandKey, HystrixCommandProperties properties) { if (fromConstructor == null) { return HystrixCommandMetrics.getInstance(commandKey, groupKey, threadPoolKey, properties); } else { return fromConstructor; } }
public static HystrixCommandMetrics getCommandMetrics(TenacityPropertyKey key) { return HystrixCommandMetrics.getInstance(key); }
public static HystrixCommandMetrics getCommandMetrics(TenacityPropertyKey key) { return HystrixCommandMetrics.getInstance(key); }
public static HystrixCommandMetrics getCommandMetrics(TenacityPropertyKey key) { return HystrixCommandMetrics.getInstance(key); }
public static HystrixCommandMetrics getCommandMetrics(TenacityPropertyKey key) { return HystrixCommandMetrics.getInstance(key); }
/** * Get or create the {@link HystrixCommandMetrics} instance for a given {@link HystrixCommandKey}. * <p> * This is thread-safe and ensures only 1 {@link HystrixCommandMetrics} per {@link HystrixCommandKey}. * * @param key * {@link HystrixCommandKey} of {@link HystrixCommand} instance requesting the {@link HystrixCommandMetrics} * @param commandGroup * Pass-thru to {@link HystrixCommandMetrics} instance on first time when constructed * @param properties * Pass-thru to {@link HystrixCommandMetrics} instance on first time when constructed * @return {@link HystrixCommandMetrics} */ public static HystrixCommandMetrics getInstance(HystrixCommandKey key, HystrixCommandGroupKey commandGroup, HystrixCommandProperties properties) { return getInstance(key, commandGroup, null, properties); }
/** * @return */ private Optional<HystrixCommandMetrics> getCommandMetrics() { return Optional.ofNullable(HystrixCommandMetrics.getInstance(key)); }
public HystrixCommandMetrics getCommandMetrics() { return HystrixCommandMetrics.getInstance(getCommandKey()); }
public HystrixCommandMetrics getCommandMetrics() { return HystrixCommandMetrics.getInstance(getCommandKey()); }
public HystrixCommandMetrics getCommandMetrics() { return HystrixCommandMetrics.getInstance(getCommandKey()); }
public HystrixCommandMetrics getCommandMetrics() { return HystrixCommandMetrics.getInstance(getCommandKey()); }
private void printMetrics() { HystrixCommandMetrics metrics = HystrixCommandMetrics. getInstance(HystrixCommandKey.Factory.asKey(this.getClass().getSimpleName())); StringBuilder m = new StringBuilder(); if (metrics != null) { HystrixCommandMetrics.HealthCounts health = metrics.getHealthCounts(); m.append("Requests: ").append(health.getTotalRequests()).append(" "); m.append("Errors: ").append(health.getErrorCount()).append(" ("). append(health.getErrorPercentage()).append("%) "); m.append("Mean: ").append(metrics.getExecutionTimePercentile(50)).append(" "); m.append("75th: ").append(metrics.getExecutionTimePercentile(75)).append(" "); m.append("90th: ").append(metrics.getExecutionTimePercentile(90)).append(" "); m.append("99th: ").append(metrics.getExecutionTimePercentile(99)).append(" "); } System.out.println(m); } }
public CircutBreakerEvent(HystrixCommandKey commandKey, Type type) { super(type); HystrixCommandMetrics hystrixCommandMetrics = HystrixCommandMetrics.getInstance(commandKey); if (hystrixCommandMetrics != null) { if (hystrixCommandMetrics.getCommandGroup() instanceof CustomizeCommandGroupKey) { CustomizeCommandGroupKey customCommandGroupKey = (CustomizeCommandGroupKey) hystrixCommandMetrics.getCommandGroup(); this.microservice = customCommandGroupKey.getInstance().getMicroserviceName(); this.role = customCommandGroupKey.getInstance().getInvocationType().name(); this.schema = customCommandGroupKey.getInstance().getSchemaId(); this.operation = customCommandGroupKey.getInstance().getOperationName(); } this.currentTotalRequest = hystrixCommandMetrics.getHealthCounts().getTotalRequests(); this.currentErrorPercentage = hystrixCommandMetrics.getHealthCounts().getErrorCount(); this.currentErrorCount = hystrixCommandMetrics.getHealthCounts().getErrorPercentage(); this.requestVolumeThreshold = hystrixCommandMetrics.getProperties().circuitBreakerRequestVolumeThreshold().get(); this.sleepWindowInMilliseconds = hystrixCommandMetrics.getProperties().circuitBreakerSleepWindowInMilliseconds().get(); this.errorThresholdPercentage = hystrixCommandMetrics.getProperties().circuitBreakerErrorThresholdPercentage().get(); } }
public KumuluzHystrixGenericCommand(HystrixCommandConfiguration configuration, InvocationContext invocationContext, RequestContext requestContext, ExecutionMetadata metadata) { super(configuration.getGroupKey(), configuration.getCommandKey(), configuration.getThreadPoolKey(), SuccessThresholdCircuitBreaker.CustomCbFactory.getInstance(configuration.getCommandKey(), configuration.getGroupKey(), HystrixPropertiesFactory.getCommandProperties(configuration.getCommandKey(), null), HystrixCommandMetrics.getInstance(configuration.getCommandKey(), configuration.getGroupKey(), configuration.getThreadPoolKey(), HystrixPropertiesFactory.getCommandProperties(configuration.getCommandKey(), null)), metadata, metadata.getCbMetricsCollection(invocationContext.getMethod().getName()).orElse(null)), null, null, null, null, null, null, null, null); this.invocationContext = invocationContext; this.requestContext = requestContext; this.metadata = metadata; this.bulkheadMetricsCollection = metadata.getBulkheadMetricsCollection(invocationContext.getMethod().getName()) .orElse(null); }
public CircutBreakerEvent(HystrixCommandKey commandKey, Type type) { super(type); HystrixCommandMetrics hystrixCommandMetrics = HystrixCommandMetrics.getInstance(commandKey); if (hystrixCommandMetrics != null) { if (hystrixCommandMetrics.getCommandGroup() instanceof CustomizeCommandGroupKey) { CustomizeCommandGroupKey customCommandGroupKey = (CustomizeCommandGroupKey) hystrixCommandMetrics.getCommandGroup(); this.microservice = customCommandGroupKey.getInstance().getMicroserviceName(); this.role = customCommandGroupKey.getInstance().getInvocationType().name(); this.schema = customCommandGroupKey.getInstance().getSchemaId(); this.operation = customCommandGroupKey.getInstance().getOperationName(); } this.currentTotalRequest = hystrixCommandMetrics.getHealthCounts().getTotalRequests(); this.currentErrorPercentage = hystrixCommandMetrics.getHealthCounts().getErrorCount(); this.currentErrorCount = hystrixCommandMetrics.getHealthCounts().getErrorPercentage(); this.requestVolumeThreshold = hystrixCommandMetrics.getProperties().circuitBreakerRequestVolumeThreshold().get(); this.sleepWindowInMilliseconds = hystrixCommandMetrics.getProperties().circuitBreakerSleepWindowInMilliseconds().get(); this.errorThresholdPercentage = hystrixCommandMetrics.getProperties().circuitBreakerErrorThresholdPercentage().get(); } }