@@ -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}} }`
Now that the basics of our project is completed, we can publish the package.
Now that the basics of our project is completed, we can publish the package.
To publish the package, you need:
To publish the package, you need:
- A personal access token. You can generate a [personal access token](../../../user/profile/personal_access_tokens.md) with the scope set to `api` for repository authentication.
- A personal access token or `CI_JOB_TOKEN`.
NOTE: **Note:**
[Deploy tokens](./../../project/deploy_tokens/index.md) are not yet supported for use with Composer.
([Deploy tokens](./../../project/deploy_tokens/index.md) are not yet supported for use with Composer.)
- Your project ID which can be found on the home page of your project.
- Your project ID which can be found on the home page of your project.
To publish the package hosted on GitLab, make a `POST` request to the GitLab package API.
To publish the package hosted on GitLab, make a `POST` request to the GitLab package API.
A tool like `curl` can be used to make this request:
A tool like `curl` can be used to make this request:
You can generate a [personal access token](../../../user/profile/personal_access_tokens.md) with the scope set to `api` for repository authentication. For example:
@@ -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)` |