From 750d630219e3d77cfa08004402c112d1e1ba8632 Mon Sep 17 00:00:00 2001 From: Terence Date: Mon, 7 Dec 2020 20:01:14 +0800 Subject: [PATCH] Remove job id from ingested row counter metric Signed-off-by: Terence --- .../metrics/source/RedisSinkMetricSource.scala | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/spark/ingestion/src/main/scala/org/apache/spark/metrics/source/RedisSinkMetricSource.scala b/spark/ingestion/src/main/scala/org/apache/spark/metrics/source/RedisSinkMetricSource.scala index bc4747828ee..4d122cd6bf4 100644 --- a/spark/ingestion/src/main/scala/org/apache/spark/metrics/source/RedisSinkMetricSource.scala +++ b/spark/ingestion/src/main/scala/org/apache/spark/metrics/source/RedisSinkMetricSource.scala @@ -32,7 +32,7 @@ class RedisSinkMetricSource extends Source { private val executorId = sparkConfig.get("spark.executor.id", "") - private def nameWithLabels(name: String) = { + private def metricWithLabels(name: String) = { if (metricLabels.isEmpty) { name } else { @@ -40,11 +40,19 @@ class RedisSinkMetricSource extends Source { } } + private def counterWithLabels(name: String) = { + if (metricLabels.isEmpty) { + name + } else { + s"$name#$metricLabels" + } + } + val METRIC_TOTAL_ROWS_INSERTED = - metricRegistry.counter(nameWithLabels("feast_ingestion_feature_row_ingested_count")) + metricRegistry.counter(counterWithLabels("feast_ingestion_feature_row_ingested_count")) val METRIC_ROWS_LAG = - metricRegistry.histogram(nameWithLabels("feast_ingestion_feature_row_lag_ms")) + metricRegistry.histogram(metricWithLabels("feast_ingestion_feature_row_lag_ms")) } object RedisSinkMetricSource {