exq improvements
This commit is contained in:
parent
5b1b9a08c7
commit
e4b3778da4
3 changed files with 10 additions and 7 deletions
|
|
@ -135,8 +135,11 @@ defmodule ToweropsWeb.Telemetry do
|
|||
Publishes Exq queue and process statistics.
|
||||
"""
|
||||
def publish_exq_stats do
|
||||
# Only run if Exq is available (not in test env) and the process is running
|
||||
if Application.get_env(:towerops, :env) == :test or is_nil(Process.whereis(Exq)) do
|
||||
# Only run if Exq is available (not in test env) and the API process is running
|
||||
# The Exq.Api.Server is registered as :"Exq.Api" when started with name: Exq
|
||||
api_process = :"Exq.Api"
|
||||
|
||||
if Application.get_env(:towerops, :env) == :test or is_nil(Process.whereis(api_process)) do
|
||||
:ok
|
||||
else
|
||||
try do
|
||||
|
|
@ -144,7 +147,7 @@ defmodule ToweropsWeb.Telemetry do
|
|||
|
||||
for queue <- queues do
|
||||
try do
|
||||
case Exq.Api.queue_size(Exq, queue) do
|
||||
case Exq.Api.queue_size(api_process, queue) do
|
||||
{:ok, size} ->
|
||||
:telemetry.execute(
|
||||
[:towerops, :exq, :queue, :size],
|
||||
|
|
@ -163,8 +166,8 @@ defmodule ToweropsWeb.Telemetry do
|
|||
end
|
||||
|
||||
try do
|
||||
with {:ok, processes} <- Exq.Api.processes(Exq),
|
||||
{:ok, busy} <- Exq.Api.busy(Exq) do
|
||||
with {:ok, processes} <- Exq.Api.processes(api_process),
|
||||
{:ok, busy} <- Exq.Api.busy(api_process) do
|
||||
:telemetry.execute(
|
||||
[:towerops, :exq, :processes, :busy],
|
||||
%{value: length(busy)},
|
||||
|
|
|
|||
2
mix.exs
2
mix.exs
|
|
@ -69,7 +69,7 @@ defmodule Towerops.MixProject do
|
|||
{:jason, "~> 1.2"},
|
||||
{:dns_cluster, "~> 0.2.0"},
|
||||
{:libcluster, "~> 3.4"},
|
||||
{:horde, "~> 0.9.0"},
|
||||
{:horde, "~> 0.10.0"},
|
||||
{:bandit, "~> 1.5"},
|
||||
{:phoenix_pubsub_redis, "~> 3.0"},
|
||||
{:ecto_psql_extras, "~> 0.6"},
|
||||
|
|
|
|||
2
mix.lock
2
mix.lock
|
|
@ -26,7 +26,7 @@
|
|||
"gen_smtp": {:hex, :gen_smtp, "1.3.0", "62c3d91f0dcf6ce9db71bcb6881d7ad0d1d834c7f38c13fa8e952f4104a8442e", [:rebar3], [{:ranch, ">= 1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "0b73fbf069864ecbce02fe653b16d3f35fd889d0fdd4e14527675565c39d84e6"},
|
||||
"gettext": {:hex, :gettext, "1.0.2", "5457e1fd3f4abe47b0e13ff85086aabae760497a3497909b8473e0acee57673b", [:mix], [{:expo, "~> 0.5.1 or ~> 1.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "eab805501886802071ad290714515c8c4a17196ea76e5afc9d06ca85fb1bfeb3"},
|
||||
"heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "0435d4ca364a608cc75e2f8683d374e55abbae26", [tag: "v2.2.0", sparse: "optimized", depth: 1]},
|
||||
"horde": {:hex, :horde, "0.9.1", "547507dfe1228471d9a31cece7653be81df2cf8f210816f672ce507dc9606128", [:mix], [{:delta_crdt, "~> 0.6.2", [hex: :delta_crdt, repo: "hexpm", optional: false]}, {:libring, "~> 1.7", [hex: :libring, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_poller, "~> 0.5.0 or ~> 1.0", [hex: :telemetry_poller, repo: "hexpm", optional: false]}], "hexpm", "14e1be4d6a84b066101641628a64f849d6df4f0311e93b7a9c39709e9c0bf4ba"},
|
||||
"horde": {:hex, :horde, "0.10.0", "31c6a633057c3ec4e73064d7b11ba409c9f3c518aa185377d76bee441b76ceb0", [:mix], [{:delta_crdt, "~> 0.6.2", [hex: :delta_crdt, repo: "hexpm", optional: false]}, {:libring, "~> 1.7", [hex: :libring, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_poller, "~> 0.5.0 or ~> 1.0", [hex: :telemetry_poller, repo: "hexpm", optional: false]}], "hexpm", "0b51c435cb698cac9bf9c17391dce3ebb1376ae6154c81f077fc61db771b9432"},
|
||||
"hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"},
|
||||
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
|
||||
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue