Skip to content

Commit 31d044c

Browse files
Make sure workflow_task_queue_poll_succeed is emitted (#2645)
1 parent 4ae92d3 commit 31d044c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

temporal-sdk/src/main/java/io/temporal/internal/worker/AsyncWorkflowPollTask.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ public CompletableFuture<WorkflowTask> poll(SlotPermit permit)
151151
.inc(1);
152152
return null;
153153
}
154+
pollerMetricScope
155+
.counter(MetricsType.WORKFLOW_TASK_QUEUE_POLL_SUCCEED_COUNTER)
156+
.inc(1);
154157
Timestamp startedTime = ProtobufTimeUtils.getCurrentProtoTime();
155158
pollerMetricScope
156159
.timer(MetricsType.WORKFLOW_TASK_SCHEDULE_TO_START_LATENCY)

temporal-sdk/src/test/java/io/temporal/workflow/MetricsTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ public void testWorkerMetrics() throws InterruptedException {
179179
reporter.assertCounter("temporal_worker_start", TAGS_WORKFLOW_WORKER, 1);
180180
reporter.assertCounter("temporal_worker_start", TAGS_ACTIVITY_WORKER, 1);
181181
reporter.assertCounter("temporal_worker_start", TAGS_LOCAL_ACTIVITY_WORKER, 1);
182+
reporter.assertCounter(
183+
"temporal_workflow_task_queue_poll_succeed", TAGS_STICKY_WORKFLOW_WORKER);
184+
reporter.assertCounter("temporal_workflow_task_queue_poll_succeed", TAGS_WORKFLOW_WORKER);
182185
// We ran some workflow and activity tasks, so we should have some timers here.
183186
reporter.assertTimer("temporal_activity_schedule_to_start_latency", TAGS_ACTIVITY_WORKER);
184187
reporter.assertTimer("temporal_workflow_task_schedule_to_start_latency", TAGS_WORKFLOW_WORKER);
@@ -221,6 +224,9 @@ public void testWorkerMetricsAutoPoller() throws InterruptedException {
221224
reporter.assertCounter("temporal_worker_start", TAGS_WORKFLOW_WORKER, 1);
222225
reporter.assertCounter("temporal_worker_start", TAGS_ACTIVITY_WORKER, 1);
223226
reporter.assertCounter("temporal_worker_start", TAGS_LOCAL_ACTIVITY_WORKER, 1);
227+
reporter.assertCounter(
228+
"temporal_workflow_task_queue_poll_succeed", TAGS_STICKY_WORKFLOW_WORKER);
229+
reporter.assertCounter("temporal_workflow_task_queue_poll_succeed", TAGS_WORKFLOW_WORKER);
224230
// We ran some workflow and activity tasks, so we should have some timers here.
225231
reporter.assertTimer("temporal_activity_schedule_to_start_latency", TAGS_ACTIVITY_WORKER);
226232
reporter.assertTimer("temporal_workflow_task_schedule_to_start_latency", TAGS_WORKFLOW_WORKER);

0 commit comments

Comments
 (0)