Skip to content

Commit 1daa09e

Browse files
committed
Track VPN/Proxy Detected reason and subreason
1 parent 94a07f5 commit 1daa09e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/lib/helpers/metrics.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,21 @@ export class Metrics {
3939
'Number of times that the message "Sign in to confirm you’re not a bot." has been returned by Innertube API',
4040
);
4141

42+
private innertubeErrorReasonVpnProxyDetected = this.createCounter(
43+
"innertube_error_reason_VpnProxyDetected_total",
44+
'Number of times that the message "VPN/Proxy Detected" has been returned by Innertube API',
45+
);
46+
4247
private innertubeErrorSubreasonProtectCommunity = this.createCounter(
4348
"innertube_error_subreason_ProtectCommunity_total",
4449
'Number of times that the message "This helps protect our community." has been returned by Innertube API',
4550
);
4651

52+
private innertubeErrorSubreasonVpnProxyDetected = this.createCounter(
53+
"innertube_error_subreason_VpnProxyDetected_total",
54+
'Number of times that the message "To continue, turn off your VPN/Proxy. This will allow YouTube to locate the best content." has been returned by Innertube API',
55+
);
56+
4757
private innertubeErrorReasonUnknown = this.createCounter(
4858
"innertube_error_reason_unknown_total",
4959
"Number of times that an unknown reason has been returned by the Innertube API",
@@ -252,6 +262,11 @@ export class Metrics {
252262
return;
253263
}
254264

265+
if (error.vpnProxy) {
266+
this.innertubeErrorReasonVpnProxyDetected.inc();
267+
return;
268+
}
269+
255270
if (error.signInToConfirmBot) {
256271
this.innertubeErrorReasonSignIn.inc();
257272
return;
@@ -329,6 +344,11 @@ export class Metrics {
329344
return;
330345
}
331346

347+
if (error.vpnProxy) {
348+
this.innertubeErrorSubreasonVpnProxyDetected.inc();
349+
return;
350+
}
351+
332352
if (error.thisHelpsProtectCommunity) {
333353
this.innertubeErrorSubreasonProtectCommunity.inc();
334354
return;

0 commit comments

Comments
 (0)