From 54e5f1c7bf9b4b04fd26822e4d1f53ef9f22251c Mon Sep 17 00:00:00 2001 From: Diego Date: Tue, 9 Sep 2014 00:58:03 -0300 Subject: = play: * remove from publishErrorMessage method * refactor onError method in RequestInstrumentation * refactor WSInstrumentation in order to propagate the TraceContext when a WS call is executed outside an Action * improve tests * closes #33 --- kamon-core/src/main/scala/kamon/Kamon.scala | 31 +++++++++------------- .../akka/ActorCellInstrumentation.scala | 2 +- .../scala/kamon/metric/RouterMetricsSpec.scala | 2 -- 3 files changed, 13 insertions(+), 22 deletions(-) (limited to 'kamon-core/src') diff --git a/kamon-core/src/main/scala/kamon/Kamon.scala b/kamon-core/src/main/scala/kamon/Kamon.scala index 24bbb5f0..dfebd3a5 100644 --- a/kamon-core/src/main/scala/kamon/Kamon.scala +++ b/kamon-core/src/main/scala/kamon/Kamon.scala @@ -1,30 +1,23 @@ -/* =================================================== - * Copyright © 2013 the kamon project +/* ========================================================================================= + * Copyright © 2013-2014 the kamon project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================== */ + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + * ========================================================================================= + */ package kamon import akka.actor._ -import akka.event.Logging.Error object Kamon { - trait Extension extends akka.actor.Extension { - def publishErrorMessage(system: ActorSystem, msg: String, cause: Throwable): Unit = { - system.eventStream.publish(new Error(cause, "", classOf[Extension], msg)) - } - } - + trait Extension extends akka.actor.Extension def apply[T <: Extension](key: ExtensionId[T])(implicit system: ActorSystem): T = key(system) } diff --git a/kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala index f6b68617..9b541a32 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala @@ -170,7 +170,7 @@ object ActorCellInstrumentation { implicit class PimpedActorCellMetrics(cell: ActorCellMetrics) { def onRoutedActorCell(block: ActorCellMetrics ⇒ Unit) = cell match { case routedActorCell: RoutedActorCell ⇒ block(cell) - case everyThingElse ⇒ + case everythingElse ⇒ } } } \ No newline at end of file diff --git a/kamon-core/src/test/scala/kamon/metric/RouterMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metric/RouterMetricsSpec.scala index 37b3d169..a012fba1 100644 --- a/kamon-core/src/test/scala/kamon/metric/RouterMetricsSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/RouterMetricsSpec.scala @@ -129,8 +129,6 @@ class RouterMetricsSpec extends TestKitBase with WordSpecLike with Matchers with } def createTestRouter(name: String): ActorRef = system.actorOf(RoundRobinPool(5).props(Props[RouterMetricsTestActor]), name) - - def takeSnapshotOf(amr: RouterMetricsRecorder): RouterMetricSnapshot = amr.collect(collectionContext) } } -- cgit v1.2.3