Monitor GraphQL health

Gather metrics for your GraphQL APIs in Prometheus.

Access ingress 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.

For example, you can use the following commands to access the istio ingress gateway pod metrics in the default Prometheus expression browser:

  1. 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
    
  2. Open your browser and connect to localhost:9091/.

Envoy metrics for GraphQL

Envoy metrics are collected for GraphQL APIs in your Gloo environment.

To enable metrics collection, add the following meshConfig settings to your gateway proxy installations.

meshConfig:
  defaultConfig:
    proxyStatsMatcher:
      inclusionRegexps:
        - ".*"

The metrics include the name of your GraphQL API resource with hyphens replaced by underscores, such as <api_name> in the following example. The following example metrics are generated based on the Bookinfo sample GraphQL API.

envoy_gloo_system_<api_name>_graphql_Query_productsForHome_rest_resolver_failed_resolutions
envoy_gloo_system_<api_name>_graphql_Query_productsForHome_rest_resolver_total_resolutions
envoy_gloo_system_<api_name>_graphql_author_rest_resolver_failed_resolutions 
envoy_gloo_system_<api_name>_graphql_author_rest_resolver_total_resolutions
envoy_gloo_system_<api_name>_graphql_descriptionHtml_rest_resolver_failed_resolutions 
envoy_gloo_system_<api_name>_graphql_descriptionHtml_rest_resolver_total_resolutions
envoy_gloo_system_<api_name>_graphql_id_rest_resolver_failed_resolutions 
envoy_gloo_system_<api_name>_graphql_id_rest_resolver_total_resolutions
envoy_gloo_system_<api_name>_graphql_pages_rest_resolver_failed_resolutions
envoy_gloo_system_<api_name>_graphql_pages_rest_resolver_total_resolutions
envoy_gloo_system_<api_name>_graphql_rating_rest_resolver_failed_resolutions
envoy_gloo_system_<api_name>_graphql_rating_rest_resolver_total_resolutions
envoy_gloo_system_<api_name>_graphql_review_rest_resolver_failed_resolutions
envoy_gloo_system_<api_name>_graphql_review_rest_resolver_total_resolutions
envoy_gloo_system_<api_name>_graphql_rq_error
envoy_gloo_system_<api_name>_graphql_rq_invalid_query_error
envoy_gloo_system_<api_name>_graphql_rq_parse_json_error
envoy_gloo_system_<api_name>_graphql_rq_parse_query_error
envoy_gloo_system_<api_name>_graphql_rq_total
envoy_gloo_system_<api_name>_graphql_title_rest_resolver_failed_resolutions
envoy_gloo_system_<api_name>_graphql_title_rest_resolver_total_resolutions
envoy_gloo_system_<api_name>_graphql_year_rest_resolver_failed_resolutions
envoy_gloo_system_<api_name>_graphql_year_rest_resolver_total_resolutions