Prefix breaker/retry names where appropriate

This commit is contained in:
Jon Chambers
2025-08-27 14:34:17 -04:00
committed by Jon Chambers
parent 53f9c7b31f
commit f57093a94a
4 changed files with 9 additions and 5 deletions

View File

@@ -111,7 +111,7 @@ public class FaultTolerantHttpClient {
@Nullable private String circuitBreakerConfigurationName;
private Builder(final String name, final Executor executor) {
this.name = Objects.requireNonNull(name);
this.name = getClass().getSimpleName() + "/" + Objects.requireNonNull(name);
this.executor = Objects.requireNonNull(executor);
}

View File

@@ -40,8 +40,12 @@ public class FaultTolerantRedisClient {
RedisUriUtil.createRedisUriWithTimeout(redisConfiguration.getUri(), redisConfiguration.getTimeout()),
redisConfiguration.getTimeout(),
redisConfiguration.getCircuitBreakerConfigurationName() != null
? ResilienceUtil.getCircuitBreakerRegistry().circuitBreaker(name, redisConfiguration.getCircuitBreakerConfigurationName())
: ResilienceUtil.getCircuitBreakerRegistry().circuitBreaker(name));
? ResilienceUtil.getCircuitBreakerRegistry().circuitBreaker(getCircuitBreakerName(name), redisConfiguration.getCircuitBreakerConfigurationName())
: ResilienceUtil.getCircuitBreakerRegistry().circuitBreaker(getCircuitBreakerName(name)));
}
private static String getCircuitBreakerName(final String name) {
return FaultTolerantRedisClient.class.getSimpleName() + "/" + name;
}
@VisibleForTesting

View File

@@ -99,7 +99,7 @@ public class LettuceShardCircuitBreaker implements NettyCustomizer {
// In some cases, like the default connection, the remote address includes the DNS hostname, which we want to exclude.
shardAddress = StringUtils.substringAfter(remoteAddress.toString(), "/");
final String circuitBreakerName = "%s/%s".formatted(clusterName, shardAddress);
final String circuitBreakerName = "%s-%s/%s".formatted(LettuceShardCircuitBreaker.class.getSimpleName(), clusterName, shardAddress);
final Map<String, String> tags = Map.of(
CLUSTER_TAG_NAME, clusterName,
SHARD_ADDRESS_TAG_NAME, shardAddress);

View File

@@ -57,6 +57,6 @@ public class ResilienceUtil {
/// @param name The name of this `Retry`. Calls to this method with the same name will return the same `Retry`
/// instance, and the name is used to identify metrics tied to the returned `Retry` instance.
public static Retry getGeneralRedisRetry(final String name) {
return RETRY_REGISTRY.retry(name, GENERAL_REDIS_CONFIGURATION_NAME);
return RETRY_REGISTRY.retry("redis/" + name, GENERAL_REDIS_CONFIGURATION_NAME);
}
}