Akka - 如何检查邮件在收件箱中的时长?

mpr*_*mpr 5 scala akka

如何检查akka收件箱中的邮件有多长?如果邮件在收件箱中的时间太长,我想发一条日志消息.就像是:

override def receive: Receive = {
   case Message =>
      val timeInInbox = ...
      if (timeInInbox > treshold) log.warn("bla bla bla the doom is coming")
Run Code Online (Sandbox Code Playgroud)

lut*_*tzh 3

有可用的指标/遥测库可以提供此信息。一个是kamon.io(开源),它为您提供“邮箱中的时间”指标,请参阅http://kamon.io/documentation/kamon-akka/0.6.6/actor-router-and-dispatcher-指标/

另一种(非免费、闭源)是“ Lightbend Telemetry ”,它称之为“邮箱时间”,请参阅http://developer.lightbend.com/docs/monitoring/latest/instrumentations/akka/akka.html#actor -指标