{"record":{"id":"7b017027fda99c9e","repo":"prestodb/presto","slug":"prometheus-tables-metrics-retrieve-error","errorCode":"PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR","errorMessage":"Prometheus did no return metrics list (table names): %s","messagePattern":"Prometheus did no return metrics list \\(table names\\): (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusClient.java","lineNumber":130,"sourceCode":"                    status = (String) tableSupplierStatus;\n                }\n            }\n\n            //TODO prometheus warnings (success|error|warning) could be handled separately\n            if (status.equals(\"success\")) {\n                List<String> tableNames = (List<String>) tableSupplier.get().get(\"data\");\n                if (tableNames == null) {\n                    return ImmutableSet.of();\n                }\n                return ImmutableSet.copyOf(tableNames);\n            }\n            else {\n                if (status.equals(\"warning\")) {\n                    log.warn(\"Prometheus client gets a warning by retrieving table name from metric list\");\n                }\n            }\n        }\n        throw new PrestoException(PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR, String.format(\"Prometheus did no return metrics list (table names): %s\", status));\n    }\n\n    public PrometheusTable getTable(String schema, String tableName)\n    {\n        requireNonNull(schema, \"schema is null\");\n        requireNonNull(tableName, \"tableName is null\");\n        if (!schema.equals(\"default\")) {\n            return null;\n        }\n\n        List<String> tableNames = (List<String>) tableSupplier.get().get(\"data\");\n        if (tableNames == null) {\n            return null;\n        }\n        if (!tableNames.contains(tableName)) {\n            return null;\n        }\n        return new PrometheusTable(","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusClient.java#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nprometheus-uri=http://monitoring:8080  # auth proxy, returns HTML\n// after\nprometheus-uri=http://prometheus:9090","handlingStrategy":"retry","validationCode":"bash\ncurl -fsS http://prometheus:9090/api/v1/label/__name__/values | jq -r '.status'\n# must print: success","typeGuard":null,"tryCatchPattern":"java\ntry {\n    Set<String> tables = client.getTableNames(\"default\");\n} catch (PrestoException e) {\n    if (e.getErrorCode() == PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR.toErrorCode().getCode()) {\n        // retry with backoff after verifying Prometheus health at /-/healthy\n    } else {\n        throw e;\n    }\n}","preventionTips":["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"],"tags":["prometheus","http","connector","metrics"],"backgroundTag":"prometheus-metrics-retrieve-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}