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


##########
go-client/pegasus/table_connector.go:
##########
@@ -715,8 +719,35 @@ func (p *pegasusTableConnector) Incr(ctx context.Context, 
hashKey []byte, sortKe
 }
 
 func (p *pegasusTableConnector) runPartitionOp(ctx context.Context, hashKey 
[]byte, req op.Request, optype OpType) (interface{}, error) {
+       start := time.Now()
+       var errResult error
+       if p.enablePerfCounter {
+               defer func() {
+                       pm := metrics.GetPrometheusMetrics()
+                       status := "success"
+                       if errResult != nil {
+                               if errors.Is(ctx.Err(), 
context.DeadlineExceeded) {
+                                       status = "timeout"
+                               } else {
+                                       status = "fail"
+                               }
+                       }
+
+                       // The metaIP is added to the metric name because some 
users may use multiple client instances
+                       // within a single process to access tables with the 
same name in different availability zones.
+                       // Including the metaIP helps to distinguish monitoring 
metrics for tables with the same name.
+                       // The reason for not putting metaIP into labels 
(Prometheus) or tags (Falcon) is that labels/tags
+                       // are designed to be unique and constant for a single 
process.
+                       firstMetaIP := 
strings.ReplaceAll(p.meta.GetMetaIPAddrs()[0], ".", "_")
+                       
pm.MarkMeter(fmt.Sprintf("pegasus_client_%s_%s_%s_total_%s", p.tableName, 
optype.String(), status, firstMetaIP), 1)
+                       elapsed := time.Since(start).Nanoseconds()

Review Comment:
   Yes, agreed. Code updated



-- 
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