Skip to content
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

Fix metrics for task forwarding #6174

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions service/matching/handler/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,13 +471,12 @@ pollLoop:
return nil, fmt.Errorf("couldn't get task: %w", err)
}

e.emitForwardedFromStats(hCtx.scope, task.IsForwarded(), req.GetForwardedFrom())

if task.IsStarted() {
return task.PollForDecisionResponse(), nil
// TODO: Maybe add history expose here?
}

e.emitForwardedFromStats(hCtx.scope, task.IsForwarded(), req.GetForwardedFrom())
if task.IsQuery() {
task.Finish(nil) // this only means query task sync match succeed.

Expand Down Expand Up @@ -598,18 +597,17 @@ pollLoop:
return nil, err
}

e.emitForwardedFromStats(hCtx.scope, task.IsForwarded(), req.GetForwardedFrom())

if task.IsStarted() {
// tasks received from remote are already started. So, simply forward the response
return task.PollForActivityResponse(), nil
}
e.emitForwardedFromStats(hCtx.scope, task.IsForwarded(), req.GetForwardedFrom())
e.emitTaskIsolationMetrics(hCtx.scope, task.Event.PartitionConfig, req.GetIsolationGroup())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, what's the reason for moving the taskIsolationMetric emitting here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just updated the description of the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

if task.ActivityTaskDispatchInfo != nil {
task.Finish(nil)
return e.createSyncMatchPollForActivityTaskResponse(task, task.ActivityTaskDispatchInfo), nil
}

e.emitTaskIsolationMetrics(hCtx.scope, task.Event.PartitionConfig, req.GetIsolationGroup())
resp, err := e.recordActivityTaskStarted(hCtx.Context, request, task)
if err != nil {
switch err.(type) {
Expand Down
Loading