diff --git a/sinatra/Gemfile.lock b/sinatra/Gemfile.lock index 6764747..35532ce 100644 --- a/sinatra/Gemfile.lock +++ b/sinatra/Gemfile.lock @@ -73,7 +73,7 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.12) + rack (3.1.16) rack-protection (4.1.1) base64 (>= 0.1.0) logger (>= 1.6.0) diff --git a/sinatra/app.rb b/sinatra/app.rb index 93480b6..1d11f32 100644 --- a/sinatra/app.rb +++ b/sinatra/app.rb @@ -165,9 +165,10 @@ ################################################################################ # Counter for total HTTP responses served -APP_HTTP_RESPONSES_TOTAL = PROMETHEUS.counter( - :app_http_responses_total, - docstring: 'Total number of HTTP responses sent by the application.' +HTTP_RESPONSES_TOTAL = PROMETHEUS.counter( + :http_responses_total, + docstring: 'Total number of HTTP responses sent.', + labels: [:code, :path] ) # Histogram for request duration in seconds (or milliseconds) @@ -225,7 +226,7 @@ pass if @skip_metrics # Increment response counter regardless of duration calculation success - APP_HTTP_RESPONSES_TOTAL.increment + HTTP_RESPONSES_TOTAL.increment(labels: { code: response.status, path: request.path_info }) # Record duration if start time was captured if @request_start_time