Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/temporal/activity/task_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def process
start_time = Time.now

Temporal.logger.debug("Processing Activity task", metadata.to_h)
Temporal.metrics.timing('activity_task.queue_time', queue_time_ms, activity: activity_name)
Temporal.metrics.timing('activity_task.queue_time', queue_time_ms, activity: activity_name, namespace: namespace)

context = Activity::Context.new(connection, metadata)

Expand All @@ -46,7 +46,7 @@ def process
respond_failed(error)
ensure
time_diff_ms = ((Time.now - start_time) * 1000).round
Temporal.metrics.timing('activity_task.latency', time_diff_ms, activity: activity_name)
Temporal.metrics.timing('activity_task.latency', time_diff_ms, activity: activity_name, namespace: namespace)
Temporal.logger.debug("Activity task processed", metadata.to_h.merge(execution_time: time_diff_ms))
end

Expand Down
4 changes: 2 additions & 2 deletions lib/temporal/workflow/task_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def process
start_time = Time.now

Temporal.logger.debug("Processing Workflow task", metadata.to_h)
Temporal.metrics.timing('workflow_task.queue_time', queue_time_ms, workflow: workflow_name)
Temporal.metrics.timing('workflow_task.queue_time', queue_time_ms, workflow: workflow_name, namespace: namespace)

if !workflow_class
raise Temporal::WorkflowNotRegistered, 'Workflow is not registered with this worker'
Expand All @@ -45,7 +45,7 @@ def process
fail_task(error)
ensure
time_diff_ms = ((Time.now - start_time) * 1000).round
Temporal.metrics.timing('workflow_task.latency', time_diff_ms, workflow: workflow_name)
Temporal.metrics.timing('workflow_task.latency', time_diff_ms, workflow: workflow_name, namespace: namespace)
Temporal.logger.debug("Workflow task processed", metadata.to_h.merge(execution_time: time_diff_ms))
end

Expand Down
8 changes: 4 additions & 4 deletions spec/unit/lib/temporal/activity/task_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@

expect(Temporal.metrics)
.to have_received(:timing)
.with('activity_task.queue_time', an_instance_of(Integer), activity: activity_name)
.with('activity_task.queue_time', an_instance_of(Integer), activity: activity_name, namespace: namespace)
end

it 'sends latency metric' do
subject.process

expect(Temporal.metrics)
.to have_received(:timing)
.with('activity_task.latency', an_instance_of(Integer), activity: activity_name)
.with('activity_task.latency', an_instance_of(Integer), activity: activity_name, namespace: namespace)
end

context 'with async activity' do
Expand Down Expand Up @@ -203,15 +203,15 @@

expect(Temporal.metrics)
.to have_received(:timing)
.with('activity_task.queue_time', an_instance_of(Integer), activity: activity_name)
.with('activity_task.queue_time', an_instance_of(Integer), activity: activity_name, namespace: namespace)
end

it 'sends latency metric' do
subject.process

expect(Temporal.metrics)
.to have_received(:timing)
.with('activity_task.latency', an_instance_of(Integer), activity: activity_name)
.with('activity_task.latency', an_instance_of(Integer), activity: activity_name, namespace: namespace)
end

context 'with ScriptError exception' do
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/lib/temporal/workflow/task_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@

expect(Temporal.metrics)
.to have_received(:timing)
.with('workflow_task.queue_time', an_instance_of(Integer), workflow: workflow_name)
.with('workflow_task.queue_time', an_instance_of(Integer), workflow: workflow_name, namespace: namespace)
end

it 'sends latency metric' do
subject.process

expect(Temporal.metrics)
.to have_received(:timing)
.with('workflow_task.latency', an_instance_of(Integer), workflow: workflow_name)
.with('workflow_task.latency', an_instance_of(Integer), workflow: workflow_name, namespace: namespace)
end
end

Expand Down Expand Up @@ -170,15 +170,15 @@

expect(Temporal.metrics)
.to have_received(:timing)
.with('workflow_task.queue_time', an_instance_of(Integer), workflow: workflow_name)
.with('workflow_task.queue_time', an_instance_of(Integer), workflow: workflow_name, namespace: namespace)
end

it 'sends latency metric' do
subject.process

expect(Temporal.metrics)
.to have_received(:timing)
.with('workflow_task.latency', an_instance_of(Integer), workflow: workflow_name)
.with('workflow_task.latency', an_instance_of(Integer), workflow: workflow_name, namespace: namespace)
end
end

Expand Down