Skip to content

Commit

Permalink
Emit number of task list managers started (#3929)
Browse files Browse the repository at this point in the history
* Emit number of task list managers started
  • Loading branch information
mantas-sidlauskas authored Feb 3, 2021
1 parent bbfd674 commit e895640
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,7 @@ const (
RemoteToLocalMatchPerTaskListCounter
RemoteToRemoteMatchPerTaskListCounter
PollerPerTaskListCounter
TaskListManagersGauge

NumMatchingMetrics
)
Expand Down Expand Up @@ -2441,6 +2442,7 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{
RemoteToLocalMatchPerTaskListCounter: {metricName: "remote_to_local_matches_per_tl", metricRollupName: "remote_to_local_matches"},
RemoteToRemoteMatchPerTaskListCounter: {metricName: "remote_to_remote_matches_per_tl", metricRollupName: "remote_to_remote_matches"},
PollerPerTaskListCounter: {metricName: "poller_count_per_tl", metricRollupName: "poller_count"},
TaskListManagersGauge: {metricName: "tasklist_managers", metricType: Gauge},
},
Worker: {
ReplicatorMessages: {metricName: "replicator_messages"},
Expand Down
8 changes: 8 additions & 0 deletions service/matching/matchingEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ func (e *matchingEngineImpl) getTaskListManager(taskList *taskListID,
return nil, err
}
e.taskLists[*taskList] = mgr
e.metricsClient.Scope(metrics.MatchingTaskListMgrScope).UpdateGauge(
metrics.TaskListManagersGauge,
float64(len(e.taskLists)),
)
e.taskListsLock.Unlock()
err = mgr.Start()
if err != nil {
Expand All @@ -218,6 +222,10 @@ func (e *matchingEngineImpl) removeTaskListManager(id *taskListID) {
e.taskListsLock.Lock()
defer e.taskListsLock.Unlock()
delete(e.taskLists, *id)
e.metricsClient.Scope(metrics.MatchingTaskListMgrScope).UpdateGauge(
metrics.TaskListManagersGauge,
float64(len(e.taskLists)),
)
}

// AddDecisionTask either delivers task directly to waiting poller or save it into task list persistence.
Expand Down

0 comments on commit e895640

Please sign in to comment.