JVM Embed¶
For developers whose app runs on the JVM: the agent can run inside the app instead of as a separate process. It reads
the app's metrics registry in-process, so the app needs no /metrics endpoint and no port for the agent to scrape. Set
it up in code, or let the Ktor plugin or the Spring Boot starter start it with the app.
You Need a Proxy¶
The agent connects out to a proxy, and Prometheus scrapes the proxy, so start a proxy first. Each guide below tells the
agent where it is with a proxy setting, which its examples read from PROMETHEUS_PROXY.
-
The Quick Start's steps 1 and 2, Install and Start the Proxy, with a JAR, Homebrew, or Docker. Stop once the proxy is running and come back here: your app's agent takes the place of step 3's. The proxy takes agents on port 50051 and Prometheus's scrapes on 8080, so an app on the same machine sets
PROMETHEUS_PROXYtolocalhost:50051. -
The proxy's Docker image, with TLS and an agent token, which the agent then needs too.
-
Run a proxy for an app on a cloud platform
A proxy beside Prometheus on AWS, GCP, Azure, DigitalOcean, or Railway, for an app on ECS, Cloud Run, or Azure Container Apps.
Guides¶
-
When to embed the agent, and how: in code with
embeddedAgent { }, or from a config file, serving the app's metrics registry in-process. -
install(PrometheusProxyAgent)starts the agent with a Ktor app, stops it with the app, and serves the app's metrics registry. -
A dependency and a few properties start the agent with a Spring Boot app, serve its metrics, and report the agent's connection in Actuator's health.
API, Debugging, and Upgrading¶
-
The methods and types an app that embeds the agent calls, with what each takes, returns, and throws.
-
Where the agent logs, its admin and debug endpoints, its dashboard, and the proxy's view of it.
-
What each release since 4.0 changed for code that embeds the agent, and what to do about it.
Demos¶
Each runs on your laptop with make up, in Docker, with a guided tour.
-
A coffee shop, a Ktor app that runs the agent in-process through the Ktor plugin.
-
A roastery, a Spring Boot app in Java whose agent the starter starts from properties.
-
A bakery's ovens: workers with no framework or HTTP server, each running the agent from a few lines of its
main.