ExLLM.Infrastructure.CircuitBreaker.Metrics.PrometheusEndpoint (ex_llm v0.8.1)
View SourcePrometheus metrics endpoint for circuit breaker monitoring.
Provides HTTP endpoint for Prometheus to scrape circuit breaker metrics. Can be integrated with Phoenix applications or standalone HTTP servers.
Phoenix Integration
# In your router
defmodule MyAppWeb.Router do
use MyAppWeb, :router
pipeline :metrics do
plug :accepts, ["text"]
end
scope "/metrics" do
pipe_through :metrics
get "/circuit_breakers", ExLLM.CircuitBreaker.Metrics.PrometheusEndpoint, :metrics
end
end
Standalone Usage
# Start standalone HTTP server
ExLLM.CircuitBreaker.Metrics.PrometheusEndpoint.start_server(port: 9090)
Manual Export
# Get metrics as text
{:ok, metrics_text} = ExLLM.CircuitBreaker.Metrics.PrometheusEndpoint.export()
Summary
Functions
Export Prometheus metrics as text format.
Plug function for Phoenix/Cowboy integration.
Phoenix controller action for metrics endpoint.
Start standalone HTTP server for metrics endpoint.
Stop the standalone metrics server.
Functions
Export Prometheus metrics as text format.
Plug function for Phoenix/Cowboy integration.
Phoenix controller action for metrics endpoint.
Start standalone HTTP server for metrics endpoint.
Stop the standalone metrics server.