go.temporal.io/server@v1.23.0/common/metrics/metric_defs.go (about)

     1  // The MIT License
     2  
     3  //
     4  // Copyright (c) 2020 Temporal Technologies Inc.  All rights reserved.
     5  //
     6  // Copyright (c) 2020 Uber Technologies, Inc.
     7  //
     8  // Permission is hereby granted, free of charge, to any person obtaining a copy
     9  // of this software and associated documentation files (the "Software"), to deal
    10  // in the Software without restriction, including without limitation the rights
    11  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    12  // copies of the Software, and to permit persons to whom the Software is
    13  // furnished to do so, subject to the following conditions:
    14  //
    15  // The above copyright notice and this permission notice shall be included in
    16  // all copies or substantial portions of the Software.
    17  //
    18  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    19  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    20  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    21  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    22  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    23  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    24  // THE SOFTWARE.
    25  
    26  package metrics
    27  
    28  // Common tags for all services
    29  const (
    30  	OperationTagName            = "operation"
    31  	ServiceRoleTagName          = "service_role"
    32  	CacheTypeTagName            = "cache_type"
    33  	FailureTagName              = "failure"
    34  	TaskCategoryTagName         = "task_category"
    35  	TaskTypeTagName             = "task_type"
    36  	TaskPriorityTagName         = "task_priority"
    37  	QueueReaderIDTagName        = "queue_reader_id"
    38  	QueueActionTagName          = "queue_action"
    39  	QueueTypeTagName            = "queue_type"
    40  	visibilityPluginNameTagName = "visibility_plugin_name"
    41  	ErrorTypeTagName            = "error_type"
    42  	httpStatusTagName           = "http_status"
    43  	versionedTagName            = "versioned"
    44  	resourceExhaustedTag        = "resource_exhausted_cause"
    45  )
    46  
    47  // This package should hold all the metrics and tags for temporal
    48  const (
    49  	HistoryRoleTagValue       = "history"
    50  	MatchingRoleTagValue      = "matching"
    51  	FrontendRoleTagValue      = "frontend"
    52  	AdminRoleTagValue         = "admin"
    53  	DCRedirectionRoleTagValue = "dc_redirection"
    54  	BlobstoreRoleTagValue     = "blobstore"
    55  
    56  	MutableStateCacheTypeTagValue = "mutablestate"
    57  	EventsCacheTypeTagValue       = "events"
    58  
    59  	InvalidHistoryURITagValue    = "invalid_history_uri"
    60  	InvalidVisibilityURITagValue = "invalid_visibility_uri"
    61  )
    62  
    63  // Common service base metrics
    64  const (
    65  	RestartCount         = "restarts"
    66  	NumGoRoutinesGauge   = "num_goroutines"
    67  	GoMaxProcsGauge      = "gomaxprocs"
    68  	MemoryAllocatedGauge = "memory_allocated"
    69  	MemoryHeapGauge      = "memory_heap"
    70  	MemoryHeapIdleGauge  = "memory_heapidle"
    71  	MemoryHeapInuseGauge = "memory_heapinuse"
    72  	MemoryStackGauge     = "memory_stack"
    73  	NumGCCounter         = "memory_num_gc"
    74  	GcPauseMsTimer       = "memory_gc_pause_ms"
    75  )
    76  
    77  // Admin Client Operations
    78  const (
    79  	// AdminClientStreamWorkflowReplicationMessagesScope tracks RPC calls to admin service
    80  	AdminClientStreamWorkflowReplicationMessagesScope = "AdminClientStreamWorkflowReplicationMessages"
    81  )
    82  
    83  // History Client Operations
    84  const (
    85  	// HistoryClientStreamWorkflowReplicationMessagesScope tracks RPC calls to history service
    86  	HistoryClientStreamWorkflowReplicationMessagesScope = "HistoryClientStreamWorkflowReplicationMessages"
    87  )
    88  
    89  // Matching Client Operations
    90  const (
    91  	// MatchingClientPollWorkflowTaskQueueScope tracks RPC calls to matching service
    92  	MatchingClientPollWorkflowTaskQueueScope = "MatchingClientPollWorkflowTaskQueue"
    93  	// MatchingClientPollActivityTaskQueueScope tracks RPC calls to matching service
    94  	MatchingClientPollActivityTaskQueueScope = "MatchingClientPollActivityTaskQueue"
    95  	// MatchingClientAddActivityTaskScope tracks RPC calls to matching service
    96  	MatchingClientAddActivityTaskScope = "MatchingClientAddActivityTask"
    97  	// MatchingClientAddWorkflowTaskScope tracks RPC calls to matching service
    98  	MatchingClientAddWorkflowTaskScope = "MatchingClientAddWorkflowTask"
    99  	// MatchingClientQueryWorkflowScope tracks RPC calls to matching service
   100  	MatchingClientQueryWorkflowScope = "MatchingClientQueryWorkflow"
   101  )
   102  
   103  // Worker
   104  const (
   105  	// TaskQueueScavengerScope is scope used by all metrics emitted by worker.taskqueue.Scavenger module
   106  	TaskQueueScavengerScope = "TaskQueueScavenger"
   107  	// ExecutionsScavengerScope is scope used by all metrics emitted by worker.executions.Scavenger module
   108  	ExecutionsScavengerScope = "ExecutionsScavenger"
   109  )
   110  
   111  const (
   112  	// PersistenceAppendHistoryNodesScope tracks AppendHistoryNodes calls made by service to persistence layer
   113  	PersistenceAppendHistoryNodesScope = "AppendHistoryNodes"
   114  	// PersistenceAppendRawHistoryNodesScope tracks AppendRawHistoryNodes calls made by service to persistence layer
   115  	PersistenceAppendRawHistoryNodesScope = "AppendRawHistoryNodes"
   116  	// PersistenceReadHistoryBranchScope tracks ReadHistoryBranch calls made by service to persistence layer
   117  	PersistenceReadHistoryBranchScope = "ReadHistoryBranch"
   118  	// PersistenceReadHistoryBranchReverseScope tracks ReadHistoryBranchReverse calls made by service to persistence layer
   119  	PersistenceReadHistoryBranchReverseScope = "ReadHistoryBranchReverse"
   120  	// PersistenceReadRawHistoryBranchScope tracks ReadRawHistoryBranch calls made by service to persistence layer
   121  	PersistenceReadRawHistoryBranchScope = "ReadRawHistoryBranch"
   122  	// PersistenceForkHistoryBranchScope tracks ForkHistoryBranch calls made by service to persistence layer
   123  	PersistenceForkHistoryBranchScope = "ForkHistoryBranch"
   124  	// PersistenceDeleteHistoryBranchScope tracks DeleteHistoryBranch calls made by service to persistence layer
   125  	PersistenceDeleteHistoryBranchScope = "DeleteHistoryBranch"
   126  	// PersistenceTrimHistoryBranchScope tracks TrimHistoryBranch calls made by service to persistence layer
   127  	PersistenceTrimHistoryBranchScope = "TrimHistoryBranch"
   128  	// PersistenceGetHistoryTreeScope tracks GetHistoryTree calls made by service to persistence layer
   129  	PersistenceGetHistoryTreeScope = "GetHistoryTree"
   130  	// PersistenceGetAllHistoryTreeBranchesScope tracks GetHistoryTree calls made by service to persistence layer
   131  	PersistenceGetAllHistoryTreeBranchesScope = "GetAllHistoryTreeBranches"
   132  	// PersistenceNamespaceReplicationQueueScope is the metrics scope for namespace replication queue
   133  	PersistenceNamespaceReplicationQueueScope = "NamespaceReplicationQueue"
   134  	// PersistenceEnqueueMessageScope tracks Enqueue calls made by service to persistence layer
   135  	PersistenceEnqueueMessageScope = "EnqueueMessage"
   136  	// PersistenceEnqueueMessageToDLQScope tracks Enqueue DLQ calls made by service to persistence layer
   137  	PersistenceEnqueueMessageToDLQScope = "EnqueueMessageToDLQ"
   138  	// PersistenceReadQueueMessagesScope tracks ReadMessages calls made by service to persistence layer
   139  	PersistenceReadQueueMessagesScope = "ReadQueueMessages"
   140  	// PersistenceReadMessagesFromDLQScope tracks ReadMessagesFromDLQ calls made by service to persistence layer
   141  	PersistenceReadMessagesFromDLQScope = "ReadMessagesFromDLQ"
   142  	// PersistenceDeleteMessagesBeforeScope tracks DeleteMessagesBefore calls made by service to persistence layer
   143  	PersistenceDeleteMessagesBeforeScope = "DeleteMessagesBefore"
   144  	// PersistenceDeleteMessageFromDLQScope tracks DeleteMessageFromDLQ calls made by service to persistence layer
   145  	PersistenceDeleteMessageFromDLQScope = "DeleteMessageFromDLQ"
   146  	// PersistenceRangeDeleteMessagesFromDLQScope tracks RangeDeleteMessagesFromDLQ calls made by service to persistence layer
   147  	PersistenceRangeDeleteMessagesFromDLQScope = "RangeDeleteMessagesFromDLQ"
   148  	// PersistenceUpdateAckLevelScope tracks UpdateAckLevel calls made by service to persistence layer
   149  	PersistenceUpdateAckLevelScope = "UpdateAckLevel"
   150  	// PersistenceGetAckLevelScope tracks GetAckLevel calls made by service to persistence layer
   151  	PersistenceGetAckLevelScope = "GetAckLevel"
   152  	// PersistenceUpdateDLQAckLevelScope tracks UpdateDLQAckLevel calls made by service to persistence layer
   153  	PersistenceUpdateDLQAckLevelScope = "UpdateDLQAckLevel"
   154  	// PersistenceGetDLQAckLevelScope tracks GetDLQAckLevel calls made by service to persistence layer
   155  	PersistenceGetDLQAckLevelScope = "GetDLQAckLevel"
   156  	// PersistenceListClusterMetadataScope tracks ListClusterMetadata calls made by service to persistence layer
   157  	PersistenceListClusterMetadataScope = "ListClusterMetadata"
   158  	// PersistenceGetClusterMetadataScope tracks GetClusterMetadata calls made by service to persistence layer
   159  	PersistenceGetClusterMetadataScope = "GetClusterMetadata"
   160  	// PersistenceGetCurrentClusterMetadataScope tracks GetCurrentClusterMetadata calls made by service to persistence layer
   161  	PersistenceGetCurrentClusterMetadataScope = "GetCurrentClusterMetadata"
   162  	// PersistenceSaveClusterMetadataScope tracks SaveClusterMetadata calls made by service to persistence layer
   163  	PersistenceSaveClusterMetadataScope = "SaveClusterMetadata"
   164  	// PersistenceDeleteClusterMetadataScope tracks DeleteClusterMetadata calls made by service to persistence layer
   165  	PersistenceDeleteClusterMetadataScope = "DeleteClusterMetadata"
   166  	// PersistenceUpsertClusterMembershipScope tracks UpsertClusterMembership calls made by service to persistence layer
   167  	PersistenceUpsertClusterMembershipScope = "UpsertClusterMembership"
   168  	// PersistencePruneClusterMembershipScope tracks PruneClusterMembership calls made by service to persistence layer
   169  	PersistencePruneClusterMembershipScope = "PruneClusterMembership"
   170  	// PersistenceGetClusterMembersScope tracks GetClusterMembers calls made by service to persistence layer
   171  	PersistenceGetClusterMembersScope = "GetClusterMembers"
   172  	// PersistenceGetOrCreateShardScope tracks GetOrCreateShard calls made by service to persistence layer
   173  	PersistenceGetOrCreateShardScope = "GetOrCreateShard"
   174  	// PersistenceUpdateShardScope tracks UpdateShard calls made by service to persistence layer
   175  	PersistenceUpdateShardScope = "UpdateShard"
   176  	// PersistenceAssertShardOwnershipScope tracks UpdateShard calls made by service to persistence layer
   177  	PersistenceAssertShardOwnershipScope = "AssertShardOwnership"
   178  	// PersistenceCreateWorkflowExecutionScope tracks CreateWorkflowExecution calls made by service to persistence layer
   179  	PersistenceCreateWorkflowExecutionScope = "CreateWorkflowExecution"
   180  	// PersistenceGetWorkflowExecutionScope tracks GetWorkflowExecution calls made by service to persistence layer
   181  	PersistenceGetWorkflowExecutionScope = "GetWorkflowExecution"
   182  	// PersistenceSetWorkflowExecutionScope tracks SetWorkflowExecution calls made by service to persistence layer
   183  	PersistenceSetWorkflowExecutionScope = "SetWorkflowExecution"
   184  	// PersistenceUpdateWorkflowExecutionScope tracks UpdateWorkflowExecution calls made by service to persistence layer
   185  	PersistenceUpdateWorkflowExecutionScope = "UpdateWorkflowExecution"
   186  	// PersistenceConflictResolveWorkflowExecutionScope tracks ConflictResolveWorkflowExecution calls made by service to persistence layer
   187  	PersistenceConflictResolveWorkflowExecutionScope = "ConflictResolveWorkflowExecution"
   188  	// PersistenceDeleteWorkflowExecutionScope tracks DeleteWorkflowExecution calls made by service to persistence layer
   189  	PersistenceDeleteWorkflowExecutionScope = "DeleteWorkflowExecution"
   190  	// PersistenceDeleteCurrentWorkflowExecutionScope tracks DeleteCurrentWorkflowExecution calls made by service to persistence layer
   191  	PersistenceDeleteCurrentWorkflowExecutionScope = "DeleteCurrentWorkflowExecution"
   192  	// PersistenceGetCurrentExecutionScope tracks GetCurrentExecution calls made by service to persistence layer
   193  	PersistenceGetCurrentExecutionScope = "GetCurrentExecution"
   194  	// PersistenceListConcreteExecutionsScope tracks ListConcreteExecutions calls made by service to persistence layer
   195  	PersistenceListConcreteExecutionsScope = "ListConcreteExecutions"
   196  	// PersistenceAddTasksScope tracks AddTasks calls made by service to persistence layer
   197  	PersistenceAddTasksScope = "AddTasks"
   198  	// PersistenceGetTransferTasksScope tracks GetTransferTasks calls made by service to persistence layer
   199  	PersistenceGetTransferTasksScope = "GetTransferTasks"
   200  	// PersistenceCompleteTransferTaskScope tracks CompleteTransferTasks calls made by service to persistence layer
   201  	PersistenceCompleteTransferTaskScope = "CompleteTransferTask"
   202  	// PersistenceRangeCompleteTransferTasksScope tracks CompleteTransferTasks calls made by service to persistence layer
   203  	PersistenceRangeCompleteTransferTasksScope = "RangeCompleteTransferTasks"
   204  	// PersistenceGetVisibilityTasksScope tracks GetVisibilityTasks calls made by service to persistence layer
   205  	PersistenceGetVisibilityTasksScope = "GetVisibilityTasks"
   206  	// PersistenceCompleteVisibilityTaskScope tracks CompleteVisibilityTasks calls made by service to persistence layer
   207  	PersistenceCompleteVisibilityTaskScope = "CompleteVisibilityTask"
   208  	// PersistenceRangeCompleteVisibilityTasksScope tracks CompleteVisibilityTasks calls made by service to persistence layer
   209  	PersistenceRangeCompleteVisibilityTasksScope = "RangeCompleteVisibilityTasks"
   210  	// PersistenceGetReplicationTaskScope tracks GetReplicationTask calls made by service to persistence layer
   211  	PersistenceGetArchivalTasksScope = "GetArchivalTasks"
   212  	// PersistenceCompleteArchivalTaskScope tracks CompleteArchivalTasks calls made by service to persistence layer
   213  	PersistenceCompleteArchivalTaskScope = "CompleteArchivalTask"
   214  	// PersistenceRangeCompleteArchivalTasksScope tracks CompleteArchivalTasks calls made by service to persistence layer
   215  	PersistenceRangeCompleteArchivalTasksScope = "RangeCompleteArchivalTasks"
   216  	// PersistenceGetReplicationTasksScope tracks GetReplicationTasks calls made by service to persistence layer
   217  	PersistenceGetReplicationTasksScope = "GetReplicationTasks"
   218  	// PersistenceCompleteReplicationTaskScope tracks CompleteReplicationTasks calls made by service to persistence layer
   219  	PersistenceCompleteReplicationTaskScope = "CompleteReplicationTask"
   220  	// PersistenceRangeCompleteReplicationTasksScope tracks RangeCompleteReplicationTasks calls made by service to persistence layer
   221  	PersistenceRangeCompleteReplicationTasksScope = "RangeCompleteReplicationTasks"
   222  	// PersistencePutReplicationTaskToDLQScope tracks PersistencePutReplicationTaskToDLQScope calls made by service to persistence layer
   223  	PersistencePutReplicationTaskToDLQScope = "PutReplicationTaskToDLQ"
   224  	// PersistenceGetReplicationTasksFromDLQScope tracks PersistenceGetReplicationTasksFromDLQScope calls made by service to persistence layer
   225  	PersistenceGetReplicationTasksFromDLQScope = "GetReplicationTasksFromDLQ"
   226  	// PersistenceDeleteReplicationTaskFromDLQScope tracks PersistenceDeleteReplicationTaskFromDLQScope calls made by service to persistence layer
   227  	PersistenceDeleteReplicationTaskFromDLQScope = "DeleteReplicationTaskFromDLQ"
   228  	// PersistenceRangeDeleteReplicationTaskFromDLQScope tracks PersistenceRangeDeleteReplicationTaskFromDLQScope calls made by service to persistence layer
   229  	PersistenceRangeDeleteReplicationTaskFromDLQScope = "RangeDeleteReplicationTaskFromDLQ"
   230  	// PersistenceGetTimerTasksScope tracks GetTimerTasks calls made by service to persistence layer
   231  	PersistenceGetTimerTasksScope = "GetTimerTasks"
   232  	// PersistenceCompleteTimerTaskScope tracks CompleteTimerTasks calls made by service to persistence layer
   233  	PersistenceCompleteTimerTaskScope = "CompleteTimerTask"
   234  	// PersistenceRangeCompleteTimerTasksScope tracks CompleteTimerTasks calls made by service to persistence layer
   235  	PersistenceRangeCompleteTimerTasksScope = "RangeCompleteTimerTasks"
   236  	// PersistenceCreateTasksScope tracks CreateTasks calls made by service to persistence layer
   237  	PersistenceCreateTasksScope = "CreateTasks"
   238  	// PersistenceGetTasksScope tracks GetTasks calls made by service to persistence layer
   239  	PersistenceGetTasksScope = "GetTasks"
   240  	// PersistenceCompleteTaskScope tracks CompleteTask calls made by service to persistence layer
   241  	PersistenceCompleteTaskScope = "CompleteTask"
   242  	// PersistenceCompleteTasksLessThanScope is the metric scope for persistence.TaskManager.PersistenceCompleteTasksLessThan API
   243  	PersistenceCompleteTasksLessThanScope = "CompleteTasksLessThan"
   244  	// PersistenceCreateTaskQueueScope tracks PersistenceCreateTaskQueueScope calls made by service to persistence layer
   245  	PersistenceCreateTaskQueueScope = "CreateTaskQueue"
   246  	// PersistenceUpdateTaskQueueScope tracks PersistenceUpdateTaskQueueScope calls made by service to persistence layer
   247  	PersistenceUpdateTaskQueueScope = "UpdateTaskQueue"
   248  	// PersistenceGetTaskQueueScope tracks PersistenceGetTaskQueueScope calls made by service to persistence layer
   249  	PersistenceGetTaskQueueScope = "GetTaskQueue"
   250  	// PersistenceListTaskQueueScope is the metric scope for persistence.TaskManager.ListTaskQueue API
   251  	PersistenceListTaskQueueScope = "ListTaskQueue"
   252  	// PersistenceDeleteTaskQueueScope is the metric scope for persistence.TaskManager.DeleteTaskQueue API
   253  	PersistenceDeleteTaskQueueScope = "DeleteTaskQueue"
   254  	// PersistenceGetTaskQueueUserDataScope is the metric scope for persistence.TaskManager.GetTaskQueueUserData API
   255  	PersistenceGetTaskQueueUserDataScope = "GetTaskQueueUserData"
   256  	// PersistenceUpdateTaskQueueUserDataScope is the metric scope for persistence.TaskManager.UpdateTaskQueueUserData API
   257  	PersistenceUpdateTaskQueueUserDataScope = "UpdateTaskQueueUserData"
   258  	// PersistenceListTaskQueueUserDataEntriesScope is the metric scope for persistence.TaskManager.ListTaskQueueUserDataEntries API
   259  	PersistenceListTaskQueueUserDataEntriesScope = "ListTaskQueueUserDataEntries"
   260  	// PersistenceGetTaskQueuesByBuildIdScope is the metric scope for persistence.TaskManager.GetTaskQueuesByBuildId API
   261  	PersistenceGetTaskQueuesByBuildIdScope = "GetTaskQueuesByBuildId"
   262  	// PersistenceCountTaskQueuesByBuildIdScope is the metric scope for persistence.TaskManager.CountTaskQueuesByBuildId API
   263  	PersistenceCountTaskQueuesByBuildIdScope = "CountTaskQueuesByBuildId"
   264  	// PersistenceInitializeSystemNamespaceScope tracks InitializeSystemNamespaceScope calls made by service to persistence layer
   265  	PersistenceInitializeSystemNamespaceScope = "InitializeSystemNamespace"
   266  	// PersistenceCreateNamespaceScope tracks CreateNamespace calls made by service to persistence layer
   267  	PersistenceCreateNamespaceScope = "CreateNamespace"
   268  	// PersistenceGetNamespaceScope tracks GetNamespace calls made by service to persistence layer
   269  	PersistenceGetNamespaceScope = "GetNamespace"
   270  	// PersistenceUpdateNamespaceScope tracks UpdateNamespace calls made by service to persistence layer
   271  	PersistenceUpdateNamespaceScope = "UpdateNamespace"
   272  	// PersistenceDeleteNamespaceScope tracks DeleteNamespace calls made by service to persistence layer
   273  	PersistenceDeleteNamespaceScope = "DeleteNamespace"
   274  	// PersistenceRenameNamespaceScope tracks RenameNamespace calls made by service to persistence layer
   275  	PersistenceRenameNamespaceScope = "RenameNamespace"
   276  	// PersistenceDeleteNamespaceByNameScope tracks DeleteNamespaceByName calls made by service to persistence layer
   277  	PersistenceDeleteNamespaceByNameScope = "DeleteNamespaceByName"
   278  	// PersistenceListNamespacesScope tracks ListNamespaces calls made by service to persistence layer
   279  	PersistenceListNamespacesScope = "ListNamespaces"
   280  	// PersistenceGetMetadataScope tracks DeleteNamespaceByName calls made by service to persistence layer
   281  	PersistenceGetMetadataScope = "GetMetadata"
   282  
   283  	// VisibilityPersistenceRecordWorkflowExecutionStartedScope tracks RecordWorkflowExecutionStarted calls made by service to visibility persistence layer
   284  	VisibilityPersistenceRecordWorkflowExecutionStartedScope = "RecordWorkflowExecutionStarted"
   285  	// VisibilityPersistenceRecordWorkflowExecutionClosedScope tracks RecordWorkflowExecutionClosed calls made by service to visibility persistence layer
   286  	VisibilityPersistenceRecordWorkflowExecutionClosedScope = "RecordWorkflowExecutionClosed"
   287  	// VisibilityPersistenceUpsertWorkflowExecutionScope tracks UpsertWorkflowExecution calls made by service to persistence visibility layer
   288  	VisibilityPersistenceUpsertWorkflowExecutionScope = "UpsertWorkflowExecution"
   289  	// VisibilityPersistenceListOpenWorkflowExecutionsScope tracks ListOpenWorkflowExecutions calls made by service to visibility persistence layer
   290  	VisibilityPersistenceListOpenWorkflowExecutionsScope = "ListOpenWorkflowExecutions"
   291  	// VisibilityPersistenceListClosedWorkflowExecutionsScope tracks ListClosedWorkflowExecutions calls made by service to visibility persistence layer
   292  	VisibilityPersistenceListClosedWorkflowExecutionsScope = "ListClosedWorkflowExecutions"
   293  	// VisibilityPersistenceListOpenWorkflowExecutionsByTypeScope tracks ListOpenWorkflowExecutionsByType calls made by service to visibility persistence layer
   294  	VisibilityPersistenceListOpenWorkflowExecutionsByTypeScope = "ListOpenWorkflowExecutionsByType"
   295  	// VisibilityPersistenceListClosedWorkflowExecutionsByTypeScope tracks ListClosedWorkflowExecutionsByType calls made by service to visibility persistence layer
   296  	VisibilityPersistenceListClosedWorkflowExecutionsByTypeScope = "ListClosedWorkflowExecutionsByType"
   297  	// VisibilityPersistenceListOpenWorkflowExecutionsByWorkflowIDScope tracks ListOpenWorkflowExecutionsByWorkflowID calls made by service to visibility persistence layer
   298  	VisibilityPersistenceListOpenWorkflowExecutionsByWorkflowIDScope = "ListOpenWorkflowExecutionsByWorkflowID"
   299  	// VisibilityPersistenceListClosedWorkflowExecutionsByWorkflowIDScope tracks ListClosedWorkflowExecutionsByWorkflowID calls made by service to visibility persistence layer
   300  	VisibilityPersistenceListClosedWorkflowExecutionsByWorkflowIDScope = "ListClosedWorkflowExecutionsByWorkflowID"
   301  	// VisibilityPersistenceListClosedWorkflowExecutionsByStatusScope tracks ListClosedWorkflowExecutionsByStatus calls made by service to visibility persistence layer
   302  	VisibilityPersistenceListClosedWorkflowExecutionsByStatusScope = "ListClosedWorkflowExecutionsByStatus"
   303  	// VisibilityPersistenceDeleteWorkflowExecutionScope tracks DeleteWorkflowExecutions calls made by service to visibility persistence layer
   304  	VisibilityPersistenceDeleteWorkflowExecutionScope = "DeleteWorkflowExecution"
   305  	// VisibilityPersistenceListWorkflowExecutionsScope tracks ListWorkflowExecutions calls made by service to visibility persistence layer
   306  	VisibilityPersistenceListWorkflowExecutionsScope = "ListWorkflowExecutions"
   307  	// VisibilityPersistenceScanWorkflowExecutionsScope tracks ScanWorkflowExecutions calls made by service to visibility persistence layer
   308  	VisibilityPersistenceScanWorkflowExecutionsScope = "ScanWorkflowExecutions"
   309  	// VisibilityPersistenceCountWorkflowExecutionsScope tracks CountWorkflowExecutions calls made by service to visibility persistence layer
   310  	VisibilityPersistenceCountWorkflowExecutionsScope = "CountWorkflowExecutions"
   311  	// VisibilityPersistenceGetWorkflowExecutionScope tracks GetWorkflowExecution calls made by service to visibility persistence layer
   312  	VisibilityPersistenceGetWorkflowExecutionScope = "GetWorkflowExecution"
   313  )
   314  
   315  // Common
   316  const (
   317  	ServerTlsScope = "ServerTls"
   318  	// AuthorizationScope is the scope used by all metric emitted by authorization code
   319  	AuthorizationScope = "Authorization"
   320  	// NamespaceCacheScope tracks namespace cache callbacks
   321  	NamespaceCacheScope = "NamespaceCache"
   322  )
   323  
   324  // Frontend Scope
   325  const (
   326  	// AdminGetWorkflowExecutionRawHistoryV2Scope is the metric scope for admin.GetWorkflowExecutionRawHistoryScope
   327  	AdminGetWorkflowExecutionRawHistoryV2Scope = "AdminGetWorkflowExecutionRawHistoryV2"
   328  
   329  	// OperatorAddSearchAttributesScope is the metric scope for operator.AddSearchAttributes
   330  	OperatorAddSearchAttributesScope = "OperatorAddSearchAttributes"
   331  	// OperatorDeleteNamespaceScope is the metric scope for operator.OperatorDeleteNamespace
   332  	OperatorDeleteNamespaceScope = "OperatorDeleteNamespace"
   333  
   334  	// FrontendGetWorkflowExecutionHistoryScope is the metric scope for non-long-poll frontend.GetWorkflowExecutionHistory
   335  	FrontendGetWorkflowExecutionHistoryScope = "GetWorkflowExecutionHistory"
   336  	// FrontendPollWorkflowExecutionHistoryScope is the metric scope for long poll case of frontend.GetWorkflowExecutionHistory
   337  	FrontendPollWorkflowExecutionHistoryScope = "PollWorkflowExecutionHistory"
   338  
   339  	// VersionCheckScope is scope used by version checker
   340  	VersionCheckScope = "VersionCheck"
   341  )
   342  
   343  // History Scope
   344  const (
   345  	// HistoryStartWorkflowExecutionScope tracks StartWorkflowExecution API calls received by service
   346  	HistoryStartWorkflowExecutionScope = "StartWorkflowExecution"
   347  	// HistoryRecordActivityTaskHeartbeatScope tracks RecordActivityTaskHeartbeat API calls received by service
   348  	HistoryRecordActivityTaskHeartbeatScope = "RecordActivityTaskHeartbeat"
   349  	// HistoryRespondWorkflowTaskCompletedScope tracks RespondWorkflowTaskCompleted API calls received by service
   350  	HistoryRespondWorkflowTaskCompletedScope = "RespondWorkflowTaskCompleted"
   351  	// HistoryRespondActivityTaskCompletedScope tracks RespondActivityTaskCompleted API calls received by service
   352  	HistoryRespondActivityTaskCompletedScope = "RespondActivityTaskCompleted"
   353  	// HistoryRespondActivityTaskFailedScope tracks RespondActivityTaskFailed API calls received by service
   354  	HistoryRespondActivityTaskFailedScope = "RespondActivityTaskFailed"
   355  	// HistoryRespondActivityTaskCanceledScope tracks RespondActivityTaskCanceled API calls received by service
   356  	HistoryRespondActivityTaskCanceledScope = "RespondActivityTaskCanceled"
   357  	// HistoryGetWorkflowExecutionRawHistoryV2Scope tracks GetWorkflowExecutionRawHistoryV2Scope API calls received by service
   358  	HistoryGetWorkflowExecutionRawHistoryV2Scope = "GetWorkflowExecutionRawHistoryV2"
   359  	// HistoryGetHistoryScope tracks GetHistoryScope API calls received by service
   360  	HistoryGetHistoryScope = "GetHistory"
   361  	// HistoryGetRawHistoryScope tracks GetRawHistoryScope API calls received by service
   362  	HistoryGetRawHistoryScope = "GetRawHistory"
   363  	// HistoryGetHistoryReverseScope tracks GetHistoryReverseScope API calls received by service
   364  	HistoryGetHistoryReverseScope = "GetHistoryReverse"
   365  	// HistoryRecordWorkflowTaskStartedScope tracks RecordWorkflowTaskStarted API calls received by service
   366  	HistoryRecordWorkflowTaskStartedScope = "RecordWorkflowTaskStarted"
   367  	// HistoryRecordActivityTaskStartedScope tracks RecordActivityTaskStarted API calls received by service
   368  	HistoryRecordActivityTaskStartedScope = "RecordActivityTaskStarted"
   369  	// HistorySignalWithStartWorkflowExecutionScope tracks SignalWithStartWorkflowExecution API calls received by service
   370  	HistorySignalWithStartWorkflowExecutionScope = "SignalWithStartWorkflowExecution"
   371  	// HistorySyncShardStatusScope tracks HistorySyncShardStatus API calls received by service
   372  	HistorySyncShardStatusScope = "SyncShardStatus"
   373  	// HistoryShardControllerScope is the scope used by shard controller
   374  	HistoryShardControllerScope = "ShardController"
   375  	// HistoryReapplyEventsScope is the scope used by event reapplication
   376  	HistoryReapplyEventsScope = "ReapplyEvents"
   377  	// HistoryQueryWorkflowScope tracks QueryWorkflow API calls received by service
   378  	HistoryQueryWorkflowScope = "QueryWorkflow"
   379  	// HistoryProcessDeleteHistoryEventScope tracks ProcessDeleteHistoryEvent processing calls
   380  	HistoryProcessDeleteHistoryEventScope = "ProcessDeleteHistoryEvent"
   381  	// HistoryDeleteWorkflowExecutionScope tracks DeleteWorkflowExecutions API calls
   382  	HistoryDeleteWorkflowExecutionScope = "DeleteWorkflowExecution"
   383  	// HistoryCacheGetOrCreateScope is the scope used by history cache
   384  	HistoryCacheGetOrCreateScope = "HistoryCacheGetOrCreate"
   385  	// HistoryCacheGetOrCreateCurrentScope is the scope used by history cache
   386  	HistoryCacheGetOrCreateCurrentScope = "CacheGetOrCreateCurrent"
   387  
   388  	// TransferQueueProcessorScope is the scope used by all metric emitted by transfer queue processor
   389  	TransferQueueProcessorScope = "TransferQueueProcessor"
   390  	// TransferActiveTaskCloseExecutionScope is the scope used for close execution task processing by transfer queue processor
   391  	TransferActiveTaskCloseExecutionScope = "TransferActiveTaskCloseExecution"
   392  
   393  	// TimerQueueProcessorScope is the scope used by all metric emitted by timer queue processor
   394  	TimerQueueProcessorScope = "TimerQueueProcessor"
   395  	// TimerActiveTaskActivityTimeoutScope is the scope used by metric emitted by timer queue processor for processing activity timeouts
   396  	TimerActiveTaskActivityTimeoutScope = "TimerActiveTaskActivityTimeout"
   397  	// TimerActiveTaskWorkflowTaskTimeoutScope is the scope used by metric emitted by timer queue processor for processing workflow task timeouts
   398  	TimerActiveTaskWorkflowTaskTimeoutScope = "TimerActiveTaskWorkflowTaskTimeout"
   399  	// TimerActiveTaskWorkflowBackoffTimerScope is the scope used by metric emitted by timer queue processor for processing retry task.
   400  	TimerActiveTaskWorkflowBackoffTimerScope = "TimerActiveTaskWorkflowBackoffTimer"
   401  
   402  	// ReplicatorQueueProcessorScope is the scope used by all metric emitted by replicator queue processor
   403  	ReplicatorQueueProcessorScope = "ReplicatorQueueProcessor"
   404  	// ReplicateHistoryEventsScope is the scope used by historyReplicator API for applying events
   405  	ReplicateHistoryEventsScope = "ReplicateHistoryEvents"
   406  	// HistoryRereplicationByTransferTaskScope tracks history replication calls made by transfer task
   407  	HistoryRereplicationByTransferTaskScope = "HistoryRereplicationByTransferTask"
   408  	// HistoryRereplicationByTimerTaskScope tracks history replication calls made by timer task
   409  	HistoryRereplicationByTimerTaskScope = "HistoryRereplicationByTimerTask"
   410  	// HistoryRereplicationByHistoryReplicationScope tracks history replication calls made by history replication
   411  	HistoryRereplicationByHistoryReplicationScope = "HistoryRereplicationByHistoryReplication"
   412  	// HistoryRereplicationByActivityReplicationScope tracks history replication calls made by activity replication
   413  	HistoryRereplicationByActivityReplicationScope = "HistoryRereplicationByActivityReplication"
   414  
   415  	// ShardInfoScope is the scope used when updating shard info
   416  	ShardInfoScope = "ShardInfo"
   417  	// WorkflowContextScope is the scope used by WorkflowContext component
   418  	WorkflowContextScope = "WorkflowContext"
   419  	// ExecutionStatsScope is the scope used for emiting workflow execution related stats
   420  	ExecutionStatsScope = "ExecutionStats"
   421  	// SessionStatsScope is the scope used for emiting session update related stats
   422  	SessionStatsScope = "SessionStats"
   423  	// WorkflowCompletionStatsScope tracks workflow completion updates
   424  	WorkflowCompletionStatsScope = "CompletionStats"
   425  	// ReplicationTaskFetcherScope is scope used by all metrics emitted by ReplicationTaskFetcher
   426  	ReplicationTaskFetcherScope = "ReplicationTaskFetcher"
   427  	// ReplicationTaskCleanupScope is scope used by all metrics emitted by ReplicationTaskProcessor cleanup
   428  	ReplicationTaskCleanupScope = "ReplicationTaskCleanup"
   429  	// ReplicationDLQStatsScope is scope used by all metrics emitted related to replication DLQ
   430  	ReplicationDLQStatsScope = "ReplicationDLQStats"
   431  	// EventsCacheGetEventScope is the scope used by events cache
   432  	EventsCacheGetEventScope = "EventsCacheGetEvent"
   433  	// EventsCachePutEventScope is the scope used by events cache
   434  	EventsCachePutEventScope = "EventsCachePutEvent"
   435  	// EventsCacheDeleteEventScope is the scope used by events cache
   436  	EventsCacheDeleteEventScope = "EventsCacheDeleteEvent"
   437  	// EventsCacheGetFromStoreScope is the scope used by events cache
   438  	EventsCacheGetFromStoreScope = "EventsCacheGetFromStore"
   439  	// HistoryEventNotificationScope is the scope used by shard history event notification
   440  	HistoryEventNotificationScope = "HistoryEventNotification"
   441  	// ArchiverClientScope is scope used by all metrics emitted by archiver.Client
   442  	ArchiverClientScope = "ArchiverClient"
   443  	// DeadlockDetectorScope is a scope for deadlock detector
   444  	DeadlockDetectorScope = "DeadlockDetector"
   445  	// OperationTimerQueueProcessorScope is a scope for timer queue base processor
   446  	OperationTimerQueueProcessorScope = "TimerQueueProcessor"
   447  	// OperationTransferQueueProcessorScope is a scope for transfer queue base processor
   448  	OperationTransferQueueProcessorScope = "TransferQueueProcessor"
   449  	// OperationVisibilityQueueProcessorScope is a scope for visibility queue processor
   450  	OperationVisibilityQueueProcessorScope = "VisibilityQueueProcessor"
   451  	// OperationArchivalQueueProcessorScope is a scope for archival queue processor
   452  	OperationArchivalQueueProcessorScope = "ArchivalQueueProcessor"
   453  	// OperationMemoryScheduledQueueProcessorScope is a scope for memory scheduled queue processor.
   454  	OperationMemoryScheduledQueueProcessorScope = "MemoryScheduledQueueProcessor"
   455  )
   456  
   457  // Matching Scope
   458  const (
   459  	// MatchingPollWorkflowTaskQueueScope tracks PollWorkflowTaskQueue API calls received by service
   460  	MatchingPollWorkflowTaskQueueScope = "PollWorkflowTaskQueue"
   461  	// MatchingPollActivityTaskQueueScope tracks PollActivityTaskQueue API calls received by service
   462  	MatchingPollActivityTaskQueueScope = "PollActivityTaskQueue"
   463  	// MatchingAddActivityTaskScope tracks AddActivityTask API calls received by service
   464  	MatchingAddActivityTaskScope = "AddActivityTask"
   465  	// MatchingAddWorkflowTaskScope tracks AddWorkflowTask API calls received by service
   466  	MatchingAddWorkflowTaskScope = "AddWorkflowTask"
   467  	// MatchingTaskQueueMgrScope is the metrics scope for matching.TaskQueueManager component
   468  	MatchingTaskQueueMgrScope = "TaskQueueMgr"
   469  	// MatchingEngineScope is the metrics scope for matchingEngine component
   470  	MatchingEngineScope = "MatchingEngine"
   471  	// MatchingQueryWorkflowScope tracks AddWorkflowTask API calls received by service
   472  	MatchingQueryWorkflowScope = "QueryWorkflow"
   473  	// MatchingRespondQueryTaskCompletedScope tracks AddWorkflowTask API calls received by service
   474  	MatchingRespondQueryTaskCompletedScope = "RespondQueryTaskCompleted"
   475  )
   476  
   477  // Worker Scope
   478  const (
   479  	// HistoryArchiverScope is used by history archivers
   480  	HistoryArchiverScope = "HistoryArchiver"
   481  	// VisibilityArchiverScope is used by visibility archivers
   482  	VisibilityArchiverScope = "VisibilityArchiver"
   483  	// HistoryScavengerScope is scope used by all metrics emitted by worker.history.Scavenger module
   484  	HistoryScavengerScope = "HistoryScavenger"
   485  	// ArchiverDeleteHistoryActivityScope is scope used by all metrics emitted by archiver.DeleteHistoryActivity
   486  	ArchiverDeleteHistoryActivityScope = "ArchiverDeleteHistoryActivity"
   487  	// ArchiverUploadHistoryActivityScope is scope used by all metrics emitted by archiver.UploadHistoryActivity
   488  	ArchiverUploadHistoryActivityScope = "ArchiverUploadHistoryActivity"
   489  	// ArchiverArchiveVisibilityActivityScope is scope used by all metrics emitted by archiver.ArchiveVisibilityActivity
   490  	ArchiverArchiveVisibilityActivityScope = "ArchiverArchiveVisibilityActivity"
   491  	// ArchiverScope is scope used by all metrics emitted by archiver.Archiver
   492  	ArchiverScope = "Archiver"
   493  	// ArchiverPumpScope is scope used by all metrics emitted by archiver.Pump
   494  	ArchiverPumpScope = "ArchiverPump"
   495  	// ArchiverArchivalWorkflowScope is scope used by all metrics emitted by archiver.ArchivalWorkflow
   496  	ArchiverArchivalWorkflowScope = "ArchiverArchivalWorkflow"
   497  	// AddSearchAttributesWorkflowScope is scope used by all metrics emitted by worker.AddSearchAttributesWorkflowScope module
   498  	AddSearchAttributesWorkflowScope = "AddSearchAttributesWorkflow"
   499  	// BatcherScope is scope used by all metrics emitted by worker.Batcher module
   500  	BatcherScope = "Batcher"
   501  	// ElasticsearchBulkProcessor is scope used by all metric emitted by Elasticsearch bulk processor
   502  	ElasticsearchBulkProcessor = "ElasticsearchBulkProcessor"
   503  	// ElasticsearchVisibility is scope used by all Elasticsearch visibility metrics
   504  	ElasticsearchVisibility = "ElasticsearchVisibility"
   505  	// MigrationWorkflowScope is scope used by metrics emitted by migration related workflows
   506  	MigrationWorkflowScope = "MigrationWorkflow"
   507  	// ReplicatorScope is the scope used by all metric emitted by replicator
   508  	ReplicatorScope = "Replicator"
   509  	// NamespaceReplicationTaskScope is the scope used by namespace task replication processing
   510  	NamespaceReplicationTaskScope = "NamespaceReplicationTask"
   511  	// HistoryReplicationTaskScope is the scope used by history task replication processing
   512  	HistoryReplicationTaskScope = "HistoryReplicationTask"
   513  	// HistoryMetadataReplicationTaskScope is the scope used by history metadata task replication processing
   514  	HistoryMetadataReplicationTaskScope = "HistoryMetadataReplicationTask"
   515  	// SyncShardTaskScope is the scope used by sync shrad information processing
   516  	SyncShardTaskScope = "SyncShardTask"
   517  	// SyncActivityTaskScope is the scope used by sync activity
   518  	SyncActivityTaskScope = "SyncActivityTask"
   519  	// SyncWorkflowStateTaskScope is the scope used by closed workflow task replication processing
   520  	SyncWorkflowStateTaskScope = "SyncWorkflowStateTask"
   521  	// SyncWatermarkScope is the scope used by closed workflow task replication processing
   522  	SyncWatermarkScope = "SyncWatermark"
   523  	// NoopTaskScope is the scope used by noop task
   524  	NoopTaskScope = "NoopTask"
   525  	// UnknownTaskScope is the scope used by unknown task
   526  	UnknownTaskScope = "UnknownTask"
   527  	// ParentClosePolicyProcessorScope is scope used by all metrics emitted by worker.ParentClosePolicyProcessor
   528  	ParentClosePolicyProcessorScope = "ParentClosePolicyProcessor"
   529  	DeleteNamespaceWorkflowScope    = "DeleteNamespaceWorkflow"
   530  	ReclaimResourcesWorkflowScope   = "ReclaimResourcesWorkflow"
   531  	DeleteExecutionsWorkflowScope   = "DeleteExecutionsWorkflow"
   532  )
   533  
   534  // History task type
   535  const (
   536  	TaskTypeTransferActiveTaskActivity             = "TransferActiveTaskActivity"
   537  	TaskTypeTransferActiveTaskWorkflowTask         = "TransferActiveTaskWorkflowTask"
   538  	TaskTypeTransferActiveTaskCloseExecution       = "TransferActiveTaskCloseExecution"
   539  	TaskTypeTransferActiveTaskCancelExecution      = "TransferActiveTaskCancelExecution"
   540  	TaskTypeTransferActiveTaskSignalExecution      = "TransferActiveTaskSignalExecution"
   541  	TaskTypeTransferActiveTaskStartChildExecution  = "TransferActiveTaskStartChildExecution"
   542  	TaskTypeTransferActiveTaskResetWorkflow        = "TransferActiveTaskResetWorkflow"
   543  	TaskTypeTransferActiveTaskDeleteExecution      = "TransferActiveTaskDeleteExecution"
   544  	TaskTypeTransferStandbyTaskActivity            = "TransferStandbyTaskActivity"
   545  	TaskTypeTransferStandbyTaskWorkflowTask        = "TransferStandbyTaskWorkflowTask"
   546  	TaskTypeTransferStandbyTaskCloseExecution      = "TransferStandbyTaskCloseExecution"
   547  	TaskTypeTransferStandbyTaskCancelExecution     = "TransferStandbyTaskCancelExecution"
   548  	TaskTypeTransferStandbyTaskSignalExecution     = "TransferStandbyTaskSignalExecution"
   549  	TaskTypeTransferStandbyTaskStartChildExecution = "TransferStandbyTaskStartChildExecution"
   550  	TaskTypeTransferStandbyTaskResetWorkflow       = "TransferStandbyTaskResetWorkflow"
   551  	TaskTypeTransferStandbyTaskDeleteExecution     = "TransferStandbyTaskDeleteExecution"
   552  	TaskTypeVisibilityTaskStartExecution           = "VisibilityTaskStartExecution"
   553  	TaskTypeVisibilityTaskUpsertExecution          = "VisibilityTaskUpsertExecution"
   554  	TaskTypeVisibilityTaskCloseExecution           = "VisibilityTaskCloseExecution"
   555  	TaskTypeVisibilityTaskDeleteExecution          = "VisibilityTaskDeleteExecution"
   556  	TaskTypeArchivalTaskArchiveExecution           = "ArchivalTaskArchiveExecution"
   557  	TaskTypeTimerActiveTaskActivityTimeout         = "TimerActiveTaskActivityTimeout"
   558  	TaskTypeTimerActiveTaskWorkflowTaskTimeout     = "TimerActiveTaskWorkflowTaskTimeout"
   559  	TaskTypeTimerActiveTaskUserTimer               = "TimerActiveTaskUserTimer"
   560  	TaskTypeTimerActiveTaskWorkflowTimeout         = "TimerActiveTaskWorkflowTimeout"
   561  	TaskTypeTimerActiveTaskActivityRetryTimer      = "TimerActiveTaskActivityRetryTimer"
   562  	TaskTypeTimerActiveTaskWorkflowBackoffTimer    = "TimerActiveTaskWorkflowBackoffTimer"
   563  	TaskTypeTimerActiveTaskDeleteHistoryEvent      = "TimerActiveTaskDeleteHistoryEvent"
   564  	TaskTypeTimerStandbyTaskActivityTimeout        = "TimerStandbyTaskActivityTimeout"
   565  	TaskTypeTimerStandbyTaskWorkflowTaskTimeout    = "TimerStandbyTaskWorkflowTaskTimeout"
   566  	TaskTypeTimerStandbyTaskUserTimer              = "TimerStandbyTaskUserTimer"
   567  	TaskTypeTimerStandbyTaskWorkflowTimeout        = "TimerStandbyTaskWorkflowTimeout"
   568  	TaskTypeTimerStandbyTaskActivityRetryTimer     = "TimerStandbyTaskActivityRetryTimer"
   569  	TaskTypeTimerStandbyTaskWorkflowBackoffTimer   = "TimerStandbyTaskWorkflowBackoffTimer"
   570  	TaskTypeTimerStandbyTaskDeleteHistoryEvent     = "TimerStandbyTaskDeleteHistoryEvent"
   571  	TaskTypeMemoryScheduledTaskWorkflowTaskTimeout = "MemoryScheduledTaskWorkflowTaskTimeout"
   572  )
   573  
   574  // Schedule action types
   575  const (
   576  	ScheduleActionTypeTag       = "schedule_action"
   577  	ScheduleActionStartWorkflow = "start_workflow"
   578  )
   579  
   580  var (
   581  	ServiceRequests = NewCounterDef(
   582  		"service_requests",
   583  		WithDescription("The number of RPC requests received by the service."),
   584  	)
   585  	ServicePendingRequests                   = NewGaugeDef("service_pending_requests")
   586  	ServiceFailures                          = NewCounterDef("service_errors")
   587  	ServicePanic                             = NewCounterDef("service_panics")
   588  	ServiceErrorWithType                     = NewCounterDef("service_error_with_type")
   589  	ServiceLatency                           = NewTimerDef("service_latency")
   590  	ServiceLatencyNoUserLatency              = NewTimerDef("service_latency_nouserlatency")
   591  	ServiceLatencyUserLatency                = NewTimerDef("service_latency_userlatency")
   592  	ServiceErrInvalidArgumentCounter         = NewCounterDef("service_errors_invalid_argument")
   593  	ServiceErrNamespaceNotActiveCounter      = NewCounterDef("service_errors_namespace_not_active")
   594  	ServiceErrResourceExhaustedCounter       = NewCounterDef("service_errors_resource_exhausted")
   595  	ServiceErrNotFoundCounter                = NewCounterDef("service_errors_entity_not_found")
   596  	ServiceErrExecutionAlreadyStartedCounter = NewCounterDef("service_errors_execution_already_started")
   597  	ServiceErrContextTimeoutCounter          = NewCounterDef("service_errors_context_timeout")
   598  	ServiceErrRetryTaskCounter               = NewCounterDef("service_errors_retry_task")
   599  	ServiceErrIncompleteHistoryCounter       = NewCounterDef("service_errors_incomplete_history")
   600  	ServiceErrNonDeterministicCounter        = NewCounterDef("service_errors_nondeterministic")
   601  	ServiceErrUnauthorizedCounter            = NewCounterDef("service_errors_unauthorized")
   602  	ServiceErrAuthorizeFailedCounter         = NewCounterDef("service_errors_authorize_failed")
   603  	ActionCounter                            = NewCounterDef("action")
   604  	TlsCertsExpired                          = NewGaugeDef("certificates_expired")
   605  	TlsCertsExpiring                         = NewGaugeDef("certificates_expiring")
   606  	ServiceAuthorizationLatency              = NewTimerDef("service_authorization_latency")
   607  	EventBlobSize                            = NewBytesHistogramDef("event_blob_size")
   608  	LockRequests                             = NewCounterDef("lock_requests")
   609  	LockLatency                              = NewTimerDef("lock_latency")
   610  	SemaphoreRequests                        = NewCounterDef("semaphore_requests")
   611  	SemaphoreFailures                        = NewCounterDef("semaphore_failures")
   612  	SemaphoreLatency                         = NewTimerDef("semaphore_latency")
   613  	ClientRequests                           = NewCounterDef(
   614  		"client_requests",
   615  		WithDescription("The number of requests sent by the client to an individual service, keyed by `service_role` and `operation`."),
   616  	)
   617  	ClientFailures               = NewCounterDef("client_errors")
   618  	ClientLatency                = NewTimerDef("client_latency")
   619  	ClientRedirectionRequests    = NewCounterDef("client_redirection_requests")
   620  	ClientRedirectionFailures    = NewCounterDef("client_redirection_errors")
   621  	ClientRedirectionLatency     = NewTimerDef("client_redirection_latency")
   622  	StateTransitionCount         = NewDimensionlessHistogramDef("state_transition_count")
   623  	HistorySize                  = NewBytesHistogramDef("history_size")
   624  	HistoryCount                 = NewDimensionlessHistogramDef("history_count")
   625  	SearchAttributesSize         = NewBytesHistogramDef("search_attributes_size")
   626  	MemoSize                     = NewBytesHistogramDef("memo_size")
   627  	TooManyPendingChildWorkflows = NewCounterDef(
   628  		"wf_too_many_pending_child_workflows",
   629  		WithDescription("The number of Workflow Tasks failed because they would cause the limit on the number of pending child workflows to be exceeded. See https://t.mp/limits for more information."),
   630  	)
   631  	TooManyPendingActivities = NewCounterDef(
   632  		"wf_too_many_pending_activities",
   633  		WithDescription("The number of Workflow Tasks failed because they would cause the limit on the number of pending activities to be exceeded. See https://t.mp/limits for more information."),
   634  	)
   635  	TooManyPendingCancelRequests = NewCounterDef(
   636  		"wf_too_many_pending_cancel_requests",
   637  		WithDescription("The number of Workflow Tasks failed because they would cause the limit on the number of pending cancel requests to be exceeded. See https://t.mp/limits for more information."),
   638  	)
   639  	TooManyPendingSignalsToExternalWorkflows = NewCounterDef(
   640  		"wf_too_many_pending_external_workflow_signals",
   641  		WithDescription("The number of Workflow Tasks failed because they would cause the limit on the number of pending signals to external workflows to be exceeded. See https://t.mp/limits for more information."),
   642  	)
   643  
   644  	// Frontend
   645  	AddSearchAttributesWorkflowSuccessCount  = NewCounterDef("add_search_attributes_workflow_success")
   646  	AddSearchAttributesWorkflowFailuresCount = NewCounterDef("add_search_attributes_workflow_failure")
   647  	DeleteNamespaceWorkflowSuccessCount      = NewCounterDef("delete_namespace_workflow_success")
   648  	DeleteNamespaceWorkflowFailuresCount     = NewCounterDef("delete_namespace_workflow_failure")
   649  	VersionCheckSuccessCount                 = NewCounterDef("version_check_success")
   650  	VersionCheckFailedCount                  = NewCounterDef("version_check_failed")
   651  	VersionCheckRequestFailedCount           = NewCounterDef("version_check_request_failed")
   652  	VersionCheckLatency                      = NewTimerDef("version_check_latency")
   653  	HTTPServiceRequests                      = NewCounterDef(
   654  		"http_service_requests",
   655  		WithDescription("The number of HTTP requests received by the service."),
   656  	)
   657  
   658  	// History
   659  	CacheRequests                                = NewCounterDef("cache_requests")
   660  	CacheFailures                                = NewCounterDef("cache_errors")
   661  	CacheLatency                                 = NewTimerDef("cache_latency")
   662  	CacheMissCounter                             = NewCounterDef("cache_miss")
   663  	HistoryEventNotificationQueueingLatency      = NewTimerDef("history_event_notification_queueing_latency")
   664  	HistoryEventNotificationFanoutLatency        = NewTimerDef("history_event_notification_fanout_latency")
   665  	HistoryEventNotificationInFlightMessageGauge = NewGaugeDef("history_event_notification_inflight_message_gauge")
   666  	HistoryEventNotificationFailDeliveryCount    = NewCounterDef("history_event_notification_fail_delivery_count")
   667  	// ArchivalTaskInvalidURI is emitted by the archival queue task executor when the history or visibility URI for an
   668  	// archival task is not a valid URI.
   669  	// We may emit this metric several times for a single task if the task is retried.
   670  	ArchivalTaskInvalidURI              = NewCounterDef("archival_task_invalid_uri")
   671  	ArchiverArchiveLatency              = NewTimerDef("archiver_archive_latency")
   672  	ArchiverArchiveTargetLatency        = NewTimerDef("archiver_archive_target_latency")
   673  	ShardContextClosedCounter           = NewCounterDef("shard_closed_count")
   674  	ShardContextCreatedCounter          = NewCounterDef("sharditem_created_count")
   675  	ShardContextRemovedCounter          = NewCounterDef("sharditem_removed_count")
   676  	ShardContextAcquisitionLatency      = NewTimerDef("sharditem_acquisition_latency")
   677  	ShardInfoImmediateQueueLagHistogram = NewDimensionlessHistogramDef(
   678  		"shardinfo_immediate_queue_lag",
   679  		WithDescription("A histogram across history shards for the difference between the smallest taskID of pending history tasks and the last generated history task ID."),
   680  	)
   681  	ShardInfoScheduledQueueLagTimer = NewTimerDef(
   682  		"shardinfo_scheduled_queue_lag",
   683  		WithDescription("A histogram across history shards for the difference between the earliest scheduled time of pending history tasks and current time."),
   684  	)
   685  	SyncShardFromRemoteCounter = NewCounterDef("syncshard_remote_count")
   686  	SyncShardFromRemoteFailure = NewCounterDef("syncshard_remote_failed")
   687  	TaskRequests               = NewCounterDef(
   688  		"task_requests",
   689  		WithDescription("The number of history tasks processed."),
   690  	)
   691  	TaskLoadLatency = NewTimerDef(
   692  		"task_latency_load",
   693  		WithDescription("Latency from history task generation to loading into memory (persistence schedule to start latency)."),
   694  	)
   695  	TaskScheduleLatency = NewTimerDef(
   696  		"task_latency_schedule",
   697  		WithDescription("Latency from history task loading to start processing (in-memory schedule to start latency)."),
   698  	)
   699  	TaskProcessingLatency = NewTimerDef(
   700  		"task_latency_processing",
   701  		WithDescription("Latency for processing a history task one time."),
   702  	)
   703  	TaskLatency = NewTimerDef(
   704  		"task_latency",
   705  		WithDescription("Latency for procsssing and completing a history task. This latency is across all attempts but excludes any latencies related to workflow lock or user qutoa limit."),
   706  	)
   707  	TaskQueueLatency = NewTimerDef(
   708  		"task_latency_queue",
   709  		WithDescription("End-to-end latency for processing and completing a history task, from task generation to completion."),
   710  	)
   711  	TaskAttempt = NewDimensionlessHistogramDef(
   712  		"task_attempt",
   713  		WithDescription("The number of attempts took to complete a history task."),
   714  	)
   715  	TaskFailures = NewCounterDef(
   716  		"task_errors",
   717  		WithDescription("The number of unexpected history task processing errors."),
   718  	)
   719  	TaskTerminalFailures = NewCounterDef(
   720  		"task_terminal_failures",
   721  		WithDescription("The number of times a history task failed with a terminal failure, causing it to be sent to the DLQ."),
   722  	)
   723  	TaskDLQFailures = NewCounterDef(
   724  		"task_dlq_failures",
   725  		WithDescription("The number of times we failed to send a history task to the DLQ."),
   726  	)
   727  	TaskDLQSendLatency = NewTimerDef(
   728  		"task_dlq_latency",
   729  		WithDescription("The amount of time it took to successfully send a task to the DLQ. This only records the"+
   730  			" latency of the final attempt to send the task to the DLQ, not the cumulative latency of all attempts."),
   731  	)
   732  	TaskDiscarded                   = NewCounterDef("task_errors_discarded")
   733  	TaskSkipped                     = NewCounterDef("task_skipped")
   734  	TaskVersionMisMatch             = NewCounterDef("task_errors_version_mismatch")
   735  	TasksDependencyTaskNotCompleted = NewCounterDef("task_dependency_task_not_completed")
   736  	TaskStandbyRetryCounter         = NewCounterDef("task_errors_standby_retry_counter")
   737  	TaskWorkflowBusyCounter         = NewCounterDef(
   738  		"task_errors_workflow_busy",
   739  		WithDescription("The number of history task processing errors caused by failing to acquire workflow lock within the configured timeout (history.cacheNonUserContextLockTimeout)."),
   740  	)
   741  	TaskNotActiveCounter         = NewCounterDef("task_errors_not_active_counter")
   742  	TaskNamespaceHandoverCounter = NewCounterDef("task_errors_namespace_handover")
   743  	TaskThrottledCounter         = NewCounterDef(
   744  		"task_errors_throttled",
   745  		WithDescription("The number of history task processing errors caused by resource exhausted errors, excluding workflow busy case."),
   746  	)
   747  	TaskCorruptionCounter       = NewCounterDef("task_errors_corruption")
   748  	TaskScheduleToStartLatency  = NewTimerDef("task_schedule_to_start_latency")
   749  	TaskBatchCompleteCounter    = NewCounterDef("task_batch_complete_counter")
   750  	TaskReschedulerPendingTasks = NewDimensionlessHistogramDef("task_rescheduler_pending_tasks")
   751  	PendingTasksCounter         = NewDimensionlessHistogramDef(
   752  		"pending_tasks",
   753  		WithDescription("A histogram across history shards for the number of in-memory pending history tasks."),
   754  	)
   755  	TaskSchedulerThrottled      = NewCounterDef("task_scheduler_throttled")
   756  	QueueScheduleLatency        = NewTimerDef("queue_latency_schedule") // latency for scheduling 100 tasks in one task channel
   757  	QueueReaderCountHistogram   = NewDimensionlessHistogramDef("queue_reader_count")
   758  	QueueSliceCountHistogram    = NewDimensionlessHistogramDef("queue_slice_count")
   759  	QueueActionCounter          = NewCounterDef("queue_actions")
   760  	QueueActionFailures         = NewCounterDef("queue_action_errors")
   761  	ActivityE2ELatency          = NewTimerDef("activity_end_to_end_latency")
   762  	AckLevelUpdateCounter       = NewCounterDef("ack_level_update")
   763  	AckLevelUpdateFailedCounter = NewCounterDef("ack_level_update_failed")
   764  	CommandCounter              = NewCounterDef("command")
   765  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   766  	CommandTypeScheduleActivityCounter = NewCounterDef("schedule_activity_command")
   767  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   768  	CommandTypeCompleteWorkflowCounter = NewCounterDef("complete_workflow_command")
   769  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   770  	CommandTypeFailWorkflowCounter = NewCounterDef("fail_workflow_command")
   771  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   772  	CommandTypeCancelWorkflowCounter = NewCounterDef("cancel_workflow_command")
   773  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   774  	CommandTypeStartTimerCounter = NewCounterDef("start_timer_command")
   775  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   776  	CommandTypeCancelActivityCounter = NewCounterDef("cancel_activity_command")
   777  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   778  	CommandTypeCancelTimerCounter = NewCounterDef("cancel_timer_command")
   779  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   780  	CommandTypeRecordMarkerCounter = NewCounterDef("record_marker_command")
   781  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   782  	CommandTypeCancelExternalWorkflowCounter = NewCounterDef("cancel_external_workflow_command")
   783  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   784  	CommandTypeContinueAsNewCounter = NewCounterDef("continue_as_new_command")
   785  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   786  	CommandTypeSignalExternalWorkflowCounter = NewCounterDef("signal_external_workflow_command")
   787  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   788  	CommandTypeUpsertWorkflowSearchAttributesCounter = NewCounterDef("upsert_workflow_search_attributes_command")
   789  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   790  	CommandTypeModifyWorkflowPropertiesCounter = NewCounterDef("modify_workflow_properties_command")
   791  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   792  	CommandTypeChildWorkflowCounter = NewCounterDef("child_workflow_command")
   793  	// Deprecated: replaced by CommandCounter and will be removed in a future release
   794  	CommandTypeProtocolMessage                           = NewCounterDef("protocol_message_command")
   795  	MessageTypeRequestWorkflowExecutionUpdateCounter     = NewCounterDef("request_workflow_update_message")
   796  	MessageTypeAcceptWorkflowExecutionUpdateCounter      = NewCounterDef("accept_workflow_update_message")
   797  	MessageTypeRespondWorkflowExecutionUpdateCounter     = NewCounterDef("respond_workflow_update_message")
   798  	MessageTypeRejectWorkflowExecutionUpdateCounter      = NewCounterDef("reject_workflow_update_message")
   799  	InvalidStateTransitionWorkflowExecutionUpdateCounter = NewCounterDef("invalid_state_transition_workflow_update_message")
   800  
   801  	ActivityEagerExecutionCounter = NewCounterDef("activity_eager_execution")
   802  	// WorkflowEagerExecutionCounter is emitted any time eager workflow start is requested.
   803  	WorkflowEagerExecutionCounter = NewCounterDef("workflow_eager_execution")
   804  	// WorkflowEagerExecutionDeniedCounter is emitted any time eager workflow start is requested and the serer fell back
   805  	// to standard dispatch.
   806  	// Timeouts and failures are not counted in this metric.
   807  	// This metric has a "reason" tag attached to it to understand why eager start was denied.
   808  	WorkflowEagerExecutionDeniedCounter           = NewCounterDef("workflow_eager_execution_denied")
   809  	EmptyCompletionCommandsCounter                = NewCounterDef("empty_completion_commands")
   810  	MultipleCompletionCommandsCounter             = NewCounterDef("multiple_completion_commands")
   811  	FailedWorkflowTasksCounter                    = NewCounterDef("failed_workflow_tasks")
   812  	WorkflowTaskAttempt                           = NewDimensionlessHistogramDef("workflow_task_attempt")
   813  	StaleMutableStateCounter                      = NewCounterDef("stale_mutable_state")
   814  	AutoResetPointsLimitExceededCounter           = NewCounterDef("auto_reset_points_exceed_limit")
   815  	AutoResetPointCorruptionCounter               = NewCounterDef("auto_reset_point_corruption")
   816  	BatchableTaskBatchCount                       = NewGaugeDef("batchable_task_batch_count")
   817  	ConcurrencyUpdateFailureCounter               = NewCounterDef("concurrency_update_failure")
   818  	ServiceErrShardOwnershipLostCounter           = NewCounterDef("service_errors_shard_ownership_lost")
   819  	HeartbeatTimeoutCounter                       = NewCounterDef("heartbeat_timeout")
   820  	ScheduleToStartTimeoutCounter                 = NewCounterDef("schedule_to_start_timeout")
   821  	StartToCloseTimeoutCounter                    = NewCounterDef("start_to_close_timeout")
   822  	ScheduleToCloseTimeoutCounter                 = NewCounterDef("schedule_to_close_timeout")
   823  	NewTimerNotifyCounter                         = NewCounterDef("new_timer_notifications")
   824  	AcquireShardsCounter                          = NewCounterDef("acquire_shards_count")
   825  	AcquireShardsLatency                          = NewTimerDef("acquire_shards_latency")
   826  	MembershipChangedCounter                      = NewCounterDef("membership_changed_count")
   827  	NumShardsGauge                                = NewGaugeDef("numshards_gauge")
   828  	GetEngineForShardErrorCounter                 = NewCounterDef("get_engine_for_shard_errors")
   829  	GetEngineForShardLatency                      = NewTimerDef("get_engine_for_shard_latency")
   830  	RemoveEngineForShardLatency                   = NewTimerDef("remove_engine_for_shard_latency")
   831  	CompleteWorkflowTaskWithStickyEnabledCounter  = NewCounterDef("complete_workflow_task_sticky_enabled_count")
   832  	CompleteWorkflowTaskWithStickyDisabledCounter = NewCounterDef("complete_workflow_task_sticky_disabled_count")
   833  	WorkflowTaskHeartbeatTimeoutCounter           = NewCounterDef("workflow_task_heartbeat_timeout_count")
   834  	DuplicateReplicationEventsCounter             = NewCounterDef("duplicate_replication_events")
   835  	AcquireLockFailedCounter                      = NewCounterDef("acquire_lock_failed")
   836  	WorkflowContextCleared                        = NewCounterDef("workflow_context_cleared")
   837  	MutableStateSize                              = NewBytesHistogramDef(
   838  		"mutable_state_size",
   839  		WithDescription("The size of an individual Workflow Execution's state, emitted each time a workflow execution is retrieved or updated."),
   840  	)
   841  	ExecutionInfoSize                     = NewBytesHistogramDef("execution_info_size")
   842  	ExecutionStateSize                    = NewBytesHistogramDef("execution_state_size")
   843  	ActivityInfoSize                      = NewBytesHistogramDef("activity_info_size")
   844  	TimerInfoSize                         = NewBytesHistogramDef("timer_info_size")
   845  	ChildInfoSize                         = NewBytesHistogramDef("child_info_size")
   846  	RequestCancelInfoSize                 = NewBytesHistogramDef("request_cancel_info_size")
   847  	SignalInfoSize                        = NewBytesHistogramDef("signal_info_size")
   848  	SignalRequestIDSize                   = NewBytesHistogramDef("signal_request_id_size")
   849  	BufferedEventsSize                    = NewBytesHistogramDef("buffered_events_size")
   850  	ActivityInfoCount                     = NewDimensionlessHistogramDef("activity_info_count")
   851  	TimerInfoCount                        = NewDimensionlessHistogramDef("timer_info_count")
   852  	ChildInfoCount                        = NewDimensionlessHistogramDef("child_info_count")
   853  	SignalInfoCount                       = NewDimensionlessHistogramDef("signal_info_count")
   854  	RequestCancelInfoCount                = NewDimensionlessHistogramDef("request_cancel_info_count")
   855  	SignalRequestIDCount                  = NewDimensionlessHistogramDef("signal_request_id_count")
   856  	BufferedEventsCount                   = NewDimensionlessHistogramDef("buffered_events_count")
   857  	TaskCount                             = NewDimensionlessHistogramDef("task_count")
   858  	TotalActivityCount                    = NewDimensionlessHistogramDef("total_activity_count")
   859  	TotalUserTimerCount                   = NewDimensionlessHistogramDef("total_user_timer_count")
   860  	TotalChildExecutionCount              = NewDimensionlessHistogramDef("total_child_execution_count")
   861  	TotalRequestCancelExternalCount       = NewDimensionlessHistogramDef("total_request_cancel_external_count")
   862  	TotalSignalExternalCount              = NewDimensionlessHistogramDef("total_signal_external_count")
   863  	TotalSignalCount                      = NewDimensionlessHistogramDef("total_signal_count")
   864  	WorkflowRetryBackoffTimerCount        = NewCounterDef("workflow_retry_backoff_timer")
   865  	WorkflowCronBackoffTimerCount         = NewCounterDef("workflow_cron_backoff_timer")
   866  	WorkflowDelayedStartBackoffTimerCount = NewCounterDef("workflow_delayed_start_backoff_timer")
   867  	WorkflowCleanupDeleteCount            = NewCounterDef("workflow_cleanup_delete")
   868  	WorkflowSuccessCount                  = NewCounterDef("workflow_success")
   869  	WorkflowCancelCount                   = NewCounterDef("workflow_cancel")
   870  	WorkflowFailedCount                   = NewCounterDef("workflow_failed")
   871  	WorkflowTimeoutCount                  = NewCounterDef("workflow_timeout")
   872  	WorkflowTerminateCount                = NewCounterDef("workflow_terminate")
   873  	WorkflowContinuedAsNewCount           = NewCounterDef("workflow_continued_as_new")
   874  	ReplicationStreamPanic                = NewCounterDef("replication_stream_panic")
   875  	ReplicationTasksSend                  = NewCounterDef("replication_tasks_send")
   876  	ReplicationTasksRecv                  = NewCounterDef("replication_tasks_recv")
   877  	ReplicationTasksRecvBacklog           = NewDimensionlessHistogramDef("replication_tasks_recv_backlog")
   878  	ReplicationTasksSkipped               = NewCounterDef("replication_tasks_skipped")
   879  	ReplicationTasksApplied               = NewCounterDef("replication_tasks_applied")
   880  	ReplicationTasksFailed                = NewCounterDef("replication_tasks_failed")
   881  	// ReplicationTasksLag is a heuristic for how far behind the remote DC is for a given cluster. It measures the
   882  	// difference between task IDs so its unit should be "tasks".
   883  	ReplicationTasksLag = NewDimensionlessHistogramDef("replication_tasks_lag")
   884  	// ReplicationTasksFetched records the number of tasks fetched by the poller.
   885  	ReplicationTasksFetched                        = NewDimensionlessHistogramDef("replication_tasks_fetched")
   886  	ReplicationLatency                             = NewTimerDef("replication_latency")
   887  	ReplicationTaskTransmissionLatency             = NewTimerDef("replication_task_transmission_latency")
   888  	ReplicationDLQFailed                           = NewCounterDef("replication_dlq_enqueue_failed")
   889  	ReplicationDLQMaxLevelGauge                    = NewGaugeDef("replication_dlq_max_level")
   890  	ReplicationDLQAckLevelGauge                    = NewGaugeDef("replication_dlq_ack_level")
   891  	ReplicationNonEmptyDLQCount                    = NewCounterDef("replication_dlq_non_empty")
   892  	ReplicationOutlierNamespace                    = NewCounterDef("replication_outlier_namespace")
   893  	EventReapplySkippedCount                       = NewCounterDef("event_reapply_skipped_count")
   894  	DirectQueryDispatchLatency                     = NewTimerDef("direct_query_dispatch_latency")
   895  	DirectQueryDispatchStickyLatency               = NewTimerDef("direct_query_dispatch_sticky_latency")
   896  	DirectQueryDispatchNonStickyLatency            = NewTimerDef("direct_query_dispatch_non_sticky_latency")
   897  	DirectQueryDispatchStickySuccessCount          = NewCounterDef("direct_query_dispatch_sticky_success")
   898  	DirectQueryDispatchNonStickySuccessCount       = NewCounterDef("direct_query_dispatch_non_sticky_success")
   899  	DirectQueryDispatchClearStickinessLatency      = NewTimerDef("direct_query_dispatch_clear_stickiness_latency")
   900  	DirectQueryDispatchClearStickinessSuccessCount = NewCounterDef("direct_query_dispatch_clear_stickiness_success")
   901  	DirectQueryDispatchTimeoutBeforeNonStickyCount = NewCounterDef("direct_query_dispatch_timeout_before_non_sticky")
   902  	WorkflowTaskQueryLatency                       = NewTimerDef("workflow_task_query_latency")
   903  	ConsistentQueryTimeoutCount                    = NewCounterDef("consistent_query_timeout")
   904  	QueryBufferExceededCount                       = NewCounterDef("query_buffer_exceeded")
   905  	QueryRegistryInvalidStateCount                 = NewCounterDef("query_registry_invalid_state")
   906  	WorkflowTaskTimeoutOverrideCount               = NewCounterDef("workflow_task_timeout_overrides")
   907  	WorkflowRunTimeoutOverrideCount                = NewCounterDef("workflow_run_timeout_overrides")
   908  	ReplicationTaskCleanupCount                    = NewCounterDef("replication_task_cleanup_count")
   909  	ReplicationTaskCleanupFailure                  = NewCounterDef("replication_task_cleanup_failed")
   910  	MutableStateDirty                              = NewCounterDef("mutable_state_dirty")
   911  	MutableStateChecksumMismatch                   = NewCounterDef("mutable_state_checksum_mismatch")
   912  	MutableStateChecksumInvalidated                = NewCounterDef("mutable_state_checksum_invalidated")
   913  	ClosedWorkflowBufferEventCount                 = NewCounterDef("closed_workflow_buffer_event_counter")
   914  	InorderBufferedEventsCounter                   = NewCounterDef("inordered_buffered_events")
   915  	ShardLingerSuccess                             = NewTimerDef("shard_linger_success")
   916  	ShardLingerTimeouts                            = NewCounterDef("shard_linger_timeouts")
   917  	DynamicRateLimiterMultiplier                   = NewGaugeDef("dynamic_rate_limit_multiplier")
   918  	DLQWrites                                      = NewCounterDef(
   919  		"dlq_writes",
   920  		WithDescription("The number of times a message is enqueued to DLQ. DLQ can be inspected using tdbg dlq command."),
   921  	)
   922  
   923  	// Deadlock detector latency metrics
   924  	DDClusterMetadataLockLatency         = NewTimerDef("dd_cluster_metadata_lock_latency")
   925  	DDClusterMetadataCallbackLockLatency = NewTimerDef("dd_cluster_metadata_callback_lock_latency")
   926  	DDShardControllerLockLatency         = NewTimerDef("dd_shard_controller_lock_latency")
   927  	DDShardLockLatency                   = NewTimerDef("dd_shard_lock_latency")
   928  	DDShardIOSemaphoreLatency            = NewTimerDef("dd_shard_io_semaphore_latency")
   929  	DDNamespaceRegistryLockLatency       = NewTimerDef("dd_namespace_registry_lock_latency")
   930  
   931  	// Matching
   932  	MatchingClientForwardedCounter            = NewCounterDef("forwarded")
   933  	MatchingClientInvalidTaskQueueName        = NewCounterDef("invalid_task_queue_name")
   934  	SyncMatchLatencyPerTaskQueue              = NewTimerDef("syncmatch_latency")
   935  	AsyncMatchLatencyPerTaskQueue             = NewTimerDef("asyncmatch_latency")
   936  	PollSuccessPerTaskQueueCounter            = NewCounterDef("poll_success")
   937  	PollTimeoutPerTaskQueueCounter            = NewCounterDef("poll_timeouts")
   938  	PollSuccessWithSyncPerTaskQueueCounter    = NewCounterDef("poll_success_sync")
   939  	PollLatencyPerTaskQueue                   = NewTimerDef("poll_latency")
   940  	LeaseRequestPerTaskQueueCounter           = NewCounterDef("lease_requests")
   941  	LeaseFailurePerTaskQueueCounter           = NewCounterDef("lease_failures")
   942  	ConditionFailedErrorPerTaskQueueCounter   = NewCounterDef("condition_failed_errors")
   943  	RespondQueryTaskFailedPerTaskQueueCounter = NewCounterDef("respond_query_failed")
   944  	SyncThrottlePerTaskQueueCounter           = NewCounterDef("sync_throttle_count")
   945  	BufferThrottlePerTaskQueueCounter         = NewCounterDef("buffer_throttle_count")
   946  	ExpiredTasksPerTaskQueueCounter           = NewCounterDef("tasks_expired")
   947  	ForwardedPerTaskQueueCounter              = NewCounterDef("forwarded_per_tl")
   948  	ForwardTaskErrorsPerTaskQueue             = NewCounterDef("forward_task_errors")
   949  	LocalToLocalMatchPerTaskQueueCounter      = NewCounterDef("local_to_local_matches")
   950  	LocalToRemoteMatchPerTaskQueueCounter     = NewCounterDef("local_to_remote_matches")
   951  	RemoteToLocalMatchPerTaskQueueCounter     = NewCounterDef("remote_to_local_matches")
   952  	RemoteToRemoteMatchPerTaskQueueCounter    = NewCounterDef("remote_to_remote_matches")
   953  	LoadedTaskQueueGauge                      = NewGaugeDef("loaded_task_queue_count")
   954  	TaskQueueStartedCounter                   = NewCounterDef("task_queue_started")
   955  	TaskQueueStoppedCounter                   = NewCounterDef("task_queue_stopped")
   956  	TaskWriteThrottlePerTaskQueueCounter      = NewCounterDef("task_write_throttle_count")
   957  	TaskWriteLatencyPerTaskQueue              = NewTimerDef("task_write_latency")
   958  	TaskLagPerTaskQueueGauge                  = NewGaugeDef("task_lag_per_tl")
   959  	NoRecentPollerTasksPerTaskQueueCounter    = NewCounterDef("no_poller_tasks")
   960  	UnknownBuildPollsCounter                  = NewCounterDef("unknown_build_polls")
   961  	UnknownBuildTasksCounter                  = NewCounterDef("unknown_build_tasks")
   962  	TaskDispatchLatencyPerTaskQueue           = NewTimerDef("task_dispatch_latency")
   963  
   964  	// Worker
   965  	ExecutorTasksDoneCount                          = NewCounterDef("executor_done")
   966  	ExecutorTasksErrCount                           = NewCounterDef("executor_err")
   967  	ExecutorTasksDeferredCount                      = NewCounterDef("executor_deferred")
   968  	ExecutorTasksDroppedCount                       = NewCounterDef("executor_dropped")
   969  	StartedCount                                    = NewCounterDef("started")
   970  	StoppedCount                                    = NewCounterDef("stopped")
   971  	TaskProcessedCount                              = NewGaugeDef("task_processed")
   972  	TaskDeletedCount                                = NewGaugeDef("task_deleted")
   973  	TaskQueueProcessedCount                         = NewGaugeDef("taskqueue_processed")
   974  	TaskQueueDeletedCount                           = NewGaugeDef("taskqueue_deleted")
   975  	TaskQueueOutstandingCount                       = NewGaugeDef("taskqueue_outstanding")
   976  	HistoryArchiverArchiveNonRetryableErrorCount    = NewCounterDef("history_archiver_archive_non_retryable_error")
   977  	HistoryArchiverArchiveTransientErrorCount       = NewCounterDef("history_archiver_archive_transient_error")
   978  	HistoryArchiverArchiveSuccessCount              = NewCounterDef("history_archiver_archive_success")
   979  	HistoryArchiverTotalUploadSize                  = NewBytesHistogramDef("history_archiver_total_upload_size")
   980  	HistoryArchiverHistorySize                      = NewBytesHistogramDef("history_archiver_history_size")
   981  	HistoryArchiverDuplicateArchivalsCount          = NewCounterDef("history_archiver_duplicate_archivals")
   982  	HistoryArchiverBlobExistsCount                  = NewCounterDef("history_archiver_blob_exists")
   983  	HistoryArchiverBlobSize                         = NewBytesHistogramDef("history_archiver_blob_size")
   984  	HistoryWorkflowExecutionCacheLatency            = NewTimerDef("history_workflow_execution_cache_latency")
   985  	VisibilityArchiverArchiveNonRetryableErrorCount = NewCounterDef("visibility_archiver_archive_non_retryable_error")
   986  	VisibilityArchiverArchiveTransientErrorCount    = NewCounterDef("visibility_archiver_archive_transient_error")
   987  	VisibilityArchiveSuccessCount                   = NewCounterDef("visibility_archiver_archive_success")
   988  	HistoryScavengerSuccessCount                    = NewCounterDef("scavenger_success")
   989  	HistoryScavengerErrorCount                      = NewCounterDef("scavenger_errors")
   990  	HistoryScavengerSkipCount                       = NewCounterDef("scavenger_skips")
   991  	ExecutionsOutstandingCount                      = NewGaugeDef("executions_outstanding")
   992  	ScavengerValidationRequestsCount                = NewCounterDef("scavenger_validation_requests")
   993  	ScavengerValidationFailuresCount                = NewCounterDef("scavenger_validation_failures")
   994  	ScavengerValidationSkipsCount                   = NewCounterDef("scavenger_validation_skips")
   995  	AddSearchAttributesFailuresCount                = NewCounterDef("add_search_attributes_failures")
   996  	DeleteNamespaceSuccessCount                     = NewCounterDef("delete_namespace_success")
   997  	RenameNamespaceSuccessCount                     = NewCounterDef("rename_namespace_success")
   998  	DeleteExecutionsSuccessCount                    = NewCounterDef("delete_executions_success")
   999  	DeleteNamespaceFailuresCount                    = NewCounterDef("delete_namespace_failures")
  1000  	UpdateNamespaceFailuresCount                    = NewCounterDef("update_namespace_failures")
  1001  	RenameNamespaceFailuresCount                    = NewCounterDef("rename_namespace_failures")
  1002  	ReadNamespaceFailuresCount                      = NewCounterDef("read_namespace_failures")
  1003  	ListExecutionsFailuresCount                     = NewCounterDef("list_executions_failures")
  1004  	CountExecutionsFailuresCount                    = NewCounterDef("count_executions_failures")
  1005  	DeleteExecutionFailuresCount                    = NewCounterDef("delete_execution_failures")
  1006  	DeleteExecutionNotFoundCount                    = NewCounterDef("delete_execution_not_found")
  1007  	RateLimiterFailuresCount                        = NewCounterDef("rate_limiter_failures")
  1008  	BatcherProcessorSuccess                         = NewCounterDef(
  1009  		"batcher_processor_requests",
  1010  		WithDescription("The number of individual workflow execution tasks successfully processed by the batch request processor"),
  1011  	)
  1012  	BatcherProcessorFailures                          = NewCounterDef("batcher_processor_errors")
  1013  	BatcherOperationFailures                          = NewCounterDef("batcher_operation_errors")
  1014  	ElasticsearchBulkProcessorRequests                = NewCounterDef("elasticsearch_bulk_processor_requests")
  1015  	ElasticsearchBulkProcessorQueuedRequests          = NewDimensionlessHistogramDef("elasticsearch_bulk_processor_queued_requests")
  1016  	ElasticsearchBulkProcessorFailures                = NewCounterDef("elasticsearch_bulk_processor_errors")
  1017  	ElasticsearchBulkProcessorCorruptedData           = NewCounterDef("elasticsearch_bulk_processor_corrupted_data")
  1018  	ElasticsearchBulkProcessorDuplicateRequest        = NewCounterDef("elasticsearch_bulk_processor_duplicate_request")
  1019  	ElasticsearchBulkProcessorRequestLatency          = NewTimerDef("elasticsearch_bulk_processor_request_latency")
  1020  	ElasticsearchBulkProcessorCommitLatency           = NewTimerDef("elasticsearch_bulk_processor_commit_latency")
  1021  	ElasticsearchBulkProcessorWaitAddLatency          = NewTimerDef("elasticsearch_bulk_processor_wait_add_latency")
  1022  	ElasticsearchBulkProcessorWaitStartLatency        = NewTimerDef("elasticsearch_bulk_processor_wait_start_latency")
  1023  	ElasticsearchBulkProcessorBulkSize                = NewDimensionlessHistogramDef("elasticsearch_bulk_processor_bulk_size")
  1024  	ElasticsearchBulkProcessorBulkResquestTookLatency = NewTimerDef("elasticsearch_bulk_processor_bulk_request_took_latency")
  1025  	ElasticsearchDocumentParseFailuresCount           = NewCounterDef("elasticsearch_document_parse_failures_counter")
  1026  	ElasticsearchDocumentGenerateFailuresCount        = NewCounterDef("elasticsearch_document_generate_failures_counter")
  1027  	ElasticsearchCustomOrderByClauseCount             = NewCounterDef("elasticsearch_custom_order_by_clause_counter")
  1028  	CatchUpReadyShardCountGauge                       = NewGaugeDef("catchup_ready_shard_count")
  1029  	HandoverReadyShardCountGauge                      = NewGaugeDef("handover_ready_shard_count")
  1030  	ReplicatorMessages                                = NewCounterDef("replicator_messages")
  1031  	ReplicatorFailures                                = NewCounterDef("replicator_errors")
  1032  	ReplicatorLatency                                 = NewTimerDef("replicator_latency")
  1033  	ReplicatorDLQFailures                             = NewCounterDef("replicator_dlq_enqueue_fails")
  1034  	NamespaceReplicationEnqueueDLQCount               = NewCounterDef("namespace_replication_dlq_enqueue_requests")
  1035  	ParentClosePolicyProcessorSuccess                 = NewCounterDef("parent_close_policy_processor_requests")
  1036  	ParentClosePolicyProcessorFailures                = NewCounterDef("parent_close_policy_processor_errors")
  1037  	ScheduleMissedCatchupWindow                       = NewCounterDef(
  1038  		"schedule_missed_catchup_window",
  1039  		WithDescription("The number of times a schedule missed an action due to the configured catchup window"),
  1040  	)
  1041  	ScheduleRateLimited = NewCounterDef(
  1042  		"schedule_rate_limited",
  1043  		WithDescription("The number of times a schedule action was delayed by more than 1s due to rate limiting"),
  1044  	)
  1045  	ScheduleBufferOverruns = NewCounterDef(
  1046  		"schedule_buffer_overruns",
  1047  		WithDescription("The number of schedule actions that were dropped due to the action buffer being full"),
  1048  	)
  1049  	ScheduleActionSuccess = NewCounterDef(
  1050  		"schedule_action_success",
  1051  		WithDescription("The number of schedule actions that were successfully taken by a schedule"),
  1052  	)
  1053  	ScheduleActionErrors = NewCounterDef(
  1054  		"schedule_action_errors",
  1055  		WithDescription("The number of schedule actions that failed to start"),
  1056  	)
  1057  	ScheduleCancelWorkflowErrors = NewCounterDef(
  1058  		"schedule_cancel_workflow_errors",
  1059  		WithDescription("The number of times a schedule got an error trying to cancel a previous run"),
  1060  	)
  1061  	ScheduleTerminateWorkflowErrors = NewCounterDef(
  1062  		"schedule_terminate_workflow_errors",
  1063  		WithDescription("The number of times a schedule got an error trying to terminate a previous run"),
  1064  	)
  1065  	ScheduleActionDelay = NewTimerDef(
  1066  		"schedule_action_delay",
  1067  		WithDescription("Delay between when scheduled actions should/actually happen"),
  1068  	)
  1069  
  1070  	// Force replication
  1071  	EncounterZombieWorkflowCount        = NewCounterDef("encounter_zombie_workflow_count")
  1072  	EncounterNotFoundWorkflowCount      = NewCounterDef("encounter_not_found_workflow_count")
  1073  	EncounterPassRetentionWorkflowCount = NewCounterDef("encounter_pass_retention_workflow_count")
  1074  	GenerateReplicationTasksLatency     = NewTimerDef("generate_replication_tasks_latency")
  1075  	VerifyReplicationTaskSuccess        = NewCounterDef("verify_replication_task_success")
  1076  	VerifyReplicationTaskNotFound       = NewCounterDef("verify_replication_task_not_found")
  1077  	VerifyReplicationTaskFailed         = NewCounterDef("verify_replication_task_failed")
  1078  	VerifyReplicationTasksLatency       = NewTimerDef("verify_replication_tasks_latency")
  1079  	VerifyDescribeMutableStateLatency   = NewTimerDef("verify_describe_mutable_state_latency")
  1080  
  1081  	// Replication
  1082  	NamespaceReplicationTaskAckLevelGauge = NewGaugeDef("namespace_replication_task_ack_level")
  1083  	NamespaceReplicationDLQAckLevelGauge  = NewGaugeDef("namespace_dlq_ack_level")
  1084  	NamespaceReplicationDLQMaxLevelGauge  = NewGaugeDef("namespace_dlq_max_level")
  1085  
  1086  	// Persistence
  1087  	PersistenceRequests = NewCounterDef(
  1088  		"persistence_requests",
  1089  		WithDescription("Persistence requests, keyed by `operation`"),
  1090  	)
  1091  	PersistenceFailures      = NewCounterDef("persistence_errors")
  1092  	PersistenceErrorWithType = NewCounterDef(
  1093  		"persistence_error_with_type",
  1094  		WithDescription("Persistence errors, keyed by `error_type`"),
  1095  	)
  1096  	PersistenceLatency = NewTimerDef(
  1097  		"persistence_latency",
  1098  		WithDescription("Persistence latency, keyed by `operation`"),
  1099  	)
  1100  	PersistenceShardRPS                    = NewDimensionlessHistogramDef("persistence_shard_rps")
  1101  	PersistenceErrResourceExhaustedCounter = NewCounterDef("persistence_errors_resource_exhausted")
  1102  	VisibilityPersistenceRequests          = NewCounterDef("visibility_persistence_requests")
  1103  	VisibilityPersistenceErrorWithType     = NewCounterDef("visibility_persistence_error_with_type")
  1104  	VisibilityPersistenceFailures          = NewCounterDef("visibility_persistence_errors")
  1105  	VisibilityPersistenceResourceExhausted = NewCounterDef("visibility_persistence_resource_exhausted")
  1106  	VisibilityPersistenceLatency           = NewTimerDef("visibility_persistence_latency")
  1107  	CassandraInitSessionLatency            = NewTimerDef("cassandra_init_session_latency")
  1108  	CassandraSessionRefreshFailures        = NewCounterDef("cassandra_session_refresh_failures")
  1109  )
  1110  
  1111  // DEPRECATED: remove interim metric names for tracking fraction of FE->History calls during migration
  1112  const (
  1113  	AccessHistoryOld = "AccessHistoryOld"
  1114  	AccessHistoryNew = "AccessHistoryNew"
  1115  
  1116  	AdminGetWorkflowExecutionRawHistoryV2Tag      = "GetWorkflowExecutionRawHistoryV2"
  1117  	AdminDeleteWorkflowExecutionTag               = "DeleteWorkflowExecution"
  1118  	FrontendGetWorkflowExecutionHistoryTag        = "GetWorkflowExecutionHistory"
  1119  	FrontendGetWorkflowExecutionHistoryReverseTag = "GetWorkflowExecutionHistoryReverse"
  1120  	FrontendRespondWorkflowTaskCompletedTag       = "RespondWorkflowTaskCompleted"
  1121  	MatchingPollWorkflowTaskQueueTag              = "PollWorkflowTaskQueue"
  1122  	HistoryHandleWorkflowTaskStartedTag           = "HandleWorkflowTaskStarted"
  1123  )