Commit f9c233df authored by Ben Kochie's avatar Ben Kochie Committed by Peter Leitzen

Cleanup request http method/code metrics

Remove 13 of the 93 request method codes from Prometheus metrics
intialization. Reduces un-used/extremely rare metrics by 14%

Filter method label by the list of valid request methods.
Signed-off-by: default avatarBen Kochie <bjk@gitlab.com>
parent b6d6708d
---
title: Cleanup request http method/code metrics
merge_request: 42618
author:
type: performance
......@@ -4,15 +4,13 @@ module Gitlab
module Metrics
class RequestsRackMiddleware
HTTP_METHODS = {
"delete" => %w(200 202 204 303 400 401 403 404 410 422 500 503),
"get" => %w(200 204 301 302 303 304 307 400 401 403 404 410 412 422 429 500 503),
"head" => %w(200 204 301 302 303 304 400 401 403 404 410 429 500 503),
"delete" => %w(200 202 204 303 400 401 403 404 500 503),
"get" => %w(200 204 301 302 303 304 307 400 401 403 404 410 422 429 500 503),
"head" => %w(200 204 301 302 303 401 403 404 410 500),
"options" => %w(200 404),
"patch" => %w(200 202 204 400 403 404 409 416 422 500),
"post" => %w(200 201 202 204 301 302 303 304 400 401 403 404 406 409 410 412 413 415 422 429 500 503),
"propfind" => %w(404),
"put" => %w(200 202 204 400 401 403 404 405 406 409 410 415 422 500),
"report" => %w(404)
"patch" => %w(200 202 204 400 403 404 409 416 500),
"post" => %w(200 201 202 204 301 302 303 304 400 401 403 404 406 409 410 412 422 429 500 503),
"put" => %w(200 202 204 400 401 403 404 405 406 409 410 422 500)
}.freeze
HEALTH_ENDPOINT = /^\/-\/(liveness|readiness|health|metrics)\/?$/.freeze
......@@ -48,6 +46,7 @@ module Gitlab
def call(env)
method = env['REQUEST_METHOD'].downcase
method = 'INVALID' unless HTTP_METHODS.key?(method)
started = Time.now.to_f
begin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment