prestodb/presto · error · PrestoException
PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR
PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR
Error message
Prometheus did no return metrics list (table names): %s
What it means
PrometheusClient.getTableNames calls the Prometheus /api/v1/label/__name__/values endpoint and inspects the returned status field. If the status is not "success" after handling error/warning cases, it throws a PrestoException with a custom function code PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR, reporting the status Prometheus returned.
Source
Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusClient.java:130
status = (String) tableSupplierStatus;
}
}
//TODO prometheus warnings (success|error|warning) could be handled separately
if (status.equals("success")) {
List<String> tableNames = (List<String>) tableSupplier.get().get("data");
if (tableNames == null) {
return ImmutableSet.of();
}
return ImmutableSet.copyOf(tableNames);
}
else {
if (status.equals("warning")) {
log.warn("Prometheus client gets a warning by retrieving table name from metric list");
}
}
}
throw new PrestoException(PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR, String.format("Prometheus did no return metrics list (table names): %s", status));
}
public PrometheusTable getTable(String schema, String tableName)
{
requireNonNull(schema, "schema is null");
requireNonNull(tableName, "tableName is null");
if (!schema.equals("default")) {
return null;
}
List<String> tableNames = (List<String>) tableSupplier.get().get("data");
if (tableNames == null) {
return null;
}
if (!tableNames.contains(tableName)) {
return null;
}
return new PrometheusTable(View on GitHub (pinned to 55bb57d202)
Solutions
- Verify prometheus-uri resolves to a real Prometheus: curl http://host:9090/api/v1/label/__name__/values and check the JSON status field
- Remove/inspect any auth proxy in front of Prometheus that may return non-JSON responses
- Check Prometheus server health/logs (/-/healthy) and restart if unhealthy
- Retry startup — checkServerReady tolerates transient unavailability only briefly; ensure Prometheus is up before Presto
- Confirm Prometheus API version compatibility with the connector
Example fix
// before prometheus-uri=http://monitoring:8080 # auth proxy, returns HTML // after prometheus-uri=http://prometheus:9090
Defensive patterns
Strategy: retry
Validate before calling
bash curl -fsS http://prometheus:9090/api/v1/label/__name__/values | jq -r '.status' # must print: success
Try / catch
java
try {
Set<String> tables = client.getTableNames("default");
} catch (PrestoException e) {
if (e.getErrorCode() == PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR.toErrorCode().getCode()) {
// retry with backoff after verifying Prometheus health at /-/healthy
} else {
throw e;
}
} Prevention
- Point prometheus-uri directly at a Prometheus server (default port 9090), not an auth proxy
- Ensure Prometheus is healthy (/-/healthy) before starting the Presto connector
- Retry startup with backoff to ride out Prometheus restarts
- Verify API compatibility between the connector and your Prometheus version
- Monitor the Prometheus endpoint from the Presto host network path
When it happens
Trigger: getTableNames (also invoked by checkServerReady during startup) receives an HTTP 200 response whose JSON status is not "success" (e.g. "error" not matching expected handling), or the response body lacks the expected metrics list — typically from querying a non-Prometheus server, a proxy auth page, or an API-version mismatch.
Common situations: prometheus-uri pointing at the wrong port/service (something other than Prometheus answering), Prometheus behind an auth proxy returning HTML, Prometheus restarted/unhealthy during Presto startup, or a very new/old Prometheus version returning an unexpected response shape.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/7b017027fda99c9e.
Report an issue: GitHub.