Skip to content

Commit 107d1d9

Browse files
authored
understanding when the archived fallback redirects are used (#28128)
1 parent 0340760 commit 107d1d9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

middleware/archived-enterprise-versions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ export default async function archivedEnterpriseVersions(req, res, next) {
222222
}
223223

224224
for (const fallbackRedirect of getFallbackRedirects(req, requestedVersion) || []) {
225+
const statsTags = [`path:${req.path}`, `fallback:${fallbackRedirect}`]
225226
const doGet = () =>
226227
got(getProxyPath(fallbackRedirect, requestedVersion), {
227228
throwHttpErrors: false,
@@ -235,8 +236,10 @@ export default async function archivedEnterpriseVersions(req, res, next) {
235236
])()
236237
if (r.statusCode === 200) {
237238
cacheAggressively(res)
239+
statsd.increment('middleware.trying_fallback_redirect_success', 1, statsTags)
238240
return res.redirect(redirectCode, fallbackRedirect)
239241
}
242+
statsd.increment('middleware.trying_fallback_redirect_failure', 1, statsTags)
240243
}
241244

242245
return next()

0 commit comments

Comments
 (0)