/prometheus-proxy:prometheus-proxyfrom prometheus-proxy
Builds apps and deployments using Prometheus Proxy, which enables Prometheus to scrape metrics endpoints behind a firewall via an outbound gRPC connection between a proxy and agent. Covers embedded agents (Ktor, Spring Boot), standalone agents, HOCON config, Docker/Helm deployment, and scrape config debugging.
Ships in prometheus-proxy. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Prometheus scrapes the proxy, which runs outside the firewall beside Prometheus, on its scrape port (8080), at one path per target. The proxy passes each scrape to the agent that registered the path, over the gRPC connection the agent opened to the proxy's agent port (50051). The agent, inside the firewall, scrapes the path's target, or reads an app's metrics registry in-process, and sends the result back. The agent needs only outbound access to the proxy.
The proxy always runs on its own. The agent runs on its own, or embedded in a JVM app. These instructions are for
release 4.8.0, com.pambrose:prometheus-proxy:4.8.0.
| The app or service | Run | Its settings |
|---|---|---|
| Any service, in any language | A standalone agent: prometheus-agent.jar, the pambrose/prometheus-agent:4.8.0 image, or the Helm chart | A HOCON config file of agent.pathConfigs, options, and variables |
| A JVM app without Ktor or Spring Boot | The embedded agent, com.pambrose:prometheus-proxy:4.8.0: embeddedAgent { } in Kotlin, EmbeddedAgentConfig.builder() in Java | The builder's typed methods and fromEnvironment() |
| A Ktor app | The Ktor plugin, com.pambrose:prometheus-proxy-ktor:4.8.0: install(PrometheusProxyAgent) | prometheus-proxy.agent in the app's config file, and the install block |
| A Spring Boot app | The Spring Boot starter, com.pambrose:prometheus-proxy-spring-boot-starter:4.8.0 | The prometheus-proxy.agent.* properties, and a customizer bean |
Embed the agent in an app you build and deploy yourself, when it has nothing else to deploy beside it, can't open a metrics port, or should keep its secrets in code. Run a standalone agent when one agent scrapes several services, the app isn't on the JVM, or the agent should upgrade apart from the app.
Then read references/embedding.md for an embedded agent, or references/standalone.md for a standalone agent and the proxy. When a scrape fails, read references/troubleshooting.md.
setting(key, value), whose keys aren't checked.kotlin-coroutines.version property to 1.11.0 and prometheus-client.version to 1.10.0,
since their dependency management sets both lower; Spring Boot 4.2 or later needs neither.my_app_metrics, with no / inside it, and no whitespace, control character,
?, or #: the proxy refuses such a path, and the agent refuses to start with one in its pathConfigs. Give each
app, and each replica that should be its own target, a path of its own: a second agent of the same identity that
registers a path takes it over, unless both set agent.consolidated = true, when the proxy scrapes each and joins
their results.metrics_path is the path, with one
leading slash. With the proxy's service discovery on, one http_sd_configs job finds every path. Scrape a pair of
proxies for failover with static_configs, never http_sd_configs.fromEnvironment() reads
PROMETHEUS_PROXY, PROMETHEUS_AGENT_TOKEN, PROMETHEUS_PROXY_CERT, and PROMETHEUS_PROXY_AUTHORITY. A standalone
agent or proxy reads its token from AGENT_TOKEN, and its TLS material from files or from CERT_CHAIN_PEM,
PRIVATE_KEY_PEM, and TRUST_CERT_COLLECTION_PEM.AGENT_TOKEN and PROXY_HOSTNAME, which
take precedence over its settings, and PROXY_HOSTNAME alone starts it. Don't give the app's own variables those
names.startIfConfigured() returns null, logging why, when no proxy is
set or the start fails, so the app runs on without it; start() throws when the start fails. Close the
EmbeddedAgentInfo it returns with the app: use { }, close(), or shutdown(). The Ktor plugin and the Spring
Boot starter do both for you.source(path, registry), or the plugin's or starter's registry, rather
than opening a /metrics port for the agent to scrape. Serve the agent's own metrics through the proxy with
agentMetricsAt(path), or agent.metrics.proxyPath in a standalone agent's config.pathConfigs are a JSON object in a string, as in labels: "{\"team\": \"web\"}".DASHBOARD_PASSWORD is set. Set one,
and put TLS in front, before exposing either dashboard.A Kotlin program with no HTTP server, serving its registry in-process. Without PROMETHEUS_PROXY it runs without the
agent:
import io.prometheus.agent.embeddedAgent
import io.prometheus.metrics.model.registry.PrometheusRegistry
// A worker with no HTTP server of its own: the agent reads its metrics from
// the registry, in-process, for each scrape, and serves its own beside them.
// Without PROMETHEUS_PROXY, as on a developer's machine, the worker runs
// without it.
fun runWorker(
version: String,
work: () -> Unit,
) {
embeddedAgent {
name = "worker-$version"
fromEnvironment()
// Where the worker's metrics are: Micrometer's PrometheusMeterRegistry
// gives its own as prometheusRegistry
source(
path = "worker_metrics",
registry = PrometheusRegistry.defaultRegistry,
)
// The agent's own, for the Agents dashboard
agentMetricsAt(path = "worker_agent_metrics")
}.startIfConfigured(logBanner = false).use { work() }
}
A Ktor app, with the plugin serving Micrometer's registry (agentHealth() is in
references/embedding.md):
fun Application.module() {
// Ktor's HTTP metrics and the JVM's, then the app's own, in one registry
val meterRegistry = PrometheusMeterRegistry(PrometheusConfig.DEFAULT)
install(MicrometerMetrics) { registry = meterRegistry }
install(PrometheusProxyAgent) {
// Served in-process, at the proxy's /my_app_metrics
registry = meterRegistry.prometheusRegistry
path = "my_app_metrics"
agent {
name = "my-app"
// PROMETHEUS_PROXY, PROMETHEUS_AGENT_TOKEN, and PROMETHEUS_PROXY_CERT. Without PROMETHEUS_PROXY, as on a
// developer's machine, the agent stays off
fromEnvironment()
}
}
routing {
agentHealth()
}
}
A Spring Boot app's application.yml. The starter serves the app's PrometheusRegistry bean at the app's name
followed by _metrics, here /roastery_metrics:
spring:
application:
name: roastery
prometheus-proxy:
agent:
# Unset, as on a developer's machine, the agent stays off
proxy: ${PROMETHEUS_PROXY:}
token: ${PROMETHEUS_AGENT_TOKEN:}
# The certificate the proxy's is signed with, and the name the proxy's certificate was issued to: without
# PROMETHEUS_PROXY_AUTHORITY, prometheus-proxy, as fromEnvironment() has it, the name Cloud Platforms issues it to
trust-certificate: ${PROMETHEUS_PROXY_CERT:}
authority: ${PROMETHEUS_PROXY_AUTHORITY:prometheus-proxy}
# How long the agent's stop may hold up the app's shutdown: inside the platform's window after SIGTERM, such as
# Cloud Run's 10 seconds
stop-timeout: 8s
A standalone agent's config file, scraping one endpoint:
agent {
proxy.hostname = "proxy-host.example.com"
pathConfigs: [
{
name: "My App metrics"
path: my_app_metrics
url: "http://localhost:9100/metrics"
}
]
}
Prometheus's scrape config for that path:
scrape_configs:
- job_name: 'my-app'
metrics_path: '/my_app_metrics'
static_configs:
- targets: ['proxy-host.example.com:8080']
Connected to proxy at localhost:50051 using plaintext, then Registered <target> as /<path> with labels {…} (static), the target in-process for a registry.
An embedded agent without a proxy logs No proxy is set, so the Prometheus agent stays off, or, from the Ktor
plugin or the Spring Boot starter, No proxy is set (prometheus-proxy.agent.proxy or PROXY_HOSTNAME).curl -i http://localhost:8080/my_app_metrics answers
200 with the metrics. On one machine, a Spring Boot or Ktor app's own port 8080 clashes with the proxy's scrape
port, so give the app another, such as SERVER_PORT=8081.EmbeddedAgentInfo.isConnected and proxyEndpoint give the agent's connection, for a health check
that never fails the app: a proxy that's away shouldn't take the app out of a load balancer.--dashboard, port 8094), the Paths view lists each path, its agent, and its last
scrapes.The documentation describes the latest release. Each page:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub pambrose/prometheus-proxy --plugin prometheus-proxyOther plugins' skills for the same job