Add database metrics to Prometheus endpoint

This commit is contained in:
Claudio Ortolina
2025-03-04 15:58:33 +00:00
parent 1d23bd17a4
commit 8964c7a94a
+24 -1
View File
@@ -110,7 +110,30 @@ defmodule MusicLibraryWeb.Telemetry do
last_value("vm.memory.total", unit: {:byte, :megabyte}),
last_value("vm.total_run_queue_lengths.total"),
last_value("vm.total_run_queue_lengths.cpu"),
last_value("vm.total_run_queue_lengths.io")
last_value("vm.total_run_queue_lengths.io"),
# Database Metrics
last_value("music_library.repo.query.total_time",
unit: {:native, :millisecond},
description: "The sum of the other measurements"
),
last_value("music_library.repo.query.decode_time",
unit: {:native, :millisecond},
description: "The time spent decoding the data received from the database"
),
last_value("music_library.repo.query.query_time",
unit: {:native, :millisecond},
description: "The time spent executing the query"
),
last_value("music_library.repo.query.queue_time",
unit: {:native, :millisecond},
description: "The time spent waiting for a database connection"
),
last_value("music_library.repo.query.idle_time",
unit: {:native, :millisecond},
description:
"The time the connection spent waiting before being checked out for the query"
)
]
end