Sub topic 13
Monitoring and troubleshooting an endpoint
This chapter assumes you can already create an endpoint and send it a request, as covered earlier in the tutorial. You should also be comfortable reading HTTP status codes and basic Python. The goal is a repeatable way to answer two questions. Is the endpoint healthy? If a request fails, where is the cause?
Where to look
A serving endpoint exposes several sources of information. Each answers a different question.
| Source | Where | Answers |
|---|---|---|
| Endpoint state | Serving page, or the SDK | Is the endpoint ready? Is an update running or has it failed? |
| Metrics | Metrics tab of the endpoint | How many requests arrive, how fast they complete, and how many fail? CPU and memory use are shown too. |
| Build logs | Logs tab | Did the model container build? Were its dependencies installed? |
| Service logs | Logs tab | What did the model print or raise while handling requests? |
| Events | Events tab | What changed on the endpoint, and when? |
Start with state and metrics to see the symptom. Then use logs to find the cause.
Reading state from code
The same state shown in the UI is available through the Databricks SDK. This helps in scripts and deployment checks.
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
name = "iris-endpoint"
endpoint = w.serving_endpoints.get(name=name)
print("ready:", endpoint.state.ready)
print("config update:", endpoint.state.config_update)
served_name = endpoint.config.served_entities[0].name
build = w.serving_endpoints.build_logs(name=name, served_model_name=served_name)
print(build.logs)
service = w.serving_endpoints.logs(name=name, served_model_name=served_name)
print(service.logs)state.ready tells you whether the endpoint can take traffic. state.config_update tells you whether a change is in progress or failed. Logs are fetched per served entity, so you pass its name, which you can read from the endpoint's configuration.
A triage path
Most problems fall into one of three groups: the endpoint never became ready, the request was rejected, or the model failed while scoring.
Common failures
- Endpoint not ready after creation or update. Open the build logs. Typical causes are a dependency that cannot be installed or a model that fails when loaded. If an update fails, the endpoint keeps serving its previous configuration, so you can fix the problem without an outage.
- 401 or 403. The token is missing, expired, or belongs to an identity without permission to query the endpoint. Check the
Authorizationheader first. Then check that the caller has permission on the endpoint. - 404. The URL or endpoint name is wrong. Compare the path
/serving-endpoints/<name>/invocationswith the name shown on the endpoint page. - 400. The payload does not match what the model expects. Compare your column names, their order, and the data types with the model signature. A missing column or a string where a number is expected is the usual cause.
- 500-level errors. The model code raised an exception, or the endpoint is short of resources. Read the service logs for the stack trace. Then check CPU and memory in the metrics.
- Slow first request after idle time. If scale to zero is enabled, the first request after a quiet period waits for compute to start. This is expected. If it is unacceptable for your use case, turn scale to zero off or send a warm-up request.
Watching trends
Metrics show problems before users report them. Watch these:
- Error rate. A rise right after an update points to the new version.
- Latency. A steady climb usually means too little compute for the traffic, so consider a larger workload size.
- CPU and memory. Sustained high use means the model is close to its limits.
Compare the Events tab with the metrics. If errors start at the moment an update finished, roll back by pointing the endpoint at the previous model version.
Exercise
After you update an endpoint to a new model version, every request returns a 400 error. The old version worked with the same requests. Which two things do you check first?
Show answer
Check the signature of the new model version against your request payload, because the new version may expect different columns or types. Then check the service logs for the validation message. If the new version is wrong, update the endpoint back to the previous version.