deniskuzZ commented on a change in pull request #2158:
URL: https://github.com/apache/hive/pull/2158#discussion_r609436401
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/AcidMetricService.java
##########
@@ -86,22 +88,21 @@ private void collectMetrics() throws MetaException {
private void updateDBMetrics() throws MetaException {
MetricsInfo metrics = txnHandler.getMetricsInfo();
- Metrics.getOrCreateGauge(MetricsConstants.COMPACTION_STATUS_PREFIX +
"txn_to_writeid").set(
- metrics.getTxnToWriteIdCount());
- Metrics.getOrCreateGauge(MetricsConstants.COMPACTION_STATUS_PREFIX +
"completed_txn_components").set(
- metrics.getCompletedTxnsCount());
- Metrics.getOrCreateGauge(MetricsConstants.COMPACTION_STATUS_PREFIX +
"open_txn").set(
- metrics.getOpenTxnsCount());
- Metrics.getOrCreateGauge(MetricsConstants.OLDEST_OPEN_TXN_ID ).set(
- metrics.getOldestOpenTxnId());
- Metrics.getOrCreateGauge(MetricsConstants.OLDEST_OPEN_TXN_AGE ).set(
- metrics.getOldestOpenTxnAge());
- Metrics.getOrCreateGauge(MetricsConstants.NUM_ABORTED_TXNS).set(
- metrics.getAbortedTxnsCount());
- Metrics.getOrCreateGauge(MetricsConstants.OLDEST_ABORTED_TXN_ID).set(
- metrics.getOldestAbortedTxnId());
- Metrics.getOrCreateGauge(MetricsConstants.OLDEST_ABORTED_TXN_AGE).set(
- metrics.getOldestAbortedTxnAge());
+
Metrics.getOrCreateGauge(NUM_TXN_TO_WRITEID).set(metrics.getTxnToWriteIdCount());
+
Metrics.getOrCreateGauge(NUM_COMPLETED_TXN_COMPONENTS).set(metrics.getCompletedTxnsCount());
+
+ // NOTE: AcidOpenTxnsCounterService has a duplicate countOpenTxns()
functionality and could be disabled.
+ // PS: make sure to update `numOpenTxns` counter in TxnHandler.
+ Metrics.getOrCreateGauge(NUM_OPEN_TXNS).set(metrics.getOpenTxnsCount());
+
Metrics.getOrCreateGauge(OLDEST_OPEN_TXN_ID).set(metrics.getOldestOpenTxnId());
+
Metrics.getOrCreateGauge(OLDEST_OPEN_TXN_AGE).set(metrics.getOldestOpenTxnAge());
+
+
Metrics.getOrCreateGauge(NUM_ABORTED_TXNS).set(metrics.getAbortedTxnsCount());
+
Metrics.getOrCreateGauge(OLDEST_ABORTED_TXN_ID).set(metrics.getOldestAbortedTxnId());
+
Metrics.getOrCreateGauge(OLDEST_ABORTED_TXN_AGE).set(metrics.getOldestAbortedTxnAge());
+
+ Metrics.getOrCreateGauge(NUM_LOCKS).set(metrics.getLocksCount());
+ Metrics.getOrCreateGauge(OLDEST_LOCK_AGE).set(metrics.getOldestLockAge());
Review comment:
These metrics affect txn performance in general. I think it shouldn't be
a problem keeping them in the same service. Creating extra service just for
them would be overkill.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]