akoutmos / prom_ex

An Elixir Prometheus metrics collection library built on top of Telemetry with accompanying Grafana dashboards
MIT License
577 stars 96 forks source link

[BUG] Grafana dashboard in priv folder fails to load #233

Closed briankariuki closed 3 months ago

briankariuki commented 3 months ago

Describe the bug I've added a dashboard.json in a folder in priv priv/grafana/dashboard.json. I then added it to the dashboards section in the generated file like so

image

It works in dev, but when deployed in a docker container I get this error. I've also checked in the docker container and the dashboard.json file exists at that path.

[warning] Received a 404 from Grafana because: %Finch.Response{status: 404, body: "{\"message\":\"Dashboard not found\",\"status\":\"not-found\"}", headers: [{"cache-control", "no-store"}, {"content-type", "application/json"}, {"x-content-type-options", "nosniff"}, {"x-frame-options", "deny"}, {"x-xss-protection", "1; mode=block"}, {"date", "Sun, 31 Mar 2024 19:35:01 GMT"}, {"content-length", "54"}], trailers: []}

PromEx.DashboardUploader failed to upload /app/lib/shield-0.1.0/priv/grafana/dashboard.json to Grafana: :not_found

To Reproduce Steps to reproduce the behavior:

  1. Add the following plugins to PromEx
  2. Start my sample application
  3. Create folder inside priv named grafana. Add dashboard json inside this folder.
  4. Reference the json file in the dashboard's section in the file generated by promex plugin
  5. Build docker container.

Expected behavior I expect that it would work the same as it does on dev, that is upload the dashboard defined in the json file to grafana.

Environment

briankariuki commented 3 months ago

Closing this. I realized I have to set the id field in the dashboard.json to null for it to work.