-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update matching to emit metric for tasklist backlog size #5448
Conversation
@@ -191,7 +191,7 @@ func TestDescribeTaskList(t *testing.T) { | |||
require.NotNil(t, taskListStatus) | |||
require.Zero(t, taskListStatus.GetAckLevel()) | |||
require.Equal(t, taskCount, taskListStatus.GetReadLevel()) | |||
require.Equal(t, taskCount, taskListStatus.GetBacklogCountHint()) | |||
require.Equal(t, int64(0), taskListStatus.GetBacklogCountHint()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand. In the test 3 tasks are pushed to the tasklist. Why a backlog is still 0? Or are they immediately processed?
I suggest adding a test that verifies the backlog count/metric emition with tally.TestScope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original value is in-memory backlog, and the new value is the in-db backlog. The test generates the backlog by changing the in-memory backlog, so after the change, the value is changed.
service/matching/taskListManager.go
Outdated
@@ -459,7 +459,7 @@ func (c *taskListManagerImpl) DescribeTaskList(includeTaskListStatus bool) *type | |||
response.TaskListStatus = &types.TaskListStatus{ | |||
ReadLevel: c.taskAckManager.GetReadLevel(), | |||
AckLevel: c.taskAckManager.GetAckLevel(), | |||
BacklogCountHint: c.taskAckManager.GetBacklogCount(), | |||
BacklogCountHint: c.db.BacklogCount(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
who is calling DescribeTaskList()
and how will this BacklogCountHint
be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's called by cadence-web and cadence-cli. And the value is only used to tell if there is backlog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on your other comment this value will be potentially 5m old. If that's sufficient for now the change makes sense. otherwise we can maybe keep an accurate in-memory counter as tasks are added/removed from a tasklist in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, after some thought, I decide to not use the cached value. The api is not called frequently, and I don't think it will increase db load a lot.
d705b15
to
3445037
Compare
service/matching/taskListManager.go
Outdated
@@ -459,7 +459,7 @@ func (c *taskListManagerImpl) DescribeTaskList(includeTaskListStatus bool) *type | |||
response.TaskListStatus = &types.TaskListStatus{ | |||
ReadLevel: c.taskAckManager.GetReadLevel(), | |||
AckLevel: c.taskAckManager.GetAckLevel(), | |||
BacklogCountHint: c.taskAckManager.GetBacklogCount(), | |||
BacklogCountHint: c.db.BacklogCount(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on your other comment this value will be potentially 5m old. If that's sufficient for now the change makes sense. otherwise we can maybe keep an accurate in-memory counter as tasks are added/removed from a tasklist in the future.
39ea5bb
to
d12698f
Compare
What changed?
Update matching to emit metric for tasklist backlog size
Why?
To provide visibility of tasklist backlog size
How did you test it?
local test
Potential risks
Release notes
Documentation Changes