From 76e9ae0223ccad807fb07d2a0cb96690eb837356 Mon Sep 17 00:00:00 2001 From: Carter Kozak Date: Wed, 15 Apr 2020 10:58:40 -0400 Subject: [PATCH 1/2] Retrying executor ThreadFacotory instrumentation --- .../com/palantir/dialogue/core/RetryingChannel.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dialogue-core/src/main/java/com/palantir/dialogue/core/RetryingChannel.java b/dialogue-core/src/main/java/com/palantir/dialogue/core/RetryingChannel.java index d217f6aed..4eff82374 100644 --- a/dialogue-core/src/main/java/com/palantir/dialogue/core/RetryingChannel.java +++ b/dialogue-core/src/main/java/com/palantir/dialogue/core/RetryingChannel.java @@ -39,6 +39,7 @@ import com.palantir.tracing.Tracers; import com.palantir.tritium.metrics.MetricRegistries; import com.palantir.tritium.metrics.registry.DefaultTaggedMetricRegistry; +import com.palantir.tritium.metrics.registry.SharedTaggedMetricRegistries; import com.palantir.tritium.metrics.registry.TaggedMetricRegistry; import java.io.IOException; import java.net.SocketTimeoutException; @@ -67,11 +68,15 @@ final class RetryingChannel implements Channel { * edge case where services are already operating in a degraded state and we should not * spam servers. */ + @SuppressWarnings("deprecation") // Singleton registry for a singleton executor static final Supplier sharedScheduler = - Suppliers.memoize(() -> Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder() - .setNameFormat(SCHEDULER_NAME + "-%d") - .setDaemon(false) - .build())); + Suppliers.memoize(() -> Executors.newSingleThreadScheduledExecutor(MetricRegistries.instrument( + SharedTaggedMetricRegistries.getSingleton(), + new ThreadFactoryBuilder() + .setNameFormat(SCHEDULER_NAME + "-%d") + .setDaemon(false) + .build(), + SCHEDULER_NAME))); @SuppressWarnings("UnnecessaryLambda") // no allocations private static final BiFunction qosThrowable = (endpoint, response) -> From c2346ea39790138ac6642e7d49ea7b3fa48f3f10 Mon Sep 17 00:00:00 2001 From: Carter Kozak Date: Wed, 15 Apr 2020 14:58:40 +0000 Subject: [PATCH 2/2] Add generated changelog entries --- changelog/@unreleased/pr-652.v2.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/@unreleased/pr-652.v2.yml diff --git a/changelog/@unreleased/pr-652.v2.yml b/changelog/@unreleased/pr-652.v2.yml new file mode 100644 index 000000000..692c78804 --- /dev/null +++ b/changelog/@unreleased/pr-652.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Retrying executor ThreadFacotory instrumentation + links: + - https://github.com/palantir/dialogue/pull/652