简体   繁体   English

无法使用akka.actor.ActorContext创建肉桂指标,但是当我使用akka.actor.ActorSystem时,肉桂指标工作正常

[英]Unable to create cinnamon metrics with akka.actor.ActorContext but when I use akka.actor.ActorSystem, then cinnamon metrics works fine

I am unable to create cinnamon metrics with akka.actor.ActorContext :- 我无法使用akka.actor.ActorContext创建肉桂指标:-

val summaryStateUpdated: Rate = CinnamonMetrics(context).createRate("summaryStateUpdated")

Where context is akka.actor.ActorContext 其中上下文是akka.actor.ActorContext

but when I use akka.actor.ActorSystem , then cinnamon metrics works fine:- 但是当我使用akka.actor.ActorSystem时 ,肉桂指标工作正常:-

val summaryStateUpdated: Rate = CinnamonMetrics(actorSystem).createRate("summaryStateUpdated")

Where actorSystem is akka.actor.ActorSystem 其中actorSystem是akka.actor.ActorSystem

I am using 2.7.4 version of the cinnamon dependency. 我正在使用2.7.4版的肉桂依赖项。

addSbtPlugin("com.lightbend.cinnamon" % "sbt-cinnamon" % "2.7.4")

I am using 2.11.12 version of scala. 我正在使用Scala的2.11.12版本。

I think what you are trying to do is to do actor specific metrics. 我认为您正在尝试做的是针对演员的指标。

In order to do it you have to do the first line inside of an actor. 为了做到这一点,您必须在actor内执行第一行。

Here's an example https://developer.lightbend.com/docs/monitoring/2.7.x/extensions/custom.html#custom-metric-example 这是一个示例https://developer.lightbend.com/docs/monitoring/2.7.x/extensions/custom.html#custom-metric-example

check that the imported dependencies match the example. 检查导入的依赖项是否与示例匹配。

In example it's custom metrics but you can do whatever you want inside your actor. 例如,它是自定义指标,但是您可以在actor中做任何您想做的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM