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 deployment settings.

  1. Follow the upgrade guide to add the following meshConfig settings to your gateway proxy installations.

      
    meshConfig:
      defaultConfig:
        proxyStatsMatcher:
          inclusionRegexps:
            - ".*graphql.*"
      
  2. Port-forward the ingress gateway on port 15090.

      kubectl -n gloo-mesh-gateways port-forward deploy/istio-ingressgateway-1-18 15090
      
  3. Open the Prometheus statistics in the ingress gateway.

  4. 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 GraphQL metrics in Prometheus

Review the Gloo Mesh Gateway Prometheus documentation to access the default Prometheus deployment that is installed with Gloo Mesh 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:

  1. Open the Prometheus expression browser.
  2. Open your browser and connect to localhost:9091/.

View Prometheus metrics in the ingress gateway

  1. Port-forward the ingress gateway on port 15090.

      kubectl -n gloo-mesh-gateways port-forward deploy/istio-ingressgateway-1-18 15090
      
  2. Open the Prometheus statistics in the ingress gateway.