@@ -18,6 +18,7 @@ Queries that continue to use the old format will show no data.
...
@@ -18,6 +18,7 @@ Queries that continue to use the old format will show no data.
GitLab supports a limited set of [CI variables](../../../ci/variables/README.md) in the Prometheus query. This is particularly useful for identifying a specific environment, for example with `ci_environment_slug`. The supported variables are:
GitLab supports a limited set of [CI variables](../../../ci/variables/README.md) in the Prometheus query. This is particularly useful for identifying a specific environment, for example with `ci_environment_slug`. The supported variables are:
-`environment_filter`
-`ci_environment_slug`
-`ci_environment_slug`
-`kube_namespace`
-`kube_namespace`
-`ci_project_name`
-`ci_project_name`
...
@@ -29,6 +30,14 @@ GitLab supports a limited set of [CI variables](../../../ci/variables/README.md)
...
@@ -29,6 +30,14 @@ GitLab supports a limited set of [CI variables](../../../ci/variables/README.md)
NOTE: **Note:**
NOTE: **Note:**
Variables for Prometheus queries must be lowercase.
Variables for Prometheus queries must be lowercase.
### environment_filter
`environment_filter` is automatically expanded to `container_name!="POD",environment="ENVIRONMENT_NAME"`
where `ENVIRONMENT_NAME` is the name of the current environment.
For example, a Prometheus query like `container_memory_usage_bytes{ {{environment_filter}} }`
@@ -18,6 +18,8 @@ The [Prometheus service](../prometheus.md) must be enabled.
...
@@ -18,6 +18,8 @@ The [Prometheus service](../prometheus.md) must be enabled.
NGINX server metrics are detected, which tracks the pages and content directly served by NGINX.
NGINX server metrics are detected, which tracks the pages and content directly served by NGINX.
[`environment_filter`](../../../../operations/metrics/dashboards/variables.md#environment_filter) is one of the predefined variables that metrics dashboards support.
| Name | Query |
| Name | Query |
| ---- | ----- |
| ---- | ----- |
| Throughput (req/sec) | `sum(rate(nginx_server_requests{server_zone!="*", server_zone!="_", %{environment_filter}}[2m])) by (code)` |
| Throughput (req/sec) | `sum(rate(nginx_server_requests{server_zone!="*", server_zone!="_", %{environment_filter}}[2m])) by (code)` |