add videoplayback rx bytes metrics
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m8s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m8s
This commit is contained in:
parent
2bbe02b69d
commit
ce634d128a
1 changed files with 50 additions and 0 deletions
50
patches/0012-add-videoplayback-rx-bytes-metrics.patch
Normal file
50
patches/0012-add-videoplayback-rx-bytes-metrics.patch
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
From 01e545dc92027614ba3a9c514fa4f2a3c1c0fa9d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fijxu <fijxu@nadeko.net>
|
||||||
|
Date: Sat, 5 Apr 2025 03:42:58 -0300
|
||||||
|
Subject: [PATCH 12/12] add videoplayback rx bytes metrics
|
||||||
|
|
||||||
|
---
|
||||||
|
src/lib/helpers/metrics.ts | 5 +++++
|
||||||
|
src/routes/videoPlaybackProxy.ts | 3 +++
|
||||||
|
2 files changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/lib/helpers/metrics.ts b/src/lib/helpers/metrics.ts
|
||||||
|
index 5dee540..27f84c3 100644
|
||||||
|
--- a/src/lib/helpers/metrics.ts
|
||||||
|
+++ b/src/lib/helpers/metrics.ts
|
||||||
|
@@ -63,6 +63,11 @@ export class Metrics {
|
||||||
|
'Times a request to innertube has been retried when it gets "This helps protect our community"',
|
||||||
|
);
|
||||||
|
|
||||||
|
+ public videoplaybackRxBytes = this.createCounter(
|
||||||
|
+ "videoplayback_rx_bytes_count",
|
||||||
|
+ 'How many bytes have been received from google servers',
|
||||||
|
+ );
|
||||||
|
+
|
||||||
|
private checkStatus(videoData: IRawResponse) {
|
||||||
|
const status = videoData.playabilityStatus?.status;
|
||||||
|
|
||||||
|
diff --git a/src/routes/videoPlaybackProxy.ts b/src/routes/videoPlaybackProxy.ts
|
||||||
|
index b6cce87..74d5324 100644
|
||||||
|
--- a/src/routes/videoPlaybackProxy.ts
|
||||||
|
+++ b/src/routes/videoPlaybackProxy.ts
|
||||||
|
@@ -35,6 +35,7 @@ videoPlaybackProxy.get("/", async (c) => {
|
||||||
|
const urlReq = new URL(c.req.url);
|
||||||
|
const config = c.get("config");
|
||||||
|
const queryParams = new URLSearchParams(urlReq.search);
|
||||||
|
+ const metrics = c.get("metrics");
|
||||||
|
|
||||||
|
if (c.req.query("enc") === "true") {
|
||||||
|
const { data: encryptedQuery } = c.req.query();
|
||||||
|
@@ -180,6 +181,8 @@ videoPlaybackProxy.get("/", async (c) => {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ metrics?.videoplaybackRxBytes.inc(Number(googlevideoResponse.headers.get("content-length")))
|
||||||
|
+
|
||||||
|
return new Response(googlevideoResponse.body, {
|
||||||
|
status: responseStatus,
|
||||||
|
statusText: googlevideoResponse.statusText,
|
||||||
|
--
|
||||||
|
2.49.0
|
||||||
|
|
Loading…
Add table
Reference in a new issue