nanorth commented on code in PR #2285:
URL: 
https://github.com/apache/incubator-pegasus/pull/2285#discussion_r2313155361


##########
go-client/pegasus/table_connector.go:
##########
@@ -726,6 +757,7 @@ func (p *pegasusTableConnector) runPartitionOp(ctx 
context.Context, hashKey []by
                confUpdated, retry, err = p.handleReplicaError(err, part)
                return
        })
+       errResult = err

Review Comment:
   Yes, errResult is used in the defer function to distinguish between success, 
failure, and timeout.
   
   ```go
   if p.enableMetrics {
                defer func() {
                        elapsed := time.Since(start).Nanoseconds()
                        pm := metrics.GetPrometheusMetrics()
                        status := "success"
                        if errResult != nil {
                                if errors.Is(ctx.Err(), 
context.DeadlineExceeded) {
                                        status = "timeout"
                                } else {
                                        status = "fail"
                                }
                        }
                        meta := strings.Join(p.meta.GetMetaIPAddrs(), ",")
                        
pm.MarkMeter(fmt.Sprintf("pegasus_client_%s_%s_%s_total", p.tableName, 
optype.String(), status), 1, map[string]string{"meta": meta})
                        
pm.ObserveSummary(fmt.Sprintf("pegasus_client_%s_%s_%s_latency", p.tableName, 
optype.String(), status), float64(elapsed), map[string]string{"meta": meta})
                }()
        }
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to