Skip to content

Commit

Permalink
Retrieve metrics from all nodes in the cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Nov 1, 2024
1 parent 3cb097a commit 64c91e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/uplink/clients/lxd/metric/manager.ex
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
defmodule Uplink.Clients.LXD.Metric.Manager do
alias Uplink.Clients.LXD

def list(_options \\ []) do
def list(options \\ []) do
target = Keyword.get(options, :target, nil)

LXD.client()
|> Lexdee.list_metrics()
|> Lexdee.list_metrics(query: [target: target])
|> case do
{:ok, %{body: raw_metrics}} ->
raw_metrics
Expand Down
9 changes: 8 additions & 1 deletion lib/uplink/metrics/instance.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ defmodule Uplink.Metrics.Instance do

def metrics do
instances = LXD.list_instances(recursion: 2)
metrics = LXD.list_metrics()

cluster_members = LXD.list_cluster_members()

metrics =
Enum.flat_map(cluster_members, fn cluster_member ->
LXD.list_metrics(target: cluster_member.server_name)
end)

%{"organization" => %{"slug" => account_id}} = Instellar.get_self()

metrics =
Expand Down

0 comments on commit 64c91e1

Please sign in to comment.