Expose a Prometheus endpoint
If you deploy a custom server, add a route that returns your metrics in Prometheus format. For example, a/metrics route is available through this Baseten endpoint:
URL
Authorization header with the Bearer scheme. A workspace-export-metrics key only authorizes the organization metrics endpoint, so don’t use it for this route.
Check the route with the Baseten CLI before you configure a collector:
Push metrics with OpenTelemetry
You can also instrument your model server with an OpenTelemetry SDK and push metrics to an OTLP endpoint. The exporter sends each batch to your collector or observability provider. To configure push-based export:- Add the OpenTelemetry metrics SDK and an OTLP exporter for your language.
- Create counters, histograms, or gauges for the application behavior you want to measure.
- Configure the exporter with your provider’s OTLP endpoint and authentication settings.
- Store provider credentials as Baseten secrets, not in your model code or configuration.
- For a custom server, add the Baseten-provided
BT_MODEL_IDandBT_MODEL_DEPLOYMENT_IDvalues as resource attributes so you can filter metrics by model and deployment.