From e1d10e957a51284b032d11377d44edcfb53f8d06 Mon Sep 17 00:00:00 2001 From: simonredfern Date: Sat, 22 Nov 2025 21:48:33 +0100 Subject: [PATCH] using consumer_id UUID in metrics instead of primary key --- obp-api/src/main/scala/code/api/util/ApiSession.scala | 4 ++-- obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/obp-api/src/main/scala/code/api/util/ApiSession.scala b/obp-api/src/main/scala/code/api/util/ApiSession.scala index 71d60b9ec..a9ea2b5d5 100644 --- a/obp-api/src/main/scala/code/api/util/ApiSession.scala +++ b/obp-api/src/main/scala/code/api/util/ApiSession.scala @@ -120,7 +120,7 @@ case class CallContext( gatewayLoginResponseHeader = this.gatewayLoginResponseHeader, userId = this.user.map(_.userId).toOption, userName = this.user.map(_.name).toOption, - consumerId = this.consumer.map(_.id.get).toOption, + consumerId = this.consumer.map(_.consumerId.get).toOption, appName = this.consumer.map(_.name.get).toOption, developerEmail = this.consumer.map(_.developerEmail.get).toOption, spelling = this.spelling, @@ -192,7 +192,7 @@ case class CallContextLight(gatewayLoginRequestPayload: Option[PayloadOfJwtJSON] gatewayLoginResponseHeader: Option[String] = None, userId: Option[String] = None, userName: Option[String] = None, - consumerId: Option[Long] = None, + consumerId: Option[String] = None, appName: Option[String] = None, developerEmail: Option[String] = None, spelling: Option[String] = None, diff --git a/obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala b/obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala index a93e711de..c8a531a14 100644 --- a/obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala +++ b/obp-api/src/main/scala/code/api/util/WriteMetricUtil.scala @@ -58,7 +58,7 @@ object WriteMetricUtil extends MdcLoggable { //execute saveMetric in future, as we do not need to know result of the operation Future { - val consumerId = cc.consumerId.getOrElse(-1) + val consumerId = cc.consumerId.getOrElse("null") val appName = cc.appName.orNull val developerEmail = cc.developerEmail.orNull @@ -70,7 +70,7 @@ object WriteMetricUtil extends MdcLoggable { userName, appName, developerEmail, - consumerId.toString, + consumerId, implementedByPartialFunction, cc.implementedInVersion, cc.verb, @@ -142,7 +142,7 @@ object WriteMetricUtil extends MdcLoggable { val c: Consumer = consumer.orNull //The consumerId, not key - val consumerId = if (u != null) c.id.toString() else "null" + val consumerId = if (c != null) c.consumerId.get else "null" var appName = if (u != null) c.name.toString() else "null" var developerEmail = if (u != null) c.developerEmail.toString() else "null" val implementedByPartialFunction = rd match {