Skip to content

Commit 26d092d

Browse files
authored
Replace sticky tasklist metrics scope with the same value (#601)
* Replace sticky tasklist metrics scope with the same value
1 parent c45a8ec commit 26d092d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/main/java/com/uber/cadence/worker/WorkerFactory.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public static WorkerFactory newInstance(
7676
"attempted to %s while in %s state. Acceptable States: %s";
7777
private static final Logger log = LoggerFactory.getLogger(WorkerFactory.class);
7878
private static final String STICKY_TASK_LIST_PREFIX = "sticky";
79+
private static final String STICKY_TASK_LIST_METRIC_TAG = "__" + STICKY_TASK_LIST_PREFIX + "__";
7980
private static final String POLL_THREAD_NAME = "Sticky Task Poller";
8081

8182
/**
@@ -113,7 +114,7 @@ public WorkerFactory(WorkflowClient workflowClient, WorkerFactoryOptions factory
113114
MetricsTag.DOMAIN,
114115
workflowClient.getOptions().getDomain(),
115116
MetricsTag.TASK_LIST,
116-
getStickyTaskListName()));
117+
STICKY_TASK_LIST_METRIC_TAG));
117118

118119
this.cache = new DeciderCache(this.factoryOptions.getCacheMaximumSize(), stickyScope);
119120
dispatcher = new PollDecisionTaskDispatcher(workflowClient.getService());

src/test/java/com/uber/cadence/worker/StickyWorkerTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public class StickyWorkerTest {
7474

7575
private static final boolean useDockerService =
7676
Boolean.parseBoolean(System.getenv("USE_DOCKER_SERVICE"));
77+
private static final String STICKY_TASK_LIST_METRIC_TAG = "__sticky__";
7778

7879
@Parameterized.Parameter public boolean useExternalService;
7980

@@ -151,7 +152,7 @@ public void whenStickyIsEnabledThenTheWorkflowIsCachedSignals() throws Exception
151152
Map<String, String> tags =
152153
new ImmutableMap.Builder<String, String>(2)
153154
.put(MetricsTag.DOMAIN, DOMAIN)
154-
.put(MetricsTag.TASK_LIST, factory.getStickyTaskListName())
155+
.put(MetricsTag.TASK_LIST, STICKY_TASK_LIST_METRIC_TAG)
155156
.build();
156157
Thread.sleep(600);
157158
verify(reporter, atLeastOnce())
@@ -265,7 +266,7 @@ public void whenStickyIsEnabledThenTheWorkflowIsCachedActivities() throws Except
265266
Map<String, String> tags =
266267
new ImmutableMap.Builder<String, String>(2)
267268
.put(MetricsTag.DOMAIN, DOMAIN)
268-
.put(MetricsTag.TASK_LIST, factory.getStickyTaskListName())
269+
.put(MetricsTag.TASK_LIST, STICKY_TASK_LIST_METRIC_TAG)
269270
.build();
270271
verify(reporter, atLeastOnce())
271272
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyInt());
@@ -314,7 +315,7 @@ public void whenStickyIsEnabledThenTheWorkflowIsCachedChildWorkflows() throws Ex
314315
Map<String, String> tags =
315316
new ImmutableMap.Builder<String, String>(2)
316317
.put(MetricsTag.DOMAIN, DOMAIN)
317-
.put(MetricsTag.TASK_LIST, factory.getStickyTaskListName())
318+
.put(MetricsTag.TASK_LIST, STICKY_TASK_LIST_METRIC_TAG)
318319
.build();
319320
verify(reporter, atLeastOnce())
320321
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyInt());
@@ -370,7 +371,7 @@ public void whenStickyIsEnabledThenTheWorkflowIsCachedMutableSideEffect() throws
370371
Map<String, String> tags =
371372
new ImmutableMap.Builder<String, String>(2)
372373
.put(MetricsTag.DOMAIN, DOMAIN)
373-
.put(MetricsTag.TASK_LIST, factory.getStickyTaskListName())
374+
.put(MetricsTag.TASK_LIST, STICKY_TASK_LIST_METRIC_TAG)
374375
.build();
375376
verify(reporter, atLeastOnce())
376377
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyInt());

0 commit comments

Comments
 (0)