Commit f5d395fa authored by lauraMon's avatar lauraMon

Changes rake task and docs location

* Changes rake task to be with other seeds
* Changes docs location to reflect that
parent 1b0964c8
......@@ -286,14 +286,3 @@ To re-import the metrics you can run:
```shell
sudo gitlab-rake metrics:setup_common_metrics
```
## Import additional development metrics
A lot of different types of metrics are supported, like multi line metrics, heatmaps,
anomaly, etc.
To import these custom metrics, you can run:
```shell
sudo gitlab-rake 'metrics:setup_development_metrics[your_project_id]'
```
......@@ -65,6 +65,16 @@ bin/rake "gitlab:seed:group_seed[subgroup_depth, username]"
Group are additionally seeded with epics if GitLab instance has epics feature available.
#### Seeding custom metrics for the monitoring dashboard
A lot of different types of metrics are supported in the monitoring dashboard.
To import these metrics, you can run:
```shell
sudo gitlab-rake 'metrics:setup_development_metrics[your_project_id]'
```
### Automation
If you're very sure that you want to **wipe the current database** and refill
......
namespace :metrics do
desc "GitLab | Metrics | Setup development metrics"
task :setup_development_metrics, [:project_id] => :gitlab_environment do |_, args|
shared_multi_metrics_attributes = {
title: 'Memory multi metric',
y_label: 'Memory (GiB)',
project_id: args[:project_id],
unit: 'GiB',
group: 'system'
}
PrometheusMetric.find_or_create_by(
**shared_multi_metrics_attributes,
identifier: 'additional_system_metrics_container_memory_usage',
legend: 'Usage (GiB)',
query: 'avg(sum(container_memory_usage_bytes{id="/"}) by (job)) without (job) / 2^30'
)
PrometheusMetric.find_or_create_by(
**shared_multi_metrics_attributes,
identifier: 'additional_system_metrics_kube_node_status_capacity_memory_bytes',
query: 'sum(kube_node_status_capacity_memory_bytes{kubernetes_namespace="gitlab-managed-apps"})/2^30',
legend: 'Capacity (GiB)'
)
PrometheusMetric.find_or_create_by(
**shared_multi_metrics_attributes,
identifier: 'additional_system_metrics_kube_pod_container_resource_requests_memory_bytes',
query: 'sum(kube_pod_container_resource_requests_memory_bytes{kubernetes_namespace="gitlab-managed-apps"})/2^30',
legend: 'Requested (GiB)'
)
end
end
# frozen_string_literal: true
namespace :metrics do
desc "GitLab | Metrics | Setup development metrics"
task :setup_development_metrics, [:project_id] => :gitlab_environment do |_, args|
shared_multi_metrics_attributes = {
title: 'Memory multi metric',
y_label: 'Memory (GiB)',
project_id: args[:project_id],
unit: 'GiB',
group: 'system'
}
PrometheusMetric.find_or_create_by(
**shared_multi_metrics_attributes,
identifier: 'additional_system_metrics_container_memory_usage',
legend: 'Usage (GiB)',
query: 'avg(sum(container_memory_usage_bytes{id="/"}) by (job)) without (job) / 2^30'
)
PrometheusMetric.find_or_create_by(
**shared_multi_metrics_attributes,
identifier: 'additional_system_metrics_kube_node_status_capacity_memory_bytes',
query: 'sum(kube_node_status_capacity_memory_bytes{kubernetes_namespace="gitlab-managed-apps"})/2^30',
legend: 'Capacity (GiB)'
)
PrometheusMetric.find_or_create_by(
**shared_multi_metrics_attributes,
identifier: 'additional_system_metrics_kube_pod_container_resource_requests_memory_bytes',
query: 'sum(kube_pod_container_resource_requests_memory_bytes{kubernetes_namespace="gitlab-managed-apps"})/2^30',
legend: 'Requested (GiB)'
)
end
end
namespace :metrics do
desc "GitLab | Metrics | Setup common metrics"
task setup_common_metrics: :gitlab_environment do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment