Skip to content

Commit dea724f

Browse files
MB-51323: [BP] Ignore path when counting 4** http ...
...requests Otherwise it may lead to a huge number of time series created in prometheus. Simplest scenario: while true; do curl "http://127.0.0.1:9000/$RANDOM" -v; done Change-Id: I30452447d60f029ef9bb70df9789cea6b01d6c35 Reviewed-on: https://review.couchbase.org/c/ns_server/+/172311 Well-Formed: Restriction Checker Well-Formed: Build Bot <[email protected]> Reviewed-by: Steve Watanabe <[email protected]> Tested-by: Timofey Barmin <[email protected]>
1 parent 13aafb7 commit dea724f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/menelaus_util.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,14 @@ count_web_hit(Req, Resp) ->
251251
end,
252252
Scheme = mochiweb_request:get(scheme, Req),
253253
Method = mochiweb_request:get(method, Req),
254+
Code = mochiweb_response:get(code, Resp),
254255
Path = case string:lexemes(mochiweb_request:get(path, Req), "/") of
256+
_ when Code >= 400, Code < 500 -> "/*";
255257
[] -> "/";
256258
["pools"] -> "/pools";
257259
["pools", "default", P | _] -> "/pools/default/" ++ P ++ "/*";
258260
[P | _] -> "/" ++ P ++ "/*"
259261
end,
260-
Code = mochiweb_response:get(code, Resp),
261262
ResponseTime = menelaus_web:response_time_ms(Req),
262263
ns_server_stats:notify_counter(
263264
{<<"http_requests">>, [{scheme, Scheme}, {method, Method}, {path, Path},

0 commit comments

Comments
 (0)