Monitor GraphQL health
Gather metrics for your GraphQL APIs in Prometheus.
Enable Envoy metrics for GraphQL
Envoy metrics are collected for GraphQL APIs in your Gloo environment. You can enable collection of these metrics by editing your gateway proxy deployent settings.
-
Follow the upgrade guide to add the following
meshConfig
settings to your gateway proxy installations.meshConfig: defaultConfig: proxyStatsMatcher: inclusionRegexps: - ".*graphql.*"
-
Port-forward the ingress gateway on port 15090.
kubectl -n gloo-mesh-gateways port-forward deploy/istio-ingressgateway-1-20 15090
-
Open the Prometheus statistics in the ingress gateway.
-
Search for
envoy_graphql
metrics. The following example metrics are generated based on the Bookinfo sample GraphQL API.# TYPE envoy_graphql_Product_ratingsrest_resolver_failed_resolutions counter envoy_graphql_Product_ratingsrest_resolver_failed_resolutions{} 0 # TYPE envoy_graphql_Product_ratingsrest_resolver_total_resolutions counter envoy_graphql_Product_ratingsrest_resolver_total_resolutions{} 0 # TYPE envoy_graphql_Product_reviewsrest_resolver_failed_resolutions counter envoy_graphql_Product_reviewsrest_resolver_failed_resolutions{} 0 # TYPE envoy_graphql_Product_reviewsrest_resolver_total_resolutions counter envoy_graphql_Product_reviewsrest_resolver_total_resolutions{} 0 # TYPE envoy_graphql_Query_productsForHomerest_resolver_failed_resolutions counter envoy_graphql_Query_productsForHomerest_resolver_failed_resolutions{} 0 # TYPE envoy_graphql_Query_productsForHomerest_resolver_total_resolutions counter envoy_graphql_Query_productsForHomerest_resolver_total_resolutions{} 0 # TYPE envoy_graphql_rq_error counter envoy_graphql_rq_error{} 0 # TYPE envoy_graphql_rq_invalid_query_error counter envoy_graphql_rq_invalid_query_error{} 0 # TYPE envoy_graphql_rq_parse_json_error counter envoy_graphql_rq_parse_json_error{} 0 # TYPE envoy_graphql_rq_parse_query_error counter envoy_graphql_rq_parse_query_error{} 0 # TYPE envoy_graphql_rq_total counter envoy_graphql_rq_total{} 0
Access GraophQL metrics in Prometheus
Review the Gloo Gateway Observability documentation to access the default Prometheus deployment that is installed with Gloo Gateway, or configure your own Prometheus instance.
Open the Prometheus expression browser
You can use the following commands to access the ingress gateway pod metrics in the default Prometheus expression browser:
- Open the Prometheus expression browser.
For more information, see the CLI documentation.
meshctl proxy prometheus
Port-forward the
prometheus-server
deployment on 9091.kubectl -n gloo-mesh port-forward deploy/prometheus-server 9091
- Open your browser and connect to localhost:9091/.
View Prometheus metrics in the ingress gateway
-
Port-forward the ingress gateway on port 15090.
kubectl -n gloo-mesh-gateways port-forward deploy/istio-ingressgateway-1-20 15090
-
Open the Prometheus statistics in the ingress gateway.