scrape
Scrapes all current metrics from the registry and encodes them in Prometheus text format.
This method is suspendable and safe to use in coroutine-based environments.
Example usage in a Ktor route:
get("/metrics") {
call.respondText(PrometheusExporter().scrape(), ContentType.Text.Plain)
}Content copied to clipboard
Return
A string containing the full Prometheus-formatted exposition of all collected metrics.
Parameters
withTimestamp
If true, includes timestamps in the output for each sample.