From c8be5c57fe6da25132dc5fe745b1a8888b7e2417 Mon Sep 17 00:00:00 2001 From: Alex Shtin Date: Thu, 19 Mar 2020 22:13:45 -0700 Subject: [PATCH] Make metric names prometheus compatible. (#71) --- internal/client.go | 13 ++- internal/common/metrics/constants.go | 128 +++++++++++++-------------- 2 files changed, 70 insertions(+), 71 deletions(-) diff --git a/internal/client.go b/internal/client.go index d8ccd2fd7..b4abe636c 100644 --- a/internal/client.go +++ b/internal/client.go @@ -321,16 +321,15 @@ type ( // default: default DomainName string - // Optional: Metrics to be reported. Metrics emitted by the temporal client are not prometheus compatible by - // default. To ensure metrics are compatible with prometheus make sure to create tally scope with sanitizer - // options set. + // Optional: Metrics to be reported. + // To ensure metrics are compatible with prometheus make sure to create tally scope with sanitizer options set. // var ( // _safeCharacters = []rune{'_'} // _sanitizeOptions = tally.SanitizeOptions{ - // NameCharacters: tally.ValidCharacters{ - // Ranges: tally.AlphanumericRange, - // Characters: _safeCharacters, - // }, + // NameCharacters: tally.ValidCharacters{ + // Ranges: tally.AlphanumericRange, + // Characters: _safeCharacters, + // }, // KeyCharacters: tally.ValidCharacters{ // Ranges: tally.AlphanumericRange, // Characters: _safeCharacters, diff --git a/internal/common/metrics/constants.go b/internal/common/metrics/constants.go index 2e4abcec1..3436293f9 100644 --- a/internal/common/metrics/constants.go +++ b/internal/common/metrics/constants.go @@ -22,78 +22,78 @@ package metrics // Workflow Creation metrics const ( - TemporalMetricsPrefix = "temporal-" - WorkflowStartCounter = TemporalMetricsPrefix + "workflow-start" - WorkflowCompletedCounter = TemporalMetricsPrefix + "workflow-completed" - WorkflowCanceledCounter = TemporalMetricsPrefix + "workflow-canceled" - WorkflowFailedCounter = TemporalMetricsPrefix + "workflow-failed" - WorkflowContinueAsNewCounter = TemporalMetricsPrefix + "workflow-continue-as-new" - WorkflowEndToEndLatency = TemporalMetricsPrefix + "workflow-endtoend-latency" // measure workflow execution from start to close - WorkflowGetHistoryCounter = TemporalMetricsPrefix + "workflow-get-history-total" - WorkflowGetHistoryFailedCounter = TemporalMetricsPrefix + "workflow-get-history-failed" - WorkflowGetHistorySucceedCounter = TemporalMetricsPrefix + "workflow-get-history-succeed" - WorkflowGetHistoryLatency = TemporalMetricsPrefix + "workflow-get-history-latency" - WorkflowSignalWithStartCounter = TemporalMetricsPrefix + "workflow-signal-with-start" - DecisionTimeoutCounter = TemporalMetricsPrefix + "decision-timeout" + TemporalMetricsPrefix = "temporal_" + WorkflowStartCounter = TemporalMetricsPrefix + "workflow_start" + WorkflowCompletedCounter = TemporalMetricsPrefix + "workflow_completed" + WorkflowCanceledCounter = TemporalMetricsPrefix + "workflow_canceled" + WorkflowFailedCounter = TemporalMetricsPrefix + "workflow_failed" + WorkflowContinueAsNewCounter = TemporalMetricsPrefix + "workflow_continue_as_new" + WorkflowEndToEndLatency = TemporalMetricsPrefix + "workflow_endtoend_latency" // measure workflow execution from start to close + WorkflowGetHistoryCounter = TemporalMetricsPrefix + "workflow_get_history_total" + WorkflowGetHistoryFailedCounter = TemporalMetricsPrefix + "workflow_get_history_failed" + WorkflowGetHistorySucceedCounter = TemporalMetricsPrefix + "workflow_get_history_succeed" + WorkflowGetHistoryLatency = TemporalMetricsPrefix + "workflow_get_history_latency" + WorkflowSignalWithStartCounter = TemporalMetricsPrefix + "workflow_signal_with_start" + DecisionTimeoutCounter = TemporalMetricsPrefix + "decision_timeout" - DecisionPollCounter = TemporalMetricsPrefix + "decision-poll-total" - DecisionPollFailedCounter = TemporalMetricsPrefix + "decision-poll-failed" - DecisionPollTransientFailedCounter = TemporalMetricsPrefix + "decision-poll-transient-failed" - DecisionPollNoTaskCounter = TemporalMetricsPrefix + "decision-poll-no-task" - DecisionPollSucceedCounter = TemporalMetricsPrefix + "decision-poll-succeed" - DecisionPollLatency = TemporalMetricsPrefix + "decision-poll-latency" // measure succeed poll request latency - DecisionScheduledToStartLatency = TemporalMetricsPrefix + "decision-scheduled-to-start-latency" - DecisionExecutionFailedCounter = TemporalMetricsPrefix + "decision-execution-failed" - DecisionExecutionLatency = TemporalMetricsPrefix + "decision-execution-latency" - DecisionResponseFailedCounter = TemporalMetricsPrefix + "decision-response-failed" - DecisionResponseLatency = TemporalMetricsPrefix + "decision-response-latency" - DecisionTaskPanicCounter = TemporalMetricsPrefix + "decision-task-panic" - DecisionTaskCompletedCounter = TemporalMetricsPrefix + "decision-task-completed" - DecisionTaskForceCompleted = TemporalMetricsPrefix + "decision-task-force-completed" + DecisionPollCounter = TemporalMetricsPrefix + "decision_poll_total" + DecisionPollFailedCounter = TemporalMetricsPrefix + "decision_poll_failed" + DecisionPollTransientFailedCounter = TemporalMetricsPrefix + "decision_poll_transient_failed" + DecisionPollNoTaskCounter = TemporalMetricsPrefix + "decision_poll_no_task" + DecisionPollSucceedCounter = TemporalMetricsPrefix + "decision_poll_succeed" + DecisionPollLatency = TemporalMetricsPrefix + "decision_poll_latency" // measure succeed poll request latency + DecisionScheduledToStartLatency = TemporalMetricsPrefix + "decision_scheduled_to_start_latency" + DecisionExecutionFailedCounter = TemporalMetricsPrefix + "decision_execution_failed" + DecisionExecutionLatency = TemporalMetricsPrefix + "decision_execution_latency" + DecisionResponseFailedCounter = TemporalMetricsPrefix + "decision_response_failed" + DecisionResponseLatency = TemporalMetricsPrefix + "decision_response_latency" + DecisionTaskPanicCounter = TemporalMetricsPrefix + "decision_task_panic" + DecisionTaskCompletedCounter = TemporalMetricsPrefix + "decision_task_completed" + DecisionTaskForceCompleted = TemporalMetricsPrefix + "decision_task_force_completed" - ActivityPollCounter = TemporalMetricsPrefix + "activity-poll-total" - ActivityPollFailedCounter = TemporalMetricsPrefix + "activity-poll-failed" - ActivityPollTransientFailedCounter = TemporalMetricsPrefix + "activity-poll-transient-failed" - ActivityPollNoTaskCounter = TemporalMetricsPrefix + "activity-poll-no-task" - ActivityPollSucceedCounter = TemporalMetricsPrefix + "activity-poll-succeed" - ActivityPollLatency = TemporalMetricsPrefix + "activity-poll-latency" - ActivityScheduledToStartLatency = TemporalMetricsPrefix + "activity-scheduled-to-start-latency" - ActivityExecutionFailedCounter = TemporalMetricsPrefix + "activity-execution-failed" - ActivityExecutionLatency = TemporalMetricsPrefix + "activity-execution-latency" - ActivityResponseLatency = TemporalMetricsPrefix + "activity-response-latency" - ActivityResponseFailedCounter = TemporalMetricsPrefix + "activity-response-failed" - ActivityEndToEndLatency = TemporalMetricsPrefix + "activity-endtoend-latency" - ActivityTaskPanicCounter = TemporalMetricsPrefix + "activity-task-panic" - ActivityTaskCompletedCounter = TemporalMetricsPrefix + "activity-task-completed" - ActivityTaskFailedCounter = TemporalMetricsPrefix + "activity-task-failed" - ActivityTaskCanceledCounter = TemporalMetricsPrefix + "activity-task-canceled" - ActivityTaskCompletedByIDCounter = TemporalMetricsPrefix + "activity-task-completed-by-id" - ActivityTaskFailedByIDCounter = TemporalMetricsPrefix + "activity-task-failed-by-id" - ActivityTaskCanceledByIDCounter = TemporalMetricsPrefix + "activity-task-canceled-by-id" - LocalActivityTotalCounter = TemporalMetricsPrefix + "local-activity-total" - LocalActivityTimeoutCounter = TemporalMetricsPrefix + "local-activity-timeout" - LocalActivityCanceledCounter = TemporalMetricsPrefix + "local-activity-canceled" - LocalActivityFailedCounter = TemporalMetricsPrefix + "local-activity-failed" - LocalActivityPanicCounter = TemporalMetricsPrefix + "local-activity-panic" - LocalActivityExecutionLatency = TemporalMetricsPrefix + "local-activity-execution-latency" - WorkerPanicCounter = TemporalMetricsPrefix + "worker-panic" + ActivityPollCounter = TemporalMetricsPrefix + "activity_poll_total" + ActivityPollFailedCounter = TemporalMetricsPrefix + "activity_poll_failed" + ActivityPollTransientFailedCounter = TemporalMetricsPrefix + "activity_poll_transient_failed" + ActivityPollNoTaskCounter = TemporalMetricsPrefix + "activity_poll_no_task" + ActivityPollSucceedCounter = TemporalMetricsPrefix + "activity_poll_succeed" + ActivityPollLatency = TemporalMetricsPrefix + "activity_poll_latency" + ActivityScheduledToStartLatency = TemporalMetricsPrefix + "activity_scheduled_to_start_latency" + ActivityExecutionFailedCounter = TemporalMetricsPrefix + "activity_execution_failed" + ActivityExecutionLatency = TemporalMetricsPrefix + "activity_execution_latency" + ActivityResponseLatency = TemporalMetricsPrefix + "activity_response_latency" + ActivityResponseFailedCounter = TemporalMetricsPrefix + "activity_response_failed" + ActivityEndToEndLatency = TemporalMetricsPrefix + "activity_endtoend_latency" + ActivityTaskPanicCounter = TemporalMetricsPrefix + "activity_task_panic" + ActivityTaskCompletedCounter = TemporalMetricsPrefix + "activity_task_completed" + ActivityTaskFailedCounter = TemporalMetricsPrefix + "activity_task_failed" + ActivityTaskCanceledCounter = TemporalMetricsPrefix + "activity_task_canceled" + ActivityTaskCompletedByIDCounter = TemporalMetricsPrefix + "activity_task_completed_by_id" + ActivityTaskFailedByIDCounter = TemporalMetricsPrefix + "activity_task_failed_by_id" + ActivityTaskCanceledByIDCounter = TemporalMetricsPrefix + "activity_task_canceled_by_id" + LocalActivityTotalCounter = TemporalMetricsPrefix + "local_activity_total" + LocalActivityTimeoutCounter = TemporalMetricsPrefix + "local_activity_timeout" + LocalActivityCanceledCounter = TemporalMetricsPrefix + "local_activity_canceled" + LocalActivityFailedCounter = TemporalMetricsPrefix + "local_activity_failed" + LocalActivityPanicCounter = TemporalMetricsPrefix + "local_activity_panic" + LocalActivityExecutionLatency = TemporalMetricsPrefix + "local_activity_execution_latency" + WorkerPanicCounter = TemporalMetricsPrefix + "worker_panic" - UnhandledSignalsCounter = TemporalMetricsPrefix + "unhandled-signals" - CorruptedSignalsCounter = TemporalMetricsPrefix + "corrupted-signals" + UnhandledSignalsCounter = TemporalMetricsPrefix + "unhandled_signals" + CorruptedSignalsCounter = TemporalMetricsPrefix + "corrupted_signals" - WorkerStartCounter = TemporalMetricsPrefix + "worker-start" - PollerStartCounter = TemporalMetricsPrefix + "poller-start" + WorkerStartCounter = TemporalMetricsPrefix + "worker_start" + PollerStartCounter = TemporalMetricsPrefix + "poller_start" TemporalRequest = TemporalMetricsPrefix + "request" TemporalError = TemporalMetricsPrefix + "error" TemporalLatency = TemporalMetricsPrefix + "latency" - TemporalInvalidRequest = TemporalMetricsPrefix + "invalid-request" + TemporalInvalidRequest = TemporalMetricsPrefix + "invalid_request" - StickyCacheHit = TemporalMetricsPrefix + "sticky-cache-hit" - StickyCacheMiss = TemporalMetricsPrefix + "sticky-cache-miss" - StickyCacheEvict = TemporalMetricsPrefix + "sticky-cache-evict" - StickyCacheStall = TemporalMetricsPrefix + "sticky-cache-stall" - StickyCacheSize = TemporalMetricsPrefix + "sticky-cache-size" + StickyCacheHit = TemporalMetricsPrefix + "sticky_cache_hit" + StickyCacheMiss = TemporalMetricsPrefix + "sticky_cache_miss" + StickyCacheEvict = TemporalMetricsPrefix + "sticky_cache_evict" + StickyCacheStall = TemporalMetricsPrefix + "sticky_cache_stall" + StickyCacheSize = TemporalMetricsPrefix + "sticky_cache_size" - NonDeterministicError = TemporalMetricsPrefix + "non-deterministic-error" + NonDeterministicError = TemporalMetricsPrefix + "non_deterministic_error" )