lengyuexuexuan commented on code in PR #2285: URL: https://github.com/apache/incubator-pegasus/pull/2285#discussion_r2297297941
########## 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: Should this line of code be placed earlier? -- 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: dev-unsubscr...@pegasus.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pegasus.apache.org For additional commands, e-mail: dev-h...@pegasus.apache.org