To collect usage API analytics, you set up several components, including the Gloo OTel pipeline, Clickhouse as a database storage, and the Prometheus chart for the Grafana dashboard. If you cannot see analytics in the Grafana dashboard, try the following troubleshooting steps.

  1. Make sure that all of the related components are healthy.

    1. Check the Gloo portal components.
        kubectl get all -A -l gloo-mesh=gloo-mesh-portal
    2. Check the Gloo OTel pipeline, including the telemetry gateway and collectors.
        kubectl get all -n gloo-mesh -l
      kubectl get all -n gloo-mesh -l
    3. Check the Clickhouse database storage.
        kubectl get all -n gloo-mesh -l
    4. Check the Prometheus stack, particularly the Grafana instance.
        kubectl get all -n monitoring -l
  2. Check that Clickhouse collects the API usage analytics information that the Grafana dashboard needs to display.

    1. Enable port-forwarding on the Clickhouse pod.
        kubectl port-forward $(kubectl get pods -n gloo-mesh -o name | grep clickhouse) 8123 -n gloo-mesh
    2. Get the gloo_api_logs that are stored in Clickhouse. Make sure to update the password to the value that you used in the clickhouse-auth secret.
        curl -G 'http://localhost:8123/' \
      --data-urlencode 'query=SELECT * FROM gloo_api_logs' \
      --data-urlencode 'user=default' \
      --data-urlencode 'password=password'
    3. If you do not see any logs, try generating some traffic to your APIs. If you still do not see logs, review your Portal analytics setup setup for errors.
    4. Review the logs for the following portal fields. If some of the fields are not populated, revise your portal setup. For example, you might need to create external auth and rate limiting policies for a usage plan.
      • user_id
      • api_id
      • api_product_id
      • api_product_name (optional, depending on if you set a product name)
      • usage_plan Example output with missing usage_plan data.
  3. Check that the Grafana deployment is set up correctly.

    1. Verify that Grafana uses Clickhouse as a data source, including the correct password that you set up.
        kubectl describe configmap kube-prometheus-stack-grafana-datasource -n monitoring
      Example output:
      - isDefault: false
          defaultDatabase: default
          port: 9000
          server: clickhouse.gloo-mesh
          tlsSkipVerify: true
          username: default
        name: ClickHouse
          password: password
        type: grafana-clickhouse-datasource
        uid: clickhouse-access-logs
    2. Set up port forwarding on your local machine to access the Grafana dashboard.
        kubectl port-forward $(kubectl get pods -n monitoring -o name | grep grafana) 8080:3000 -n monitoring
    3. Open the Grafana dashboard in your web browser and log in, such as with the default admin username and prom-operator password.
    4. Review the API Dashboard for portal usage.
    5. If a panel does not have any data, click the panel’s name, then click Edit.
    6. Review the Query information, making sure that the Data source is set to Clickhouse.
    7. If the Query is missing configuration, review the JSON file for that section. For example, you can search the JSON file for the Top API consumers panel. Then, you can find the rawSql query and add or compare to what is in the API Dashboard.