Revert "Merge branch 'add-prometheus-metrics-endpoint'"
Some checks failed
Build and release container directly from master / release (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.12.1, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.13.2, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.14.0, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.15.0, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (nightly, false) (push) Has been cancelled
Invidious CI / build-docker (push) Has been cancelled
Invidious CI / build-docker-arm64 (push) Has been cancelled
Invidious CI / lint (push) Has been cancelled

This reverts commit e5c0f15398 due to
https://github.com/iv-org/invidious/pull/3576#issuecomment-2727898574
, reversing changes made to ecacbab2a5.
This commit is contained in:
Fijxu
2025-03-16 23:41:27 -03:00
parent 8be23eb01d
commit 7aba1f7ba3
6 changed files with 0 additions and 99 deletions

View File

@@ -1,5 +1,3 @@
require "../../../metrics.cr"
module Invidious::Routes::API::V1::Misc
# Stats API endpoint for Invidious
def self.stats(env)
@@ -28,39 +26,6 @@ module Invidious::Routes::API::V1::Misc
end
end
def self.metrics(env)
if !CONFIG.statistics_enabled
env.response.status_code = 204
return
end
env.response.content_type = "text/plain"
return String.build do |str|
Metrics::RouteMetricsCollector.num_of_request_counters.each do |metric_labels, value|
str << "http_requests_total{"
str << "method=\"" << metric_labels.request_method << "\" "
str << "route=\"" << metric_labels.request_route << "\" "
str << "response_code=\"" << metric_labels.response_code << "\""
str << "} "
str << value << "\n"
end
Metrics::RouteMetricsCollector.request_duration_seconds_sums.each do |metric_labels, value|
str << "http_request_duration_seconds_sum{"
str << "method=\"" << metric_labels.request_method << "\" "
str << "route=\"" << metric_labels.request_route << "\" "
str << "response_code=\"" << metric_labels.response_code << "\""
str << "} "
str << value << "\n"
end
Invidious::Jobs::StatisticsRefreshJob::STATISTICS_PROMETHEUS.each.each do |key, value|
str << key << " " << value << "\n"
end
end
end
# APIv1 currently uses the same logic for both
# user playlists and Invidious playlists. This means that we can't
# reasonably split them yet. This should be addressed in APIv2