Using Grafana with Prometheus metrics

This topic explains how to use Grafana to visualize and analyze Prometheus metrics collected from Genero Application Server (GAS), GIP, FLM, OIDC, and SAML.

What is Grafana?

Grafana is an open-source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources such as Prometheus.

Connecting Grafana to Prometheus

  1. Install Grafana and Prometheus on your system (refer to their official documentation).
  2. Start Prometheus and ensure it is scraping metrics from your Genero services.
  3. Log in to Grafana and add Prometheus as a data source (Configuration > Data Sources > Add data source > Prometheus).
  4. Enter the Prometheus server URL and save the configuration.

Example Grafana dashboards and queries

Here are some example PromQL queries and dashboard ideas for visualizing Genero metrics:
  • Request Rate: rate(fourjs_gas_request_count_total[5m])
  • Request Duration (90th percentile): histogram_quantile(0.90, sum(rate(fourjs_gas_request_duration_seconds_bucket[$__rate_interval])) by (le))
  • Active User Agents: fourjs_gas_user_agent_count
  • Pending Requests: fourjs_gas_request_pending_count
  • Failed Requests: count(fourjs_gas_url_count_total{status!="200"})

You can create panels in Grafana using these queries to monitor system health, performance, and usage. For some examples using Grafana with these metrics, go to GAS metrics.

Setting Up Alerts

Grafana allows you to set up alerts based on Prometheus metrics. For example, you can trigger an alert if the number of failed authentication attempts exceeds a threshold, or if request latency is too high.

Example of visualizing GAS request duration histogram

To visualize the 90th percentile request duration for GAS in Grafana, use the following PromQL query in a Grafana panel:

PromQL query: histogram_quantile(0.90, sum(rate(fourjs_gas_request_duration_seconds_bucket[$__rate_interval])) by (le))

This query calculates the 90th percentile of request durations, helping you monitor response time for users in real time.
Figure: Example: GAS Request Duration Histogram in Grafana

GAS request duration histogram 90th percentile in Grafana
To use this in Grafana:
  1. Create a new panel and select Prometheus as the data source.
  2. Paste the PromQL query above into the query editor.
  3. Adjust the panel visualization type (for example, line graph).
  4. Save the dashboard to monitor request latency over time.

For more information, refer to these useful resources: