Observability API
The Observability API gives your code the telemetry behind your fleets and clusters: metrics, logs, and your Managed Kubernetes clusters' Kubernetes audit trail. Results are always scoped to your organization. You never pass an organization ID, and a cluster outside your organization is refused.
What you can do
| Capability | How | Guide |
|---|---|---|
| Query metrics for one cluster or your whole organization: GPUs, nodes, Kubernetes workloads, storage, and hardware | PromQL, instant or over a time range | Metrics |
| Follow metrics live as they change | Python SDK watch |
Streaming metrics |
| Search a cluster's logs | LogsQL over a time range | Logs |
| Follow a cluster's logs live | Python SDK tail |
Tailing logs |
| Answer "who did what to this cluster, and when?" for up to 365 days | Asynchronous queries over the Kubernetes audit log | Kubernetes audit |
| List your clusters, the endpoint that serves each, and whether its metrics and logs are ready | GET /v1/clusters |
Find your clusters |
Queries are standard PromQL and LogsQL, sent as you write them, and metrics results use the Prometheus result format. Existing tools and queries carry over.
Access
The Observability API is used with an Application Principal: the same client ID and secret you use for the rest of the API. Each capability is a separate permission:
| Permission | Allows |
|---|---|
| Metrics read | Metrics queries and watch |
| Logs read | Log queries and tail |
| Kubernetes audit read | Kubernetes audit queries. Metrics and logs permissions never include it. |
Lightning AI sets these when the Application Principal is provisioned. Contact support to enable the Observability API for your organization or to change an Application Principal's permissions. A request without the permission it needs returns 403 Forbidden.
Endpoint and tokens
| Endpoint | https://observatory.voltagepark.com |
| Token | An access token for the audience https://observatory.voltagepark.com. Tokens for the regional API endpoints don't work here, and tokens for this endpoint don't work on the regional API. |
| API reference | https://observatory.voltagepark.com/openapi.json (OpenAPI 3) |
Python SDK
The Python SDK gets and refreshes the Observability API token itself, from the same VPCLOUD_CLIENT_ID and VPCLOUD_CLIENT_SECRET it uses for the rest of the API. There's nothing more to configure.
import vpcloud_client
configuration = vpcloud_client.Configuration() # reads VPCLOUD_CLIENT_ID / VPCLOUD_CLIENT_SECRETREST API
The examples in this section use $OBS_URL and $OBS_TOKEN. To get a token from your Application Principal's credentials, use the Python SDK:
export OBS_URL=https://observatory.voltagepark.com
export OBS_TOKEN=$(python3 -c 'import vpcloud_client; print(vpcloud_client.Configuration().auth_settings(service="observatory")["bearerAuth"]["value"].split()[1])')Tokens are short-lived. Get a new one when a call returns 401 Unauthorized.
Find your clusters
Lists your organization's Managed Kubernetes clusters, the endpoint that serves each one's telemetry, and whether its metrics and logs can be queried yet. A cluster that was just created can take a few minutes to become ready.
Python SDK
with vpcloud_client.ApiClient(configuration) as api_client:
for cluster in vpcloud_client.ClustersApi(api_client).resolve_clusters().clusters or []:
print(cluster.cluster_id, cluster.site, cluster.endpoint, cluster.metrics_ready, cluster.logs_ready)REST API
curl "$OBS_URL/v1/clusters" -H "Authorization: Bearer $OBS_TOKEN"{
"clusters": [
{
"clusterId": "3f2c9a10-5b7e-4d1a-9c2e-8a6f1b0d4e21",
"site": "sea1",
"endpoint": "https://sea1.observatory.voltagepark.com",
"metricsReady": true,
"logsReady": true
}
]
}- Send a cluster's queries to its
endpoint. In the SDK, setConfiguration(observatory_host=cluster.endpoint). - A cluster query sent to another region's endpoint returns
400 Bad Requestwith the reasonmisdirected, and the right endpoint in theX-Observatory-Home-Endpointresponse header. Retry there. metricsReady: falseorlogsReady: falsemeans monitoring isn't set up for that cluster yet. Contact support to enable it.
Errors
Errors are a JSON body with a numeric code, a message, and details:
{"code": 7, "message": "missing audit read scope", "details": []}In the Python SDK, they raise vpcloud_client.rest.ApiException with status and this body. Streaming errors raise vpcloud_client.streaming.ConnectError, whose code is the name in the table, for example permission_denied.
| Status | code |
Meaning | What to do |
|---|---|---|---|
400 Bad Request |
3 (invalid_argument) |
The query, time range, or step is invalid. message says why. |
Fix the request. |
400 Bad Request |
9 (failed_precondition) |
The cluster is served by another endpoint (misdirected), or a Kubernetes audit precondition isn't met. |
Retry at the endpoint in X-Observatory-Home-Endpoint, or see Kubernetes audit. |
401 Unauthorized |
16 (unauthenticated) |
The token is missing, expired, or for another audience. | Get a new token for https://observatory.voltagepark.com. |
403 Forbidden |
7 (permission_denied) |
The Application Principal lacks the permission, or the cluster isn't in your organization. | Check the cluster ID with /v1/clusters, or contact support about permissions. |
429 Too Many Requests |
8 (resource_exhausted) |
Your organization's query limit was reached. | Retry with backoff, after Retry-After seconds when it's set. |
501 Not Implemented |
12 (unimplemented) |
The capability isn't available on this endpoint yet, for example organization-wide metrics or Kubernetes audit in some regions. | Contact support. |
503 Service Unavailable |
14 (unavailable) |
Temporarily unavailable. | Retry with backoff. |
Was this page helpful?
Thanks for the feedback.