feature/Change table name from MetricsArchive to MetricArchive

This commit is contained in:
Marko Milić 2023-01-26 09:43:54 +01:00
parent 4cd51aa12e
commit fc9284d118
3 changed files with 9 additions and 9 deletions

View File

@ -93,7 +93,7 @@ import code.metadata.tags.MappedTag
import code.metadata.transactionimages.MappedTransactionImage
import code.metadata.wheretags.MappedWhereTag
import code.methodrouting.MethodRouting
import code.metrics.{MappedConnectorMetric, MappedMetric, MetricsArchive}
import code.metrics.{MappedConnectorMetric, MappedMetric, MetricArchive}
import code.migration.MigrationScriptLog
import code.model.dataAccess._
import code.model.dataAccess.internalMapping.AccountIdMapping
@ -955,7 +955,7 @@ object ToSchemify {
MappedTransactionRequest,
TransactionRequestAttribute,
MappedMetric,
MetricsArchive,
MetricArchive,
MapperAccountHolders,
MappedEntitlement,
MappedConnectorMetric,

View File

@ -65,7 +65,7 @@ object MappedMetrics extends APIMetrics with MdcLoggable{
metric.save
}
override def saveMetricsArchive(primaryKey: Long, userId: String, url: String, date: Date, duration: Long, userName: String, appName: String, developerEmail: String, consumerId: String, implementedByPartialFunction: String, implementedInVersion: String, verb: String, httpCode: Option[Int], correlationId: String): Unit = {
val metric = MetricsArchive.find(By(MetricsArchive.id, primaryKey)).getOrElse(MetricsArchive.create)
val metric = MetricArchive.find(By(MetricArchive.id, primaryKey)).getOrElse(MetricArchive.create)
metric
.metricId(primaryKey)
.userId(userId)
@ -548,8 +548,8 @@ object MappedMetric extends MappedMetric with LongKeyedMetaMapper[MappedMetric]
}
class MetricsArchive extends APIMetric with LongKeyedMapper[MetricsArchive] with IdPK {
override def getSingleton = MetricsArchive
class MetricArchive extends APIMetric with LongKeyedMapper[MetricArchive] with IdPK {
override def getSingleton = MetricArchive
object metricId extends MappedLong(this)
object userId extends UUIDString(this)
@ -589,7 +589,7 @@ class MetricsArchive extends APIMetric with LongKeyedMapper[MetricsArchive] with
override def getHttpCode(): Int = httpCode.get
override def getCorrelationId(): String = correlationId.get
}
object MetricsArchive extends MetricsArchive with LongKeyedMetaMapper[MetricsArchive] {
object MetricArchive extends MetricArchive with LongKeyedMetaMapper[MetricArchive] {
override def dbIndexes =
Index(userId) :: Index(consumerId) :: Index(url) :: Index(date) :: Index(userName) ::
Index(appName) :: Index(developerEmail) :: super.dbIndexes

View File

@ -5,7 +5,7 @@ import java.util.{Calendar, Date}
import code.actorsystem.ObpLookupSystem
import code.api.util.{APIUtil, OBPToDate}
import code.metrics.{APIMetric, APIMetrics, MappedMetric, MetricsArchive}
import code.metrics.{APIMetric, APIMetrics, MappedMetric, MetricArchive}
import code.util.Helper.MdcLoggable
import net.liftweb.common.Full
import net.liftweb.mapper.{By, By_<=}
@ -42,7 +42,7 @@ object MetricsArchiveScheduler extends MdcLoggable {
}
val someYearsAgo: Date = new Date(currentTime.getTime - (oneDayInMillis * days))
// Delete the outdated rows from the table "MetricsArchive"
MetricsArchive.bulkDelete_!!(By_<=(MetricsArchive.date, someYearsAgo))
MetricArchive.bulkDelete_!!(By_<=(MetricArchive.date, someYearsAgo))
}
def conditionalDeleteMetricsRow() = {
@ -60,7 +60,7 @@ object MetricsArchiveScheduler extends MdcLoggable {
}
val maybeDeletedRows: List[(Boolean, Long)] = canditateMetricRowsToMove map { i =>
// and delete it after successful coping
MetricsArchive.find(By(MetricsArchive.metricId, i.getMetricId())) match {
MetricArchive.find(By(MetricArchive.metricId, i.getMetricId())) match {
case Full(_) => (MappedMetric.bulkDelete_!!(By(MappedMetric.id, i.getMetricId())), i.getMetricId())
case _ => (false, i.getMetricId())
}