<commit_before>.. _dropwizard-metrics:

==================
Dropwizard Metrics
==================

AtlasDB makes use of the Dropwizard `Metrics library <http://metrics.dropwizard.io/>`__ to
expose a global ``MetricRegistry`` called ``AtlasDbRegistry``. Users of AtlasDB should use ``AtlasDbMetrics.setMetricsRegistry``
to make use of our ``MetricRegistry``.

We expose the metrics below. For the Cassandra client metrics with ``<host>``, we will expose metrics specific to every
Cassandra node in your cluster. For more details on what information each type of metric provides, we recommend reading
the Metrics `Getting Started Guide <http://metrics.dropwizard.io/3.1.0/getting-started/#>`__.

**Gauges**

 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.numBlacklistedHosts``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requestConnectionExceptionProportion``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requestFailureProportion``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requestConnectionExceptionProportion``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requestFailureProportion``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.meanActiveTimeMillis``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.meanBorrowWaitTimeMillis``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.meanIdleTimeMillis``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.proportionDestroyedByBorrower``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.proportionDestroyedByEvictor``

**Histograms**

- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.byteSizeTx``

**Meters**

- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requestConnectionExceptions``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requestExceptions``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requests``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requestConnectionExceptions``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requestExceptions``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requests``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskReadOnly.failures``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskReadOnly.failures.java.lang.IllegalArgumentException``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskWithRetry.failures``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskWithRetry.failures.feign.FeignException``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskWithRetry.failures.java.lang.IllegalArgumentException``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskWithRetry.failures.java.lang.IllegalStateException``

**Timers**

- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.getLockService``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskReadOnly``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskWithRetry``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitAcquireLocks``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitCheckingForConflicts``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitPutCommitTs``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitTotalTimeSinceTxCreation``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitWrite``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.getRows``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.millisForPunch``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.processedRangeMillis``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.transactionMillis``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.waitForCommitTsMillis``<commit_msg>Responding to dropwizard metrics comments: \n- change wording for injecting MetricRegistry \n- remove failure* metrics \n- remove last two metrics<commit_after>.. _dropwizard-metrics:

==================
Dropwizard Metrics
==================

AtlasDB makes use of the Dropwizard `Metrics library <http://metrics.dropwizard.io/>`__ to
expose a global ``MetricRegistry`` called ``AtlasDbRegistry``. Users of AtlasDB should use ``AtlasDbMetrics.setMetricRegistry``
to inject their own ``MetricRegistry`` for their application prior to initializing the AtlasDB transaction manager.

We expose the metrics below. For the Cassandra client metrics with ``<host>``, we will expose metrics specific to every
Cassandra node in your cluster. For more details on what information each type of metric provides, we recommend reading
the Metrics `Getting Started Guide <http://metrics.dropwizard.io/3.1.0/getting-started/#>`__.

**Gauges**

 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.numBlacklistedHosts``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requestConnectionExceptionProportion``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requestFailureProportion``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requestConnectionExceptionProportion``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requestFailureProportion``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.meanActiveTimeMillis``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.meanBorrowWaitTimeMillis``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.meanIdleTimeMillis``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.proportionDestroyedByBorrower``
 - ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPoolingContainer.<host>.proportionDestroyedByEvictor``

**Histograms**

- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.byteSizeTx``

**Meters**

- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requestConnectionExceptions``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requestExceptions``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.<host>.requests``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requestConnectionExceptions``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requestExceptions``
- ``com.palantir.atlasdb.keyvalue.cassandra.CassandraClientPool.requests``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskReadOnly.failures``
- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskWithRetry.failures``

Additional failure counts will be dynamically generated based on the returned exceptions, so you may see metrics like
the following:

- ``com.palantir.atlasdb.transaction.api.LockAwareTransactionManager.runTaskWithRetry.failures.java.lang.IllegalStateException``

**Timers**

- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitAcquireLocks``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitCheckingForConflicts``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitPutCommitTs``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitTotalTimeSinceTxCreation``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.commitWrite``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.getRows``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.millisForPunch``
- ``com.palantir.atlasdb.transaction.impl.SnapshotTransaction.processedRangeMillis``
{'fraction_non_alphanumeric': 0.12934508816120907, 'fraction_numerical': 0.0007556675062972292, 'mean_word_length': 7.557112068965517, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4222448', 'n_tokens_mistral': 2503, 'n_tokens_neox': 2439, 'n_words': 271}