Skip to content

Commit

Permalink
Fix application crashing on startup from being unable to upload dashb…
Browse files Browse the repository at this point in the history
…oards due to folder UID changing (#177)
  • Loading branch information
feld authored Nov 1, 2022
1 parent 7a4dd91 commit 22664c1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ability to run multiple GrafanaAgent instances [#157](https://github.com/akoutmos/prom_ex/pull/157)
- Support for GrafanaAgent 28

### Fixed

- Application crashing on startup from being unable to upload dashboards due to folder UID changing [#177](https://github.com/akoutmos/prom_ex/pull/177)

## [1.7.1] - 2022-03-02

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion lib/prom_ex/dashboard_uploader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ defmodule PromEx.DashboardUploader do
{:ok, folder_details} ->
folder_details

{:error, :bad_request} ->
{:error, reason} ->
Logger.error("PromEx.DashboardUploader failed to create folder in Grafana: #{inspect(reason)}.")
{:ok, all_folders} = GrafanaClient.get_all_folders(grafana_conn)

all_folders
Expand Down
1 change: 1 addition & 0 deletions lib/prom_ex/grafana_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ defmodule PromEx.GrafanaClient do
401 => :unauthorized,
403 => :forbidden,
404 => :not_found,
409 => :already_exists,
412 => :already_exists
}

Expand Down
2 changes: 1 addition & 1 deletion test/prom_ex/dashboard_uploader_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ defmodule PromEx.DashboardUploaderTest do
}
"""

Plug.Conn.resp(conn, 400, response_payload)
Plug.Conn.resp(conn, 409, response_payload)
end)

Bypass.expect_once(bypass, "GET", "/api/folders", fn conn ->
Expand Down

0 comments on commit 22664c1

Please sign in to comment.