Skip to content

Resolve "Embed: Add link to embedded panels to go to logs page"

What does this MR do?

Implements #201846 (closed)

It extends /metrics_dashboard ajax response with metrics_data object. It contains data needed to properly render embed dashboards. This approach is merely MVP and allows us to quickly deliver &2225 Whole MetricsDashboard require revisit and some refactoring. But I want to follow up on this in separate issue #205423 (closed)

After this MR is merged /metrics_dashboard response when including controller implements #environment will include additional key metrics_data eg:

 {
   "dashboard":{
      "panel_groups":[
         {
            "panels":[
               {
                  "title":"Core Usage (Total)",
                  "type":"area-chart",
                  "y_label":"Total Cores",
                  "weight":3,
                  "metrics":[
                     {
                        "id":"system_metrics_kubernetes_container_cores_total",
                        "query_range":"avg(sum(rate(container_cpu_usage_seconds_total{container_name!=\"POD\",pod_name=~\"^%{ci_environment_slug}-(.*)\",namespace=\"%{kube_namespace}\"}[15m])) by (job)) without (job)",
                        "label":"Total (cores)",
                        "unit":"cores",
                        "metric_id":16,
                        "prometheus_endpoint_path":"/monitoring-group/docker-app-clone/-/environments/34/prometheus/api/v1/query_range?query=avg%28sum%28rate%28container_cpu_usage_seconds_total%7Bcontainer_name%21%3D%22POD%22%2Cpod_name%3D~%22%5E%25%7Bci_environment_slug%7D-%28.%2A%29%22%2Cnamespace%3D%22%25%7Bkube_namespace%7D%22%7D%5B15m%5D%29%29+by+%28job%29%29+without+%28job%29"
                     }
                  ]
               }
            ]
         }
      ]
   },
   "status":"success",
   "metrics_data":{
      "settings-path":"/monitoring-group/docker-app-clone/-/services/prometheus/edit",
      "clusters-path":"/monitoring-group/docker-app-clone/-/clusters",
      "current-environment-name":"production",
      "documentation-path":"/help/administration/monitoring/prometheus/index.md",
      "empty-getting-started-svg-path":"/images/illustrations/monitoring/getting_started.svg",
      "empty-loading-svg-path":"/images/illustrations/monitoring/loading.svg",
      "empty-no-data-svg-path":"/images/illustrations/monitoring/no_data.svg",
      "empty-no-data-small-svg-path":"/images/illustrations/chart-empty-state-small.svg",
      "empty-unable-to-connect-svg-path":"/images/illustrations/monitoring/unable_to_connect.svg",
      "metrics-endpoint":"/monitoring-group/docker-app-clone/-/environments/34/additional_metrics.json",
      "dashboards-endpoint":"/monitoring-group/docker-app-clone/-/performance_monitoring/dashboards.json",
      "dashboard-endpoint":"/monitoring-group/docker-app-clone/-/environments/34/metrics_dashboard.json",
      "deployments-endpoint":"/monitoring-group/docker-app-clone/-/environments/34/deployments.json",
      "default-branch":"master",
      "project-path":"/monitoring-group/docker-app-clone",
      "tags-path":"/monitoring-group/docker-app-clone/-/tags",
      "has-metrics":"true",
      "prometheus-status":"installed",
      "external-dashboard-url":null,
      "custom-metrics-path":"/monitoring-group/docker-app-clone/prometheus/metrics",
      "validate-query-path":"/monitoring-group/docker-app-clone/prometheus/metrics/validate_query",
      "custom-metrics-available":"true",
      "alerts-endpoint":"/monitoring-group/docker-app-clone/prometheus/alerts.json?environment_id=34",
      "prometheus-alerts-available":"true",
      "logs-path":"/monitoring-group/docker-app-clone/-/logs"
   }
}

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading