-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metrics: seperate metrics with source scope for txn command #723
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And may change the implementation of KVTxn.isInternal
and KVSnapshot.IsInternal
to inherit IsInternal from RequestSource
.
func (r *RequestSource) IsInternal() bool {
if r == nil {
return false
}
return r.RequestSourceInternal
}
TxnRegionsNumHistogramPessimisticLock prometheus.Observer | ||
TxnRegionsNumHistogramPessimisticRollbackInternal prometheus.Observer | ||
TxnRegionsNumHistogramPessimisticRollback prometheus.Observer | ||
TxnRegionsNumHistogramWithCoprocessor prometheus.Observer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TxnRegionsNumHistogramWithCoprocessorInternal
is missing
TxnRegionsNumHistogramPessimisticLock = TiKVTxnRegionsNumHistogram.WithLabelValues("2pc_pessimistic_lock", LblGeneral) | ||
TxnRegionsNumHistogramPessimisticRollbackInternal = TiKVTxnRegionsNumHistogram.WithLabelValues("2pc_pessimistic_rollback", LblInternal) | ||
TxnRegionsNumHistogramPessimisticRollback = TiKVTxnRegionsNumHistogram.WithLabelValues("2pc_pessimistic_rollback", LblGeneral) | ||
TxnRegionsNumHistogramWithBatchCoprocessorInternal = TiKVTxnRegionsNumHistogram.WithLabelValues("coprocessor", LblInternal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type "coprocessor" is wrong, and the init of TxnRegionsNumHistogramWithCoprocessor
and TxnRegionsNumHistogramWithCoprocessorInternal
is missing.
metrics.TiKVTxnWriteKVCountHistogram.Observe(float64(commitDetail.WriteKeys)) | ||
metrics.TiKVTxnWriteSizeHistogram.Observe(float64(commitDetail.WriteSize)) | ||
|
||
isInternalReq := util.IsInternalRequest(c.txn.GetRequestSource()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isInternalReq := util.IsInternalRequest(c.txn.GetRequestSource()) | |
isInternalReq := c.txn.isInternal() |
TxnRegionsNumHistogramWithBatchCoprocessorInternal = TiKVTxnRegionsNumHistogram.WithLabelValues("coprocessor", LblInternal) | ||
TxnRegionsNumHistogramWithBatchCoprocessor = TiKVTxnRegionsNumHistogram.WithLabelValues("batch_coprocessor", LblGeneral) | ||
TxnWriteKVCountHistogramInternal = TiKVTxnWriteKVCountHistogram.WithLabelValues(LblInternal) | ||
TxnWriteKVCountHistogramGeneral = TiKVTxnWriteKVCountHistogram.WithLabelValues(LblGeneral) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TxnWriteKVCountHistogramInternal
and TxnWriteKVCountHistogramGeneral
are not initialized.
Unluckily there is no codegen by macro for such works :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing TxnWriteSizeHistogramInternal
and TxnWriteSizeHistogramGeneral
are added.
@you06 |
@
Yes the nil check is required, what I mean is to avoid making string and check it, we can check |
@you06 |
Signed-off-by: cfzjywxk <lsswxrxr@163.com>
Signed-off-by: cfzjywxk <lsswxrxr@163.com>
Signed-off-by: cfzjywxk <lsswxrxr@163.com>
ref: pingcap/tidb#41203
Add source scope for several metrics.
The grafana change result would be posted latter, related PR would be opened in the tidb repo.