Skip to content

Commit 2a33a03

Browse files
bdoyle0182Brendan Doyle
authored andcommitted
remove action version from scheduler metrics without kamon (apache#5356)
* remove action version from scheduler metrics without kamon * scalafmt --------- Co-authored-by: Brendan Doyle <[email protected]> (cherry picked from commit 96ff327)
1 parent 3156940 commit 2a33a03

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

common/scala/src/main/scala/org/apache/openwhisk/common/Logging.scala

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package org.apache.openwhisk.common
2020
import java.io.PrintStream
2121
import java.time.{Clock, Instant, ZoneId}
2222
import java.time.format.DateTimeFormatter
23-
2423
import akka.event.Logging._
2524
import akka.event.LoggingAdapter
2625
import kamon.Kamon
@@ -372,20 +371,22 @@ object LoggingMarkers {
372371
def SCHEDULER_NAMESPACE_INPROGRESS_CONTAINER(namespace: String) =
373372
LogMarkerToken(scheduler, "namespaceInProgressContainer", counter, Some(namespace), Map("namespace" -> namespace))(
374373
MeasurementUnit.none)
375-
def SCHEDULER_ACTION_CONTAINER(namespace: String, action: String) =
374+
def SCHEDULER_ACTION_CONTAINER(namespace: String, actionWithVersion: String, actionWithoutVersion: String) =
376375
LogMarkerToken(
377376
scheduler,
378377
"actionContainer",
379378
counter,
380-
Some(action),
381-
Map("namespace" -> namespace, "action" -> action))(MeasurementUnit.none)
382-
def SCHEDULER_ACTION_INPROGRESS_CONTAINER(namespace: String, action: String) =
379+
Some(actionWithoutVersion),
380+
Map("namespace" -> namespace, "action" -> actionWithVersion))(MeasurementUnit.none)
381+
def SCHEDULER_ACTION_INPROGRESS_CONTAINER(namespace: String,
382+
actionWithVersion: String,
383+
actionWithoutVersion: String) =
383384
LogMarkerToken(
384385
scheduler,
385386
"actionInProgressContainer",
386387
counter,
387-
Some(action),
388-
Map("namespace" -> namespace, "action" -> action))(MeasurementUnit.none)
388+
Some(actionWithoutVersion),
389+
Map("namespace" -> namespace, "action" -> actionWithVersion))(MeasurementUnit.none)
389390

390391
/*
391392
* Controller related markers
@@ -593,8 +594,8 @@ object LoggingMarkers {
593594
val SCHEDULER_KAFKA = LogMarkerToken(scheduler, kafka, start)(MeasurementUnit.time.milliseconds)
594595
val SCHEDULER_KAFKA_WAIT_TIME =
595596
LogMarkerToken(scheduler, "kafkaWaitTime", counter)(MeasurementUnit.time.milliseconds)
596-
def SCHEDULER_WAIT_TIME(action: String) =
597-
LogMarkerToken(scheduler, "waitTime", counter, Some(action), Map("action" -> action))(
597+
def SCHEDULER_WAIT_TIME(actionWithVersion: String, actionWithoutVersion: String) =
598+
LogMarkerToken(scheduler, "waitTime", counter, Some(actionWithoutVersion), Map("action" -> actionWithVersion))(
598599
MeasurementUnit.time.milliseconds)
599600

600601
def SCHEDULER_KEEP_ALIVE(leaseId: Long) =
@@ -604,8 +605,13 @@ object LoggingMarkers {
604605
def SCHEDULER_QUEUE_RECOVER = LogMarkerToken(scheduler, "queueRecover", start)(MeasurementUnit.time.milliseconds)
605606
def SCHEDULER_QUEUE_UPDATE(reason: String) =
606607
LogMarkerToken(scheduler, "queueUpdate", counter, None, Map("reason" -> reason))(MeasurementUnit.none)
607-
def SCHEDULER_QUEUE_WAITING_ACTIVATION(action: String) =
608-
LogMarkerToken(scheduler, "queueActivation", counter, Some(action), Map("action" -> action))(MeasurementUnit.none)
608+
def SCHEDULER_QUEUE_WAITING_ACTIVATION(namespace: String, actionWithVersion: String, actionWithoutVersion: String) =
609+
LogMarkerToken(
610+
scheduler,
611+
"queueActivation",
612+
counter,
613+
Some(actionWithoutVersion),
614+
Map("namespace" -> namespace, "action" -> actionWithVersion))(MeasurementUnit.none)
609615

610616
/*
611617
* General markers

common/scala/src/main/scala/org/apache/openwhisk/core/entity/FullyQualifiedEntityName.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ protected[core] case class FullyQualifiedEntityName(path: EntityPath,
5656
def namespace: EntityName = path.root
5757
def qualifiedNameWithLeadingSlash: String = EntityPath.PATHSEP + qualifiedName
5858
def asString = path.addPath(name) + version.map("@" + _.toString).getOrElse("")
59+
def toStringWithoutVersion = path.addPath(name).asString
5960
def serialize = FullyQualifiedEntityName.serdes.write(this).compactPrint
6061

6162
override def size = qualifiedName.sizeInBytes

core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/MemoryQueue.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ class MemoryQueue(private val etcdClient: EtcdClient,
181181

182182
private val logScheduler: Cancellable = context.system.scheduler.scheduleWithFixedDelay(0.seconds, 1.seconds) { () =>
183183
MetricEmitter.emitGaugeMetric(
184-
LoggingMarkers.SCHEDULER_QUEUE_WAITING_ACTIVATION(s"$invocationNamespace/$action"),
184+
LoggingMarkers
185+
.SCHEDULER_QUEUE_WAITING_ACTIVATION(invocationNamespace, action.asString, action.toStringWithoutVersion),
185186
queue.size)
186187

187188
MetricEmitter.emitGaugeMetric(
@@ -192,10 +193,11 @@ class MemoryQueue(private val etcdClient: EtcdClient,
192193
namespaceContainerCount.inProgressContainerNumByNamespace)
193194

194195
MetricEmitter.emitGaugeMetric(
195-
LoggingMarkers.SCHEDULER_ACTION_CONTAINER(invocationNamespace, action.asString),
196+
LoggingMarkers.SCHEDULER_ACTION_CONTAINER(invocationNamespace, action.asString, action.toStringWithoutVersion),
196197
containers.size)
197198
MetricEmitter.emitGaugeMetric(
198-
LoggingMarkers.SCHEDULER_ACTION_INPROGRESS_CONTAINER(invocationNamespace, action.asString),
199+
LoggingMarkers
200+
.SCHEDULER_ACTION_INPROGRESS_CONTAINER(invocationNamespace, action.asString, action.toStringWithoutVersion),
199201
creationIds.size)
200202
}
201203

@@ -828,7 +830,7 @@ class MemoryQueue(private val etcdClient: EtcdClient,
828830

829831
val totalTimeInScheduler = Interval(activation.transid.meta.start, Instant.now()).duration
830832
MetricEmitter.emitHistogramMetric(
831-
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString),
833+
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString, action.toStringWithoutVersion),
832834
totalTimeInScheduler.toMillis)
833835

834836
val activationResponse =
@@ -1020,7 +1022,7 @@ class MemoryQueue(private val etcdClient: EtcdClient,
10201022
.map { res =>
10211023
val totalTimeInScheduler = Interval(msg.transid.meta.start, Instant.now()).duration
10221024
MetricEmitter.emitHistogramMetric(
1023-
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString),
1025+
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString, action.toStringWithoutVersion),
10241026
totalTimeInScheduler.toMillis)
10251027
res.trySuccess(Right(msg))
10261028
in.decrementAndGet()
@@ -1045,7 +1047,7 @@ class MemoryQueue(private val etcdClient: EtcdClient,
10451047
msg.transid)
10461048
val totalTimeInScheduler = Interval(msg.transid.meta.start, Instant.now()).duration
10471049
MetricEmitter.emitHistogramMetric(
1048-
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString),
1050+
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString, action.toStringWithoutVersion),
10491051
totalTimeInScheduler.toMillis)
10501052

10511053
sender ! GetActivationResponse(Right(msg))

0 commit comments

Comments
 (0)