@@ -262,34 +262,125 @@ impl MetricsContext {
262262impl Instruments {
263263 fn new ( meter : & dyn CoreMeter ) -> Self {
264264 Self {
265- wf_completed_counter : meter. counter ( "workflow_completed" . into ( ) ) ,
266- wf_canceled_counter : meter. counter ( "workflow_canceled" . into ( ) ) ,
267- wf_failed_counter : meter. counter ( "workflow_failed" . into ( ) ) ,
268- wf_cont_counter : meter. counter ( "workflow_continue_as_new" . into ( ) ) ,
269- wf_e2e_latency : meter. histogram ( WF_E2E_LATENCY_NAME . into ( ) ) ,
270- wf_task_queue_poll_empty_counter : meter
271- . counter ( "workflow_task_queue_poll_empty" . into ( ) ) ,
272- wf_task_queue_poll_succeed_counter : meter
273- . counter ( "workflow_task_queue_poll_succeed" . into ( ) ) ,
274- wf_task_execution_failure_counter : meter
275- . counter ( "workflow_task_execution_failed" . into ( ) ) ,
276- wf_task_sched_to_start_latency : meter
277- . histogram ( WF_TASK_SCHED_TO_START_LATENCY_NAME . into ( ) ) ,
278- wf_task_replay_latency : meter. histogram ( WF_TASK_REPLAY_LATENCY_NAME . into ( ) ) ,
279- wf_task_execution_latency : meter. histogram ( WF_TASK_EXECUTION_LATENCY_NAME . into ( ) ) ,
280- act_poll_no_task : meter. counter ( "activity_poll_no_task" . into ( ) ) ,
281- act_task_received_counter : meter. counter ( "activity_task_received" . into ( ) ) ,
282- act_execution_failed : meter. counter ( "activity_execution_failed" . into ( ) ) ,
283- act_sched_to_start_latency : meter. histogram ( ACT_SCHED_TO_START_LATENCY_NAME . into ( ) ) ,
284- act_exec_latency : meter. histogram ( ACT_EXEC_LATENCY_NAME . into ( ) ) ,
265+ wf_completed_counter : meter. counter ( MetricParameters {
266+ name : "workflow_completed" . into ( ) ,
267+ description : "Count of successfully completed workflows" . into ( ) ,
268+ unit : "" . into ( ) ,
269+ } ) ,
270+ wf_canceled_counter : meter. counter ( MetricParameters {
271+ name : "workflow_canceled" . into ( ) ,
272+ description : "Count of canceled workflows" . into ( ) ,
273+ unit : "" . into ( ) ,
274+ } ) ,
275+ wf_failed_counter : meter. counter ( MetricParameters {
276+ name : "workflow_failed" . into ( ) ,
277+ description : "Count of failed workflows" . into ( ) ,
278+ unit : "" . into ( ) ,
279+ } ) ,
280+ wf_cont_counter : meter. counter ( MetricParameters {
281+ name : "workflow_continue_as_new" . into ( ) ,
282+ description : "Count of continued-as-new workflows" . into ( ) ,
283+ unit : "" . into ( ) ,
284+ } ) ,
285+ wf_e2e_latency : meter. histogram ( MetricParameters {
286+ name : WF_E2E_LATENCY_NAME . into ( ) ,
287+ unit : "ms" . into ( ) ,
288+ description : "Histogram of total workflow execution latencies" . into ( ) ,
289+ } ) ,
290+ wf_task_queue_poll_empty_counter : meter. counter ( MetricParameters {
291+ name : "workflow_task_queue_poll_empty" . into ( ) ,
292+ description : "Count of workflow task queue poll timeouts (no new task)" . into ( ) ,
293+ unit : "" . into ( ) ,
294+ } ) ,
295+ wf_task_queue_poll_succeed_counter : meter. counter ( MetricParameters {
296+ name : "workflow_task_queue_poll_succeed" . into ( ) ,
297+ description : "Count of workflow task queue poll successes" . into ( ) ,
298+ unit : "" . into ( ) ,
299+ } ) ,
300+ wf_task_execution_failure_counter : meter. counter ( MetricParameters {
301+ name : "workflow_task_execution_failed" . into ( ) ,
302+ description : "Count of workflow task execution failures" . into ( ) ,
303+ unit : "" . into ( ) ,
304+ } ) ,
305+ wf_task_sched_to_start_latency : meter. histogram ( MetricParameters {
306+ name : WF_TASK_SCHED_TO_START_LATENCY_NAME . into ( ) ,
307+ unit : "ms" . into ( ) ,
308+ description : "Histogram of workflow task schedule-to-start latencies" . into ( ) ,
309+ } ) ,
310+ wf_task_replay_latency : meter. histogram ( MetricParameters {
311+ name : WF_TASK_REPLAY_LATENCY_NAME . into ( ) ,
312+ unit : "ms" . into ( ) ,
313+ description : "Histogram of workflow task replay latencies" . into ( ) ,
314+ } ) ,
315+ wf_task_execution_latency : meter. histogram ( MetricParameters {
316+ name : WF_TASK_EXECUTION_LATENCY_NAME . into ( ) ,
317+ unit : "ms" . into ( ) ,
318+ description : "Histogram of workflow task execution (not replay) latencies" . into ( ) ,
319+ } ) ,
320+ act_poll_no_task : meter. counter ( MetricParameters {
321+ name : "activity_poll_no_task" . into ( ) ,
322+ description : "Count of activity task queue poll timeouts (no new task)" . into ( ) ,
323+ unit : "" . into ( ) ,
324+ } ) ,
325+ act_task_received_counter : meter. counter ( MetricParameters {
326+ name : "activity_task_received" . into ( ) ,
327+ description : "Count of activity task queue poll successes" . into ( ) ,
328+ unit : "" . into ( ) ,
329+ } ) ,
330+ act_execution_failed : meter. counter ( MetricParameters {
331+ name : "activity_execution_failed" . into ( ) ,
332+ description : "Count of activity task execution failures" . into ( ) ,
333+ unit : "" . into ( ) ,
334+ } ) ,
335+ act_sched_to_start_latency : meter. histogram ( MetricParameters {
336+ name : ACT_SCHED_TO_START_LATENCY_NAME . into ( ) ,
337+ unit : "ms" . into ( ) ,
338+ description : "Histogram of activity schedule-to-start latencies" . into ( ) ,
339+ } ) ,
340+ act_exec_latency : meter. histogram ( MetricParameters {
341+ name : ACT_EXEC_LATENCY_NAME . into ( ) ,
342+ unit : "ms" . into ( ) ,
343+ description : "Histogram of activity execution latencies" . into ( ) ,
344+ } ) ,
285345 // name kept as worker start for compat with old sdk / what users expect
286- worker_registered : meter. counter ( "worker_start" . into ( ) ) ,
287- num_pollers : meter. gauge ( NUM_POLLERS_NAME . into ( ) ) ,
288- task_slots_available : meter. gauge ( TASK_SLOTS_AVAILABLE_NAME . into ( ) ) ,
289- sticky_cache_hit : meter. counter ( "sticky_cache_hit" . into ( ) ) ,
290- sticky_cache_miss : meter. counter ( "sticky_cache_miss" . into ( ) ) ,
291- sticky_cache_size : meter. gauge ( STICKY_CACHE_SIZE_NAME . into ( ) ) ,
292- sticky_cache_evictions : meter. counter ( "sticky_cache_total_forced_eviction" . into ( ) ) ,
346+ worker_registered : meter. counter ( MetricParameters {
347+ name : "worker_start" . into ( ) ,
348+ description : "Count of the number of initialized workers" . into ( ) ,
349+ unit : "" . into ( ) ,
350+ } ) ,
351+ num_pollers : meter. gauge ( MetricParameters {
352+ name : NUM_POLLERS_NAME . into ( ) ,
353+ description : "Current number of active pollers per queue type" . into ( ) ,
354+ unit : "" . into ( ) ,
355+ } ) ,
356+ task_slots_available : meter. gauge ( MetricParameters {
357+ name : TASK_SLOTS_AVAILABLE_NAME . into ( ) ,
358+ description : "Current number of available slots per task type" . into ( ) ,
359+ unit : "" . into ( ) ,
360+ } ) ,
361+ sticky_cache_hit : meter. counter ( MetricParameters {
362+ name : "sticky_cache_hit" . into ( ) ,
363+ description : "Count of times the workflow cache was used for a new workflow task"
364+ . into ( ) ,
365+ unit : "" . into ( ) ,
366+ } ) ,
367+ sticky_cache_miss : meter. counter ( MetricParameters {
368+ name : "sticky_cache_miss" . into ( ) ,
369+ description :
370+ "Count of times the workflow cache was missing a workflow for a sticky task"
371+ . into ( ) ,
372+ unit : "" . into ( ) ,
373+ } ) ,
374+ sticky_cache_size : meter. gauge ( MetricParameters {
375+ name : STICKY_CACHE_SIZE_NAME . into ( ) ,
376+ description : "Current number of cached workflows" . into ( ) ,
377+ unit : "" . into ( ) ,
378+ } ) ,
379+ sticky_cache_evictions : meter. counter ( MetricParameters {
380+ name : "sticky_cache_total_forced_eviction" . into ( ) ,
381+ description : "Count of evictions of cached workflows" . into ( ) ,
382+ unit : "" . into ( ) ,
383+ } ) ,
293384 }
294385 }
295386}
@@ -529,7 +620,7 @@ pub struct StartedPromServer {
529620pub fn start_prometheus_metric_exporter (
530621 opts : PrometheusExporterOptions ,
531622) -> Result < StartedPromServer , anyhow:: Error > {
532- let ( srv, exporter) = PromServer :: new ( opts. socket_addr , SDKAggSelector :: default ( ) ) ?;
623+ let ( srv, exporter) = PromServer :: new ( & opts, SDKAggSelector :: default ( ) ) ?;
533624 let meter_provider = augment_meter_provider_with_defaults (
534625 MeterProvider :: builder ( ) . with_reader ( exporter) ,
535626 & opts. global_tags ,
0 commit comments