Embedding Grafana charts not working

Replace this template with your information

Describe your question in as much detail as possible:

  • What are you seeing, and how does it differ from what you expect to see?
  • Consider including screenshots, error messages, and/or other helpful visuals
  • What version are you on (Hint: /help) ? and are you using self-managed or gitlab.com?
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

Thanks for taking the time to be thorough in your request, it really helps! :blush:

Hello,

I’m trying to enable Grafana graphs integration in GitLab and I’m having some issues. I followed GitLab’s docs and I setup the integration (Grafana URL and API token). I then paste the URL into the issue and post it. But the graph doesn’t render.

In the console, I get the following error: Failed to load resource: the server responded with a status of 422 ()

Looking in GitLab’s production log file, I get the error:
{
“method”: “GET”,
“path”: “/group/project/-/grafana/metrics_dashboard”,
“format”: “json”,
“controller”: “Projects::GrafanaApiController”,
“action”: “metrics_dashboard”,
“status”: 422,
“duration”: 12.13,
“view”: 0.16,
“db”: 1.36,
“time”: “2020-04-07T16:01:35.766Z”,
“params”: [
{
“key”: “embedded”,
“value”: “true”
},
{
“key”: “grafana_url”,
“value”: “https://grafana.example.com/d/IFBmmfuWk/service-overview?orgId=32&refresh=5m&from=1586250158946&to=1586271758947&var-interval=$__auto_interval_interval&var-webnode=All&panelId=24&fullscreen
},
{
“key”: “start”,
“value”: “2020-04-07T09:02:38Z”
},
{
“key”: “end”,
“value”: “2020-04-07T15:02:38Z”
},
{
“key”: “namespace_id”,
“value”: “group”
},
{
“key”: “project_id”,
“value”: “project”
}
],
“remote_ip”: “x.x.x.x”,
“user_id”: 2,
“username”: “user1”,
“queue_duration”: 3.24,
“response”: “{“message”:“Datasource name not found”,“status”:“error”}”,
“cpu_s”: 0.023109362000468536
}

Looking at the logs on the Grafana server, I don’t see a request getting there, so I guess it’s canceled inside GitLab. I don’t know what Datasource name not found means and what datasource it wants.

I’m running Grafana on another server, but I double checked and GitLab instance does have access to Grafana. I’m running GitLab 12.8.1.

Can anyone shed some light on this?

I would also be interested in how to troubleshoot this?

My production.log does not show anything suspicious:

{
    "method": "GET",
    "path": "/ogs/ogs/-/grafana/metrics_dashboard",
    "format": "json",
    "controller": "Projects::GrafanaApiController",
    "action": "metrics_dashboard",
    "status": 204,
    "time": "2021-05-27T07:46:26.506Z",
    "params": [
        {
            "key": "embedded",
            "value": "true"
        },
        {
            "key": "grafana_url",
            "value": "https://gitlab.opengeosys.org/-/grafana/d/o3GBwPqMz/overview?from=1622072785000&orgId=1&to=1622101585000&viewPanel=8"
        },
        {
            "key": "namespace_id",
            "value": "ogs"
        },
        {
            "key": "project_id",
            "value": "ogs"
        }
    ],
    "remote_ip": "141.65.34.31",
    "user_id": 2,
    "username": "bilke",
    "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15",
    "correlation_id": "01F6PCKWFGS6PG3XJWBR5YZG91",
    "meta.user": "bilke",
    "meta.project": "ogs/ogs",
    "meta.root_namespace": "ogs",
    "meta.caller_id": "Projects::GrafanaApiController#metrics_dashboard",
    "meta.remote_ip": "141.65.34.31",
    "meta.feature_category": "metrics",
    "meta.client_id": "user/2",
    "redis_calls": 6,
    "redis_duration_s": 0.000977,
    "redis_read_bytes": 293,
    "redis_write_bytes": 3134,
    "redis_cache_calls": 4,
    "redis_cache_duration_s": 0.000619,
    "redis_cache_read_bytes": 4,
    "redis_cache_write_bytes": 1177,
    "redis_queues_calls": 1,
    "redis_queues_duration_s": 0.000143,
    "redis_queues_read_bytes": 58,
    "redis_queues_write_bytes": 1261,
    "redis_shared_state_calls": 1,
    "redis_shared_state_duration_s": 0.000215,
    "redis_shared_state_read_bytes": 231,
    "redis_shared_state_write_bytes": 696,
    "db_count": 5,
    "db_write_count": 0,
    "db_cached_count": 1,
    "cpu_s": 0.043716,
    "mem_objects": 21164,
    "mem_bytes": 1342856,
    "mem_mallocs": 3824,
    "mem_total_bytes": 2189416,
    "queue_duration_s": 0.011265,
    "db_duration_s": 0.00335,
    "view_duration_s": 0.00023,
    "duration_s": 0.05715
},