1

I have web service which is built using scala-play(version 2.5.12) framework. Trying to capture metrics using kamon and prometheus.

Below is the code snippet which i have done so far.

Dependencies:

"io.kamon" %% "kamon-play-2.5" % "1.1.0",
"io.kamon" %% "kamon-core" % "1.1.0",
"org.aspectj" % "aspectjweaver" % "1.9.2",
"io.kamon" %% "kamon-prometheus" % "1.1.1"

conf/application.conf

kamon {
  metric {
    tick-interval = 1 second
  }

  metric {
    filters {
      trace.includes = [ "**" ]
      akka-dispatcher.includes = [ "**" ]
    }
  }

  modules {
    kamon-log-reporter.auto-start = no
  }
}

I have initialized the kamon reporter in one of my config file.

import kamon.Kamon
import kamon.prometheus.PrometheusReporter  

Kamon.addReporter( new PrometheusReporter() )

I am adding tracing in one of my controller

import kamon.play.action.OperationName

override def test(userName: Option[String]): Action[JsValue] = OperationName("test-access")  {
    Action.async(parse.json) {
      ......
    }
  }

I am building the jar and running in local with below command

/bin/example-app -J-javaagent:./lib/org.aspectj.aspectjweaver-1.9.2.jar -Dorg.aspectj.tracing.factory=default

Application is running and i can see in the logs that reporter has started. Below is the log

2018-12-07 12:06:20,556 level=[INFO] logger=[kamon.prometheus.PrometheusReporter] thread=[kamon.prometheus.PrometheusReporter] rid=[] user=[] message=[Started the embedded HTTP server on http://0.0.0.0:9095]

But I don't see anything in http://localhost:9095/metrics. It is empty.

There is no error and unable to debug this. Is there anything i am missing here?

Vijay Sali
  • 1,030
  • 2
  • 14
  • 32

1 Answers1

0

Documentation says that the metrics are exposed at http://localhost:9095/. There is no metrics endpoint.

lisak
  • 21,611
  • 40
  • 152
  • 243
  • I have tried with this as well. It did not work. Thanks for the response. – Vijay Sali Jan 04 '19 at 12:42
  • if you specify target as 'localhost:9095', prometheus will query http://localhost:9095/metrics (Prometheus agent will respond on on any path like http://localhost:9095/hello or http://localhost:9095/anything-else ). So your statement is incorrect, prometheus has 'metrics' endpoint. – Jeriho Aug 22 '19 at 15:50