Prefix breaker/retry names where appropriate

This commit is contained in:
Jon Chambers authored and Jon Chambers committed 2025-08-27 14:45:29 -04:00
1 parent 53f9c7b31f
commit 21c948920a
4 files changed
+9 -5

No files matched your search

@@ -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);
}
@@ -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
@@ -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);
@@ -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);
}
}