How to expose Prometheus metrics manually? #1074
-
Say I don't want to use NanoHTTP server and want to serve metrics using my "main" HTTP server. How could I do that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
In general, you would need to follow the steps outlined in #1079 's description, but this question has come up so often that I went ahead for a simpler solution that will go out with Kamon 2.3.2: Call kamon.prometheus {
# Enable or disable publishing the Prometheus scraping enpoint using a embedded server.
start-embedded-http-server = no
} Stay alert for the 2.3.2 release! |
Beta Was this translation helpful? Give feedback.
In general, you would need to follow the steps outlined in #1079 's description, but this question has come up so often that I went ahead for a simpler solution that will go out with Kamon 2.3.2:
Call
PrometheusReporter.latestScrapeData()
and you'll get back anOption[String]
. If the Prometheus reporter is running then the option will be defined and contain the latest scrape data, otherwise it wont. On top of that, you could disable the built-in HTTP server using this setting:Stay alert for the 2.3.2 release!