diff options
author | Ivan Topolnak <itopolnak@despegar.com> | 2014-01-02 18:09:53 -0300 |
---|---|---|
committer | Ivan Topolnak <itopolnak@despegar.com> | 2014-01-13 17:37:20 -0300 |
commit | 7a10c0ef2a6566229e8571f6d385ca2ff794cc20 (patch) | |
tree | cecd7ce6eb7a71f967eaa1605615780fa94d346c /kamon-newrelic/src | |
parent | 54143e4af6182b967736abc60a7fb20c88dd6587 (diff) | |
download | Kamon-7a10c0ef2a6566229e8571f6d385ca2ff794cc20.tar.gz Kamon-7a10c0ef2a6566229e8571f6d385ca2ff794cc20.tar.bz2 Kamon-7a10c0ef2a6566229e8571f6d385ca2ff794cc20.zip |
integrate trace and metrics into the base project
Diffstat (limited to 'kamon-newrelic/src')
3 files changed, 13 insertions, 13 deletions
diff --git a/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala b/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala index f933bee4..668e29f7 100644 --- a/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala +++ b/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala @@ -27,13 +27,13 @@ class NewRelic extends ExtensionId[NewRelicExtension] { } class NewRelicExtension(system: ExtendedActorSystem) extends Kamon.Extension { - val manager: ActorRef = system.actorOf(Props[NewRelicManager], "kamon-newrelic") + val api: ActorRef = system.actorOf(Props[NewRelicManager], "kamon-newrelic") } class NewRelicManager extends Actor with ActorLogging { log.info("Registering the Kamon(NewRelic) extension") - Kamon(Trace)(context.system) ! Trace.Register + Kamon(Trace)(context.system).api ! Trace.Register val webTransactionMetrics = context.actorOf(Props[WebTransactionMetrics], "web-transaction-metrics") val agent = context.actorOf(Props[Agent], "agent") diff --git a/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelicErrorLogger.scala b/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelicErrorLogger.scala index c6d87769..ed787332 100644 --- a/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelicErrorLogger.scala +++ b/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelicErrorLogger.scala @@ -18,7 +18,7 @@ package kamon.newrelic import akka.actor.Actor import akka.event.Logging.Error import akka.event.Logging.{ LoggerInitialized, InitializeLogger } -import com.newrelic.api.agent.NewRelic +import com.newrelic.api.agent.{ NewRelic ⇒ NR } import kamon.trace.ContextAware class NewRelicErrorLogger extends Actor { @@ -36,6 +36,6 @@ class NewRelicErrorLogger extends Actor { params.put("UOW", c.uow) } - NewRelic.noticeError(error.cause, params) + NR.noticeError(error.cause, params) } } diff --git a/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelicReporting.scala b/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelicReporting.scala index 000e6286..4e3d0d8d 100644 --- a/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelicReporting.scala +++ b/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelicReporting.scala @@ -17,7 +17,7 @@ package kamon.newrelic import akka.actor.Actor import kamon.trace.UowTrace -import com.newrelic.api.agent.NewRelic +import com.newrelic.api.agent.{ NewRelic ⇒ NR } import kamon.trace.UowTracing.WebExternal class NewRelicReporting extends Actor { @@ -28,16 +28,16 @@ class NewRelicReporting extends Actor { def recordTransaction(uowTrace: UowTrace): Unit = { val time = ((uowTrace.segments.last.timestamp - uowTrace.segments.head.timestamp) / 1E9) - NewRelic.recordMetric("WebTransaction/Custom" + uowTrace.name, time.toFloat) - NewRelic.recordMetric("WebTransaction", time.toFloat) - NewRelic.recordMetric("HttpDispatcher", time.toFloat) + NR.recordMetric("WebTransaction/Custom" + uowTrace.name, time.toFloat) + NR.recordMetric("WebTransaction", time.toFloat) + NR.recordMetric("HttpDispatcher", time.toFloat) uowTrace.segments.collect { case we: WebExternal ⇒ we }.foreach { webExternalTrace ⇒ val external = ((webExternalTrace.finish - webExternalTrace.start) / 1E9).toFloat - NewRelic.recordMetric(s"External/${webExternalTrace.host}/http", external) - NewRelic.recordMetric(s"External/${webExternalTrace.host}/all", external) - NewRelic.recordMetric(s"External/${webExternalTrace.host}/http/WebTransaction/Custom" + uowTrace.name, external) + NR.recordMetric(s"External/${webExternalTrace.host}/http", external) + NR.recordMetric(s"External/${webExternalTrace.host}/all", external) + NR.recordMetric(s"External/${webExternalTrace.host}/http/WebTransaction/Custom" + uowTrace.name, external) } val allExternals = uowTrace.segments.collect { case we: WebExternal ⇒ we } sortBy (_.timestamp) @@ -53,8 +53,8 @@ class NewRelicReporting extends Actor { val external = measureExternal(0, 0, allExternals) / 1E9 - NewRelic.recordMetric(s"External/all", external.toFloat) - NewRelic.recordMetric(s"External/allWeb", external.toFloat) + NR.recordMetric(s"External/all", external.toFloat) + NR.recordMetric(s"External/allWeb", external.toFloat) } } |