diff options
Diffstat (limited to 'kamon-core/src/main/scala/kamon/newrelic')
-rw-r--r-- | kamon-core/src/main/scala/kamon/newrelic/NewRelicErrorLogger.scala | 18 | ||||
-rw-r--r-- | kamon-core/src/main/scala/kamon/newrelic/NewRelicReporting.scala | 52 |
2 files changed, 0 insertions, 70 deletions
diff --git a/kamon-core/src/main/scala/kamon/newrelic/NewRelicErrorLogger.scala b/kamon-core/src/main/scala/kamon/newrelic/NewRelicErrorLogger.scala deleted file mode 100644 index 4bc49496..00000000 --- a/kamon-core/src/main/scala/kamon/newrelic/NewRelicErrorLogger.scala +++ /dev/null @@ -1,18 +0,0 @@ -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 NewRelic.noticeError - -class NewRelicErrorLogger extends Actor { - def receive = { - case InitializeLogger(_) => sender ! LoggerInitialized - case error @ Error(cause, logSource, logClass, message) => notifyError(error) - } - - def notifyError(error: Error): Unit = { - noticeError(error.cause) - } -} diff --git a/kamon-core/src/main/scala/kamon/newrelic/NewRelicReporting.scala b/kamon-core/src/main/scala/kamon/newrelic/NewRelicReporting.scala deleted file mode 100644 index 106f27e2..00000000 --- a/kamon-core/src/main/scala/kamon/newrelic/NewRelicReporting.scala +++ /dev/null @@ -1,52 +0,0 @@ -package kamon.newrelic - -import akka.actor.Actor -import kamon.trace.UowTrace -import com.newrelic.api.agent.{Response, Request, Trace, NewRelic} -import kamon.trace.UowTracing.{WebExternal, WebExternalFinish, WebExternalStart} -import java.util -import java.util.Date - - -class NewRelicReporting extends Actor { - def receive = { - case trace: UowTrace => recordTransaction(trace) - } - - 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) - - uowTrace.segments.collect { case we: WebExternal => we }.foreach { webExternalTrace => - val external = ((webExternalTrace.finish - webExternalTrace.start)/1E9).toFloat - - println("Web External: " + webExternalTrace) - 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) - } - - - val allExternals = uowTrace.segments.collect { case we: WebExternal => we } sortBy(_.timestamp) - - - def measureExternal(accum: Long, lastEnd: Long, segments: Seq[WebExternal]): Long = segments match { - case Nil => accum - case head :: tail => - if(head.start > lastEnd) - measureExternal(accum + (head.finish-head.start), head.finish, tail) - else - measureExternal(accum + (head.finish-lastEnd), head.finish, tail) - } - - val external = measureExternal(0, 0, allExternals) / 1E9 - - - NewRelic.recordMetric(s"External/all", external.toFloat) - NewRelic.recordMetric(s"External/allWeb", external.toFloat) - - } -} |