Getting Started
This blog post assumes you already have a Kubernetes cluster running and have installed Gloo Edge Enterprise. If you are new to Gloo Edge and want to try this exercise, you can request a 30-day trial license here. We will use a simple example application, the Pet Store, to show metrics on our dashboard addition. Gloo Edge will detect and automatically create an upstream resource for the REST API that Pet Store provides. To deploy the Pet Store app run the following command:
kubectl apply -f https://raw.githubusercontent.com/solo-io/gloo/v1.7.5/example/petstore/petstore.yaml |
apiVersion: gateway.solo.io/v1 kind: VirtualService metadata: name: petstore namespace: gloo-system spec: virtualHost: domains: - '*' routes: - matchers: - exact: /pets routeAction: single: upstream: name: default-petstore-8080 namespace: gloo-system options: prefixRewrite: /api/pets |
kubectl apply -f vs-petstore.yaml |
$> curl $(glooctl proxy url)/pets [{"id":1,"name":"Dog","status":"available"},{"id":2,"name":"Cat","status":"pending"}] |
Grafana Metrics
Gloo Edge automatically captures some upstream metrics for you, so let’s see what is there by default before modifying anything. First, we’ll need to port forward the Grafana service:
kubectl -n gloo-system port-forward deployment/glooe-grafana 3000 |
- Total active connections
- Total requests
- Upstream Network Traffic
while true; do curl $(glooctl proxy url)/pets done |
Inspecting Envoy Proxy Statistics
Gloo Edge also ensures that Envoy Proxy statistics are being captured even if they are not readily visible in the default upstream dashboard. Let’s now take a look at statistics being captured in Prometheus. First, we will create a second port forward to expose Prometheus:
kubectl -n gloo-system port-forward deployment/gateway-proxy 19000 |
Developing the Dashboard
To see what the dashboard will show, let’s keep the traffic running while we develop it. First, look at the Prometheus stats for a histogram coming from Envoy. If you take a look at Envoy statistics for envoy_cluster_external_upstream_rq_time you will notice that they are identified by the upstream name, so we can easily find our Pet Store upstream - default-petstore-8080_gloo-system. Next, notice that the counters come in buckets of time. The unit of measurement here is milliseconds. You can also see a sum and a count metric that makes it possible to represent the buckets as a percentage of the total if we wanted to show quantiles.
envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="0.5"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="1"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="5"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="10"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="25"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="50"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="100"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="250"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="500"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="1000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="2500"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="5000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="10000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="30000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="60000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="300000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="600000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="1800000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="3600000"} 1 envoy_cluster_external_upstream_rq_time_bucket{envoy_cluster_name="default-petstore-8080_gloo-system", le="+Inf"} 1 envoy_cluster_external_upstream_rq_time_sum{envoy_cluster_name="default-petstore-8080_gloo-system"} 0 envoy_cluster_external_upstream_rq_time_count{envoy_cluster_name="default-petstore-8080_gloo-system"} 1 |
sum(rate(envoy_cluster_external_upstream_rq_time_bucket{ envoy_cluster_name="default-petstore-8080_gloo-system" }[1m])) by (le) |
Modifying the Upstream ConfigMap
First, let’s take a look at what we have created: Cool! We have some nice colors too and we can see that traffic is running smoothly. Let’s now download the JSON so we can add it to the ConfigMap. Use the drop-down menu on the Request Time Heatmap panel and select “More…” and then Panel JSON. Now we are going to edit the ConfigMap for the Upstream and add this panel to it:
kubectl edit -n gloo-sytem cm gloo-observability-config |