Browse Source

fix memory increasing

pull/358/head
yedf2 4 years ago
parent
commit
12ae4d1a2e
  1. 10
      dtmsvr/metrics.go

10
dtmsvr/metrics.go

@ -94,18 +94,18 @@ func grpcMetrics(ctx context.Context, req interface{}, info *grpc.UnaryServerInf
func transactionMetrics(global *TransGlobal, status bool) {
if status {
transactionTotal.WithLabelValues(global.TransType, global.Gid, "ok").Inc()
transactionTotal.WithLabelValues(global.TransType, "ok").Inc()
} else {
transactionTotal.WithLabelValues(global.TransType, global.Gid, "fail").Inc()
transactionTotal.WithLabelValues(global.TransType, "fail").Inc()
}
transactionHandledTime.WithLabelValues(global.TransType, global.Gid).Observe(time.Since(*global.CreateTime).Seconds())
transactionHandledTime.WithLabelValues(global.TransType).Observe(time.Since(*global.CreateTime).Seconds())
}
func branchMetrics(global *TransGlobal, branch *TransBranch, status bool) {
if status {
branchTotal.WithLabelValues(global.TransType, global.Gid, branch.BranchID, branch.Op, "ok").Inc()
branchTotal.WithLabelValues(global.TransType, branch.BranchID, branch.Op, "ok").Inc()
} else {
branchTotal.WithLabelValues(global.TransType, global.Gid, branch.BranchID, branch.Op, "fail").Inc()
branchTotal.WithLabelValues(global.TransType, branch.BranchID, branch.Op, "fail").Inc()
}
}

Loading…
Cancel
Save