Add prometheus metrics at /api/v1/metrics

This commit is contained in:
wint3rmute
2023-01-18 00:33:55 +01:00
committed by Mateusz Bączek
parent 1c0b4205d4
commit 4d410d124f
4 changed files with 24 additions and 0 deletions

View File

@@ -225,3 +225,11 @@ def get_playback_statistic
return tracker.as(Hash(String, Int64 | Float64))
end
def to_prometheus_metrics(metrics_struct : Hash(String, Number)) : String
return String.build do |str|
metrics_struct.each.each do |key, value|
str << key << " " << value << "\n"
end
end
end