trinodb / trino-gateway

Home Page:https://trinodb.github.io/trino-gateway/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use REST for health checks

willmostly opened this issue · comments

Currently the Gateway supports either JDBC or REST for health checks. REST health checks use the /ui/api/stats endpoint, which is intended for use by the Trino UI, not external services, and has less flexible authentication options than other endpoints. JDBC based health checks create a lot of noise in query logs and other cluster metrics.

The /v1/jmx/mbean API provides the statistics needed for health checks:

  • /v1/jmx/mbean/trino.metadata:name=DiscoveryNodeManager provides ActiveNodeCount
  • /v1/jmx/mbean/trino.execution:name=QueryManager provides RunningQueries and QueuedQueries

ClusterStats also has a blockedQueries statistic, corresponding to BasicQueryStats.getFullyBlocked(). This is available from /ui/api/stats/ but not other endpoints listed here.

This endpoint can support any configured authentication method (unlike /ui/api/stats which must use web-ui.authentication.type). It doesn't require opening an extra port as jmx rmi would, and it doesn't require the coordinator to generate a query plan or spam the query logs.
One potential downside of the /v1/jmx/mbean API is that it relies on class and package name in trino to be constant.

Additional context trinodb/trino#17259

I think the proper healthcheck REST endpoint for Trino are the same as used in the docker container

http://localhost:8080/v1/info

or if you need more

http://localhost:8080/v1/status

And btw .. we should make a similar simple healtcheck for Trino Gateway

#264 added support for v1/info REST API. Let me close this issue.