Open stkaspar opened 1 month ago
ledger_transaction_count has a validation flag label associated with it. If you have two transactions, where one is valid, and one is invalid with MVCC_READ_CONFLICT, you will get two counters incremented, e.g.:
ledger_transaction_count{chaincode="basic:1.0.1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="VALID"} 1
ledger_transaction_count{chaincode="basic:1.0.1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="MVCC_READ_CONFLICT"} 1
This is working as intended.
ledger_transaction_count has a validation flag label associated with it. If you have two transactions, where one is valid, and one is invalid with MVCC_READ_CONFLICT, you will get two counters incremented, e.g.:
ledger_transaction_count{chaincode="basic:1.0.1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="VALID"} 1 ledger_transaction_count{chaincode="basic:1.0.1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="MVCC_READ_CONFLICT"} 1
This is working as intended.
Thanks for your reply.
In my environment, I didn't see the below output, that's quite strange
ledger_transaction_count{chaincode="basic:1.0.1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="MVCC_READ_CONFLICT"} 1
Or does it have any filter parameters when calling the /metrics
endpoint?
There is no filter for /metrics endpoint. I tried calling the /metrics endpoint with one valid and one invalid transaction and I get back:
ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="MVCC_READ_CONFLICT"} 1
ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="VALID"} 1
Then anything I can do for the result from the /metrics
? cuz now the metrics are not correct and can't be a health index for my application
There is no filter for /metrics endpoint. I tried calling the /metrics endpoint with one valid and one invalid transaction and I get back:
ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="MVCC_READ_CONFLICT"} 1 ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="VALID"} 1
Can I confirm that each transaction, even the transaction's validation code is VALID or MVCC_READ_CONFLICT or other status, it should show from the /metrics
, right?
There is no filter for /metrics endpoint. I tried calling the /metrics endpoint with one valid and one invalid transaction and I get back:
ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="MVCC_READ_CONFLICT"} 1 ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="VALID"} 1
Can I confirm that each transaction, even the transaction's validation code is VALID or MVCC_READ_CONFLICT or other status, it should show from the
/metrics
, right?
I checked the code... for every transaction in a block, regardless of the validation status, will result in a counter increment for ledger_transaction_count with corresponding validation_code label.
There is no filter for /metrics endpoint. I tried calling the /metrics endpoint with one valid and one invalid transaction and I get back:
ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="MVCC_READ_CONFLICT"} 1 ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="VALID"} 1
Can I confirm that each transaction, even the transaction's validation code is VALID or MVCC_READ_CONFLICT or other status, it should show from the
/metrics
, right?I checked the code... for every transaction in a block, regardless of the validation status, will result in a counter increment for ledger_transaction_count with corresponding validation_code label.
Thanks for the code checking and could you share where the code is?
There is no filter for /metrics endpoint. I tried calling the /metrics endpoint with one valid and one invalid transaction and I get back:
ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="MVCC_READ_CONFLICT"} 1 ledger_transaction_count{chaincode="basic:1",channel="mychannel",transaction_type="ENDORSER_TRANSACTION",validation_code="VALID"} 1
Can I confirm that each transaction, even the transaction's validation code is VALID or MVCC_READ_CONFLICT or other status, it should show from the
/metrics
, right?I checked the code... for every transaction in a block, regardless of the validation status, will result in a counter increment for ledger_transaction_count with corresponding validation_code label.
Thanks for the code checking and could you share where the code is?
The stats update happens as soon as the block is committed: https://github.com/hyperledger/fabric/blob/main/core/ledger/kvledger/kv_ledger.go#L726
Here's the ultimate counter increment: https://github.com/hyperledger/fabric/blob/main/core/ledger/kvledger/metrics.go#L69-L74
Description
I checked the transaction count via the chaincode or SDK should be like 500, but in the Grafana(from Prometheus), there was only like 350(
ledger_transaction_count
), less than the number from the chaincode.And I know there were some transactions with the status
MVCC_READ_CONFLICT
, but I didn't see them in the Grafana. If you fetch the transactions via chaincode or SDK, it's expected you won't get transactions with the above status. So it's expected the number of transaction count in the Grafana should be greater than the number from the chaincode.Here are the peer metrics I get from the endpoint
/metrics
, you can see that the ledger_transaction_count only shows the transactions withvalidation_code=VALID
, it didn't count another transaction status likeMVCC_READ_CONFLICT
Steps to reproduce