Skip to content

remove action version from scheduler metrics without kamon #5356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package org.apache.openwhisk.common
import java.io.PrintStream
import java.time.{Clock, Instant, ZoneId}
import java.time.format.DateTimeFormatter

import akka.event.Logging._
import akka.event.LoggingAdapter
import kamon.Kamon
Expand Down Expand Up @@ -372,20 +371,22 @@ object LoggingMarkers {
def SCHEDULER_NAMESPACE_INPROGRESS_CONTAINER(namespace: String) =
LogMarkerToken(scheduler, "namespaceInProgressContainer", counter, Some(namespace), Map("namespace" -> namespace))(
MeasurementUnit.none)
def SCHEDULER_ACTION_CONTAINER(namespace: String, action: String) =
def SCHEDULER_ACTION_CONTAINER(namespace: String, actionWithVersion: String, actionWithoutVersion: String) =
LogMarkerToken(
scheduler,
"actionContainer",
counter,
Some(action),
Map("namespace" -> namespace, "action" -> action))(MeasurementUnit.none)
def SCHEDULER_ACTION_INPROGRESS_CONTAINER(namespace: String, action: String) =
Some(actionWithoutVersion),
Map("namespace" -> namespace, "action" -> actionWithVersion))(MeasurementUnit.none)
def SCHEDULER_ACTION_INPROGRESS_CONTAINER(namespace: String,
actionWithVersion: String,
actionWithoutVersion: String) =
LogMarkerToken(
scheduler,
"actionInProgressContainer",
counter,
Some(action),
Map("namespace" -> namespace, "action" -> action))(MeasurementUnit.none)
Some(actionWithoutVersion),
Map("namespace" -> namespace, "action" -> actionWithVersion))(MeasurementUnit.none)

/*
* Controller related markers
Expand Down Expand Up @@ -593,8 +594,8 @@ object LoggingMarkers {
val SCHEDULER_KAFKA = LogMarkerToken(scheduler, kafka, start)(MeasurementUnit.time.milliseconds)
val SCHEDULER_KAFKA_WAIT_TIME =
LogMarkerToken(scheduler, "kafkaWaitTime", counter)(MeasurementUnit.time.milliseconds)
def SCHEDULER_WAIT_TIME(action: String) =
LogMarkerToken(scheduler, "waitTime", counter, Some(action), Map("action" -> action))(
def SCHEDULER_WAIT_TIME(actionWithVersion: String, actionWithoutVersion: String) =
LogMarkerToken(scheduler, "waitTime", counter, Some(actionWithoutVersion), Map("action" -> actionWithVersion))(
MeasurementUnit.time.milliseconds)

def SCHEDULER_KEEP_ALIVE(leaseId: Long) =
Expand All @@ -604,8 +605,13 @@ object LoggingMarkers {
def SCHEDULER_QUEUE_RECOVER = LogMarkerToken(scheduler, "queueRecover", start)(MeasurementUnit.time.milliseconds)
def SCHEDULER_QUEUE_UPDATE(reason: String) =
LogMarkerToken(scheduler, "queueUpdate", counter, None, Map("reason" -> reason))(MeasurementUnit.none)
def SCHEDULER_QUEUE_WAITING_ACTIVATION(action: String) =
LogMarkerToken(scheduler, "queueActivation", counter, Some(action), Map("action" -> action))(MeasurementUnit.none)
def SCHEDULER_QUEUE_WAITING_ACTIVATION(namespace: String, actionWithVersion: String, actionWithoutVersion: String) =
LogMarkerToken(
scheduler,
"queueActivation",
counter,
Some(actionWithoutVersion),
Map("namespace" -> namespace, "action" -> actionWithVersion))(MeasurementUnit.none)

/*
* General markers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected[core] case class FullyQualifiedEntityName(path: EntityPath,
def namespace: EntityName = path.root
def qualifiedNameWithLeadingSlash: String = EntityPath.PATHSEP + qualifiedName
def asString = path.addPath(name) + version.map("@" + _.toString).getOrElse("")
def toStringWithoutVersion = path.addPath(name).asString
def serialize = FullyQualifiedEntityName.serdes.write(this).compactPrint

override def size = qualifiedName.sizeInBytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ class MemoryQueue(private val etcdClient: EtcdClient,

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

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

MetricEmitter.emitGaugeMetric(
LoggingMarkers.SCHEDULER_ACTION_CONTAINER(invocationNamespace, action.asString),
LoggingMarkers.SCHEDULER_ACTION_CONTAINER(invocationNamespace, action.asString, action.toStringWithoutVersion),
containers.size)
MetricEmitter.emitGaugeMetric(
LoggingMarkers.SCHEDULER_ACTION_INPROGRESS_CONTAINER(invocationNamespace, action.asString),
LoggingMarkers
.SCHEDULER_ACTION_INPROGRESS_CONTAINER(invocationNamespace, action.asString, action.toStringWithoutVersion),
creationIds.size)
}

Expand Down Expand Up @@ -828,7 +830,7 @@ class MemoryQueue(private val etcdClient: EtcdClient,

val totalTimeInScheduler = Interval(activation.transid.meta.start, Instant.now()).duration
MetricEmitter.emitHistogramMetric(
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString),
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString, action.toStringWithoutVersion),
totalTimeInScheduler.toMillis)

val activationResponse =
Expand Down Expand Up @@ -1020,7 +1022,7 @@ class MemoryQueue(private val etcdClient: EtcdClient,
.map { res =>
val totalTimeInScheduler = Interval(msg.transid.meta.start, Instant.now()).duration
MetricEmitter.emitHistogramMetric(
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString),
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString, action.toStringWithoutVersion),
totalTimeInScheduler.toMillis)
res.trySuccess(Right(msg))
in.decrementAndGet()
Expand All @@ -1045,7 +1047,7 @@ class MemoryQueue(private val etcdClient: EtcdClient,
msg.transid)
val totalTimeInScheduler = Interval(msg.transid.meta.start, Instant.now()).duration
MetricEmitter.emitHistogramMetric(
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString),
LoggingMarkers.SCHEDULER_WAIT_TIME(action.asString, action.toStringWithoutVersion),
totalTimeInScheduler.toMillis)

sender ! GetActivationResponse(Right(msg))
Expand Down