invidious-companion-patches/patches/0012-add-metrics-for-proxy-retries.patch
Fijxu cd5f5db2c6
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m16s
add patch 0014
2025-03-26 12:25:22 -03:00

41 lines
1.5 KiB
Diff

From 75d88c65065d0d4e3af4651332c9d5fc4ad5c3cf Mon Sep 17 00:00:00 2001
From: Fijxu <fijxu@nadeko.net>
Date: Tue, 25 Mar 2025 00:07:28 -0300
Subject: [PATCH 12/14] add metrics for proxy retries
---
src/lib/helpers/metrics.ts | 5 +++++
src/lib/helpers/youtubePlayerHandling.ts | 1 +
2 files changed, 6 insertions(+)
diff --git a/src/lib/helpers/metrics.ts b/src/lib/helpers/metrics.ts
index 98ca83d..93c6b82 100644
--- a/src/lib/helpers/metrics.ts
+++ b/src/lib/helpers/metrics.ts
@@ -55,6 +55,11 @@ export class Metrics {
"Number failed requests made to the Innertube API for whatever reason",
);
+ public proxyRetry = this.createCounter(
+ "proxy_retry",
+ 'Times a request to innertube has been retried when it gets "This helps protect our community"',
+ );
+
public checkInnertubeResponse(videoData: IRawResponse) {
this.innertubeFailedRequest.inc();
diff --git a/src/lib/helpers/youtubePlayerHandling.ts b/src/lib/helpers/youtubePlayerHandling.ts
index 2ae878d..7b5f0c1 100644
--- a/src/lib/helpers/youtubePlayerHandling.ts
+++ b/src/lib/helpers/youtubePlayerHandling.ts
@@ -62,6 +62,7 @@ export const youtubePlayerParsing = async ({
console.log(
`[DEBUG] Got 'This helps protect our community', retrying request for ${videoId}. Retry ${retries} of ${maxRetries}`,
);
+ metrics?.proxyRetry.inc();
youtubePlayerResponse = await youtubePlayerReq(
innertubeClient,
videoId,
--
2.49.0