invidious-companion-patches/patches/0010-add-metrics-for-proxy-retries.patch
Fijxu a774a714fa
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m14s
update patches and invidious-companion
2025-03-27 21:28:16 -03:00

41 lines
1.5 KiB
Diff

From 99a492d9bafd6f5bd1482df08441ebb703b45a59 Mon Sep 17 00:00:00 2001
From: Fijxu <fijxu@nadeko.net>
Date: Tue, 25 Mar 2025 00:07:28 -0300
Subject: [PATCH 10/12] 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