Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/mix/tasks/prom_ex.dashboard.publish.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ defmodule Mix.Tasks.PromEx.Dashboard.Publish do
raise "#{prom_ex_module} is not a valid PromEx module because #{inspect(reason)}"
end
|> check_grafana_configuration()
|> start_finch()
|> upload_dashboards(uploader_process_name, timeout)
end

Expand Down Expand Up @@ -80,6 +81,19 @@ defmodule Mix.Tasks.PromEx.Dashboard.Publish do
prom_ex_module
end

defp start_finch(prom_ex_module) do
client_name = Module.concat([prom_ex_module, GrafanaClient])

Supervisor.start_link(
[
{PromEx.GrafanaClient, name: client_name}
],
strategy: :one_for_one
)

prom_ex_module
end

defp upload_dashboards(prom_ex_module, uploader_process_name, timeout) do
# We don't want errors in DashboardUploader to kill the mix task
Process.flag(:trap_exit, true)
Expand Down