PrometheusEndpoint

org.llm4s.metrics.PrometheusEndpoint
See thePrometheusEndpoint companion object
final class PrometheusEndpoint

HTTP endpoint for exposing Prometheus metrics.

Wraps the Prometheus HTTPServer and provides lifecycle management. Use this to expose metrics at /metrics for Prometheus scraping.

Value parameters

port

Port the server is listening on

server

Underlying HTTP server

Attributes

Example
val registry = new PrometheusRegistry()
val metrics = new PrometheusMetrics(registry)
PrometheusEndpoint.start(9090, registry) match {
 case Right(endpoint) =>
   // Use `metrics` with LLM clients while Prometheus scrapes:
   // http://localhost:9090/metrics
   endpoint.stop()
 case Left(error) =>
   println(s"Failed to start Prometheus endpoint: ${error.message}")
}
Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def stop(): Unit

Stop the HTTP server.

Stop the HTTP server.

Safe to call multiple times.

Attributes

def url: String

Get the metrics endpoint URL.

Get the metrics endpoint URL.

Prometheus should scrape this URL, for example http://localhost:9090/metrics when the endpoint was started on port 9090.

Attributes

Concrete fields

val port: Int