Skip to content

Commit

Permalink
code review suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainHorse committed Nov 22, 2024
1 parent 168e1da commit 94b1606
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class KafkaMetricsCollector[F[_]: Monad: ToTry](
customLabels: List[(String, String)] = List.empty,
) extends Collector {

private val (customLabelsKeys, customLabelsValues) = customLabels.separate

protected def getCollectorType(metric: ClientMetric[F]): Collector.Type = {
// https://prometheus.io/docs/practices/naming/#metric-names
if (metric.name.endsWith("total")) Collector.Type.COUNTER
Expand Down Expand Up @@ -84,9 +86,8 @@ class KafkaMetricsCollector[F[_]: Monad: ToTry](
(prometheusKey -> value).some
else None
}
val (customLabelsKeys, customLabelsValues) = customLabels.separate
val tagsKeys = (tags.keys.toList ++ customLabelsKeys).asJava
val tagsValues = (tags.values.toList ++ customLabelsValues).asJava
val tagsKeys = (tags.keys.toList ++ customLabelsKeys).asJava
val tagsValues = (tags.values.toList ++ customLabelsValues).asJava
metric.value.map {
case v: Number =>
new Sample(name, tagsKeys, tagsValues, v.doubleValue()).some
Expand Down

0 comments on commit 94b1606

Please sign in to comment.