markusthoemmes commented on a change in pull request #2857: Emit metrics via
kamon
URL:
https://github.com/apache/incubator-openwhisk/pull/2857#discussion_r146548635
##########
File path: common/scala/src/main/scala/whisk/common/TransactionId.scala
##########
@@ -108,13 +141,27 @@ case class TransactionId private (meta:
TransactionMetadata) extends AnyVal {
*/
def failed(from: AnyRef, startMarker: StartMarker, message: String = "",
logLevel: LogLevel = WarningLevel)(
implicit logging: Logging) = {
+
val endMarker =
LogMarkerToken(startMarker.startMarker.component,
startMarker.startMarker.action, LoggingMarkers.error)
- logging.emit(
- logLevel,
- this,
- from,
- createMessageWithMarker(message, LogMarker(endMarker, deltaToStart,
Some(deltaToMarker(startMarker)))))
+
+ if (TransactionId.metricsLog) {
+ logging.emit(
+ logLevel,
+ this,
+ from,
+ createMessageWithMarker(message, LogMarker(endMarker, deltaToStart,
Some(deltaToMarker(startMarker)))))
+ } else {
+ if (message.nonEmpty) {
+ logging.emit(logLevel, this, from, message)
+ }
+ }
+
+ if (TransactionId.metricsKamon) {
+ val endTime = Instant.now(Clock.systemUTC)
+ val metricValue = deltaToMarker(startMarker, endTime)
Review comment:
`deltaToMarker` has a default parameter, already getting the correct endTime
for you. No need to explicitly get it again.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services