diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2015-05-09 13:38:24 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2015-05-09 13:38:24 +0200 |
commit | d69f14710b1d933d58412edd63b465b13a09a9d0 (patch) | |
tree | dca1a411e62776145784186168307e2ca201fd68 | |
parent | a4b1e5fe30a69323affb92e1da75ddafab54e31c (diff) | |
download | Kamon-d69f14710b1d933d58412edd63b465b13a09a9d0.tar.gz Kamon-d69f14710b1d933d58412edd63b465b13a09a9d0.tar.bz2 Kamon-d69f14710b1d933d58412edd63b465b13a09a9d0.zip |
= newrelic: fix scaling issues with web transaction metrics.
4 files changed, 10 insertions, 7 deletions
diff --git a/kamon-newrelic/src/main/resources/reference.conf b/kamon-newrelic/src/main/resources/reference.conf index 9dc793e1..de160105 100644 --- a/kamon-newrelic/src/main/resources/reference.conf +++ b/kamon-newrelic/src/main/resources/reference.conf @@ -12,7 +12,7 @@ kamon { app-name = "Kamon[Development]" # Your New Relic license key. - license-key = e7d350b14228f3d28f35bc3140df2c3e565ea5d5 + license-key = "<put-your-key-here>" # Time to wait for a response when calling any of the New Relic collector API methods. operation-timeout = 30 seconds diff --git a/kamon-newrelic/src/main/scala/kamon/newrelic/Agent.scala b/kamon-newrelic/src/main/scala/kamon/newrelic/Agent.scala index e65b2460..75f73ea4 100644 --- a/kamon-newrelic/src/main/scala/kamon/newrelic/Agent.scala +++ b/kamon-newrelic/src/main/scala/kamon/newrelic/Agent.scala @@ -130,9 +130,11 @@ object AgentSettings { // Name has the format of 'pid'@'host' val runtimeName = ManagementFactory.getRuntimeMXBean.getName.split('@') val newRelicConfig = config.getConfig("kamon.newrelic") + val licenseKey = newRelicConfig.getString("license-key") + assert(licenseKey != "<put-your-key-here>", "You forgot to include your New Relic license key in the configuration settings!") AgentSettings( - newRelicConfig.getString("license-key"), + licenseKey, newRelicConfig.getString("app-name"), runtimeName(1), runtimeName(0).toInt, diff --git a/kamon-newrelic/src/main/scala/kamon/newrelic/MetricReporter.scala b/kamon-newrelic/src/main/scala/kamon/newrelic/MetricReporter.scala index 7ee7d1e6..8de493b2 100644 --- a/kamon-newrelic/src/main/scala/kamon/newrelic/MetricReporter.scala +++ b/kamon-newrelic/src/main/scala/kamon/newrelic/MetricReporter.scala @@ -90,6 +90,7 @@ class MetricReporter(settings: AgentSettings) extends Actor with ActorLogging wi def subscribeToMetrics(): Unit = { metricsExtension.subscribe("trace", "*", metricsSubscriber, permanently = true) + metricsExtension.subscribe("trace-segment", "*", metricsSubscriber, permanently = true) metricsExtension.subscribe("user-metrics", "*", metricsSubscriber, permanently = true) } } diff --git a/kamon-newrelic/src/main/scala/kamon/newrelic/WebTransactionMetricExtractor.scala b/kamon-newrelic/src/main/scala/kamon/newrelic/WebTransactionMetricExtractor.scala index 76cf0757..7e057407 100644 --- a/kamon-newrelic/src/main/scala/kamon/newrelic/WebTransactionMetricExtractor.scala +++ b/kamon-newrelic/src/main/scala/kamon/newrelic/WebTransactionMetricExtractor.scala @@ -67,29 +67,29 @@ object WebTransactionMetricExtractor extends MetricExtractor { elapsedTime :: externalScopedByHostAndLibrarySnapshots.getOrElse((entity.name, library, trace), Nil)) } - val httpDispatcher = Metric(accumulatedHttpDispatcher, Time.Seconds, "HttpDispatcher", None) + val httpDispatcher = Metric(accumulatedHttpDispatcher, Time.Nanoseconds, "HttpDispatcher", None) val webTransaction = httpDispatcher.copy(MetricID("WebTransaction", None)) val webTransactionTotal = httpDispatcher.copy(MetricID("WebTransactionTotalTime", None)) - val externalAllWeb = Metric(accumulatedExternalServices, Time.Seconds, "External/allWeb", None) + val externalAllWeb = Metric(accumulatedExternalServices, Time.Nanoseconds, "External/allWeb", None) val externalAll = externalAllWeb.copy(MetricID("External/all", None)) val externalByHost = externalByHostSnapshots.map { case (host, snapshots) ⇒ val mergedSnapshots = snapshots.foldLeft(Histogram.Snapshot.empty)(_.merge(_, collectionContext)) - Metric(mergedSnapshots, Time.Seconds, s"External/$host/all", None) + Metric(mergedSnapshots, Time.Nanoseconds, s"External/$host/all", None) } val externalByHostAndLibrary = externalByHostAndLibrarySnapshots.map { case ((host, library), snapshots) ⇒ val mergedSnapshots = snapshots.foldLeft(Histogram.Snapshot.empty)(_.merge(_, collectionContext)) - Metric(mergedSnapshots, Time.Seconds, s"External/$host/$library", None) + Metric(mergedSnapshots, Time.Nanoseconds, s"External/$host/$library", None) } val externalScopedByHostAndLibrary = externalScopedByHostAndLibrarySnapshots.map { case ((host, library, traceName), snapshots) ⇒ val mergedSnapshots = snapshots.foldLeft(Histogram.Snapshot.empty)(_.merge(_, collectionContext)) - Metric(mergedSnapshots, Time.Seconds, s"External/$host/$library", Some("WebTransaction/Custom/" + traceName)) + Metric(mergedSnapshots, Time.Nanoseconds, s"External/$host/$library", Some("WebTransaction/Custom/" + traceName)) } Map(httpDispatcher, webTransaction, webTransactionTotal, externalAllWeb, externalAll, apdexBuilder.build) ++ |