Configure GAS for Prometheus

Although the Genero Application Server can provide metrics to Prometheus, it is disabled by default. You must enable metrics in the GAS configuration file.

The Genero Application Server supports Prometheus metrics from all proxies, Genero applications, and Genero web services started by the GAS via the Genero BDL Prometheus API and the dispatcher itself.

The Genero BDL Prometheus API works only via the GAS; it is not activated for direct connections.

You enable Prometheus in the GAS configuration file (as.xcf) by setting resources. Once enabled, metrics from Genero applications and services launched by this GAS are automatically enabled if the BDL Prometheus API is used in the code.

You can also override these resources from the command line when starting the dispatcher, without editing as.xcf. For example: httpdispatch -E res.prometheus.enabled=TRUE. For details, go to Override configuration resources.

Steps to configure the GAS for Prometheus

  1. Set the resource res.prometheus.enabled to TRUE (FALSE by default)
    Important:

    TRUE or FALSE must be in uppercase! Case is important.

  2. Optional: Set the resource res.prometheus.address to the address that the GAS UDP collector listens on.

    The default address is 127.0.0.1. Most installations do not need to change it, because the dispatcher and the proxies are on the GAS host. The address must belong to the GAS host.

  3. Optional: Set the resource res.prometheus.port to the listening port of the GAS UDP collector.

    The default port is 8451. The port carries only metric data sent to the agent by the dispatcher and the proxies. The Prometheus server does not use that port; it scrapes the GAS metrics endpoint instead.

What to do next:

With the Prometheus feature enabled, the GAS opens an endpoint for the Prometheus server to fetch all metrics. The metrics endpoint is in the form http[s]://host:port/gas/metrics, where "gas" specifies the connector.uri part of the URL provided by the GAS when accessed through a web server (IIS, Apache, and so on). Applications running on standalone GAS (httpdispatch) have no connector.uri in the URL; on a standalone dispatcher, the endpoint is http://localhost:6394/metrics by default.

To confirm the GAS is producing metrics, you can open the endpoint in a browser. The response is the metric data in Prometheus text format. For a worked example with sample output, go to Prometheus Quick Start.

To restrict which hosts can reach the endpoint, you can use the ACCESS_CONTROL element in the PROMETHEUS configuration. For details, go to ACCESS_CONTROL.

Warning:

Ensure that access to http://localhost:6394/metrics is restricted to prevent unauthorized scraping. For example, set the address the dispatcher listens on with the LISTEN element, add a firewall rule, or place the endpoint behind a reverse proxy with authentication or TLS.