kvutils: Prefix metrics with "daml.". (#5289)

Just to get them consistent with the others.

CHANGELOG_BEGIN
- [Ledger Integration Kit] Prefixed all metrics with "daml." for
  consistency.
CHANGELOG_END
This commit is contained in:
Samir Talwar 2020-03-31 10:18:29 +02:00 committed by GitHub
parent 89a9f5c7d2
commit 499bb924cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 18 deletions

View File

@ -321,7 +321,7 @@ class KeyValueCommitting(metricRegistry: MetricRegistry) {
}
private object Metrics {
private val prefix = MetricRegistry.name("kvutils", "committer")
private val prefix = MetricRegistry.name("daml", "kvutils", "committer")
// Timer (and count) of how fast submissions have been processed.
val runTimer: metrics.Timer =

View File

@ -149,7 +149,8 @@ class KeyValueSubmission(metricRegistry: MetricRegistry) {
def unpackDamlSubmission(bytes: ByteString): DamlSubmission = DamlSubmission.parseFrom(bytes)
object Metrics {
private val prefix = MetricRegistry.name("kvutils", "submission", "conversion")
private val prefix = MetricRegistry.name("daml", "kvutils", "submission", "conversion")
val transactionOutputs: Timer =
metricRegistry.timer(MetricRegistry.name(prefix, "transaction_outputs"))
val transactionToSubmission: Timer =

View File

@ -51,7 +51,7 @@ private[committer] trait Committer[Submission, PartialResult] {
protected val metricRegistry: metrics.MetricRegistry
protected def metricsName(metric: String): String =
metrics.MetricRegistry.name("kvutils", "committer", committerName, metric)
metrics.MetricRegistry.name("daml", "kvutils", "committer", committerName, metric)
// These timers are lazy because they rely on `committerName`, which is defined in the subclass
// and therefore not set at object initialization.

View File

@ -518,7 +518,8 @@ private[kvutils] class ProcessTransactionSubmission(
}
private object Metrics {
private val prefix = MetricRegistry.name("kvutils", "committer", "transaction")
private val prefix = MetricRegistry.name("daml", "kvutils", "committer", "transaction")
val runTimer: Timer = metricRegistry.timer(MetricRegistry.name(prefix, "run_timer"))
val interpretTimer: Timer = metricRegistry.timer(MetricRegistry.name(prefix, "interpret_timer"))
val accepts: Counter = metricRegistry.counter(MetricRegistry.name(prefix, "accepts"))

View File

@ -228,8 +228,10 @@ class SubmissionValidator[LogResult](
}
object Metrics {
private val prefix = MetricRegistry.name("kvutils", "submission", "validator")
val openEnvelope: Timer = metricRegistry.timer(MetricRegistry.name(prefix, "open_envelope"))
private val prefix = MetricRegistry.name("daml", "kvutils", "submission", "validator")
val openEnvelope: Timer =
metricRegistry.timer(MetricRegistry.name(prefix, "open_envelope"))
val validateSubmission: Timer =
metricRegistry.timer(MetricRegistry.name(prefix, "validate_submission"))
val processSubmission: Timer =

View File

@ -163,9 +163,9 @@ class KVUtilsConfigSpec extends WordSpec with Matchers {
}, submissionId = Ref.LedgerString.assertFromString("submission-id-1"))
} yield {
// Check that we're updating the metrics (assuming this test at least has been run)
metricRegistry.counter("kvutils.committer.config.accepts").getCount should be >= 1L
metricRegistry.counter("kvutils.committer.config.rejections").getCount should be >= 1L
metricRegistry.timer("kvutils.committer.config.run_timer").getCount should be >= 1L
metricRegistry.counter("daml.kvutils.committer.config.accepts").getCount should be >= 1L
metricRegistry.counter("daml.kvutils.committer.config.rejections").getCount should be >= 1L
metricRegistry.timer("daml.kvutils.committer.config.run_timer").getCount should be >= 1L
}
}
}

View File

@ -92,11 +92,15 @@ class KVUtilsPackageSpec extends WordSpec with Matchers with BazelRunfiles {
_ <- submitArchives("simple-archive-submission-1", simpleArchive).map(_._2)
} yield {
// Check that we're updating the metrics (assuming this test at least has been run)
metricRegistry.counter("kvutils.committer.package_upload.accepts").getCount should be >= 1L
metricRegistry
.counter("kvutils.committer.package_upload.rejections")
.counter("daml.kvutils.committer.package_upload.accepts")
.getCount should be >= 1L
metricRegistry
.counter("daml.kvutils.committer.package_upload.rejections")
.getCount should be >= 1L
metricRegistry
.timer("daml.kvutils.committer.package_upload.run_timer")
.getCount should be >= 1L
metricRegistry.timer("kvutils.committer.package_upload.run_timer").getCount should be >= 1L
}
}

View File

@ -84,13 +84,13 @@ class KVUtilsPartySpec extends WordSpec with Matchers {
} yield {
// Check that we're updating the metrics (assuming this test at least has been run)
metricRegistry
.counter("kvutils.committer.party_allocation.accepts")
.counter("daml.kvutils.committer.party_allocation.accepts")
.getCount should be >= 1L
metricRegistry
.counter("kvutils.committer.party_allocation.rejections")
.counter("daml.kvutils.committer.party_allocation.rejections")
.getCount should be >= 1L
metricRegistry
.timer("kvutils.committer.party_allocation.run_timer")
.timer("daml.kvutils.committer.party_allocation.run_timer")
.getCount should be >= 1L
}
}

View File

@ -269,11 +269,15 @@ class KVUtilsTransactionSpec extends WordSpec with Matchers {
} yield {
val disputed = DamlTransactionRejectionEntry.ReasonCase.DISPUTED
// Check that we're updating the metrics (assuming this test at least has been run)
metricRegistry.counter("kvutils.committer.transaction.accepts").getCount should be >= 1L
metricRegistry
.counter(s"kvutils.committer.transaction.rejections_${disputed.name}")
.counter("daml.kvutils.committer.transaction.accepts")
.getCount should be >= 1L
metricRegistry
.counter(s"daml.kvutils.committer.transaction.rejections_${disputed.name}")
.getCount should be >= 1L
metricRegistry
.timer("daml.kvutils.committer.transaction.run_timer")
.getCount should be >= 1L
metricRegistry.timer("kvutils.committer.transaction.run_timer").getCount should be >= 1L
}
}