Skip to content

Commit

Permalink
Fix metrics for task forwarding (#6174)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll authored Jul 17, 2024
1 parent 568fcc2 commit c3228ee
Showing 1 changed file with 3 additions and 5 deletions.
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())
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

0 comments on commit c3228ee

Please sign in to comment.