@@ -21,7 +21,6 @@ import java.io.FileNotFoundException
21
21
import java .nio .file .Files
22
22
import java .nio .file .Paths
23
23
import java .util .concurrent .Semaphore
24
-
25
24
import akka .actor .ActorSystem
26
25
27
26
import scala .collection .concurrent .TrieMap
@@ -32,9 +31,10 @@ import scala.util.Failure
32
31
import scala .util .Success
33
32
import scala .util .Try
34
33
import akka .event .Logging .{ErrorLevel , InfoLevel }
34
+ import kamon .metric .MeasurementUnit
35
35
import pureconfig ._
36
36
import pureconfig .generic .auto ._
37
- import org .apache .openwhisk .common .{Logging , LoggingMarkers , MetricEmitter , TransactionId }
37
+ import org .apache .openwhisk .common .{LogMarkerToken , Logging , LoggingMarkers , MetricEmitter , TransactionId }
38
38
import org .apache .openwhisk .core .ConfigKeys
39
39
import org .apache .openwhisk .core .containerpool .ContainerId
40
40
import org .apache .openwhisk .core .containerpool .ContainerAddress
@@ -203,8 +203,15 @@ class DockerClient(dockerHost: Option[String] = None,
203
203
LoggingMarkers .INVOKER_DOCKER_CMD (args.head),
204
204
s " running ${cmd.mkString(" " )} (timeout: $timeout) " ,
205
205
logLevel = InfoLevel )
206
+ val t0 = System .currentTimeMillis()
206
207
executeProcess(cmd, timeout).andThen {
207
- case Success (_) => transid.finished(this , start)
208
+ case Success (_) =>
209
+ val t1 = System .currentTimeMillis()
210
+ MetricEmitter .emitHistogramMetric(
211
+ LogMarkerToken (" docker" , " runCmd" , " duration" , Some (args.head), Map (" cmd" -> args.head))(
212
+ MeasurementUnit .time.milliseconds),
213
+ t1 - t0)
214
+ transid.finished(this , start)
208
215
case Failure (pte : ProcessTimeoutException ) =>
209
216
transid.failed(this , start, pte.getMessage, ErrorLevel )
210
217
MetricEmitter .emitCounterMetric(LoggingMarkers .INVOKER_DOCKER_CMD_TIMEOUT (args.head))
0 commit comments