Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename http_req_duration_seconds to http_request_duration_seconds #48

Merged
merged 3 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', "3.1", "3.2"]
ruby: ["3.0", "3.1", "3.2"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
188 changes: 98 additions & 90 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,67 +10,67 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.4.2)
actionpack (= 7.0.4.2)
activesupport (= 7.0.4.2)
actioncable (7.0.6)
actionpack (= 7.0.6)
activesupport (= 7.0.6)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.4.2)
actionpack (= 7.0.4.2)
activejob (= 7.0.4.2)
activerecord (= 7.0.4.2)
activestorage (= 7.0.4.2)
activesupport (= 7.0.4.2)
actionmailbox (7.0.6)
actionpack (= 7.0.6)
activejob (= 7.0.6)
activerecord (= 7.0.6)
activestorage (= 7.0.6)
activesupport (= 7.0.6)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.4.2)
actionpack (= 7.0.4.2)
actionview (= 7.0.4.2)
activejob (= 7.0.4.2)
activesupport (= 7.0.4.2)
actionmailer (7.0.6)
actionpack (= 7.0.6)
actionview (= 7.0.6)
activejob (= 7.0.6)
activesupport (= 7.0.6)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.4.2)
actionview (= 7.0.4.2)
activesupport (= 7.0.4.2)
rack (~> 2.0, >= 2.2.0)
actionpack (7.0.6)
actionview (= 7.0.6)
activesupport (= 7.0.6)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.4.2)
actionpack (= 7.0.4.2)
activerecord (= 7.0.4.2)
activestorage (= 7.0.4.2)
activesupport (= 7.0.4.2)
actiontext (7.0.6)
actionpack (= 7.0.6)
activerecord (= 7.0.6)
activestorage (= 7.0.6)
activesupport (= 7.0.6)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.4.2)
activesupport (= 7.0.4.2)
actionview (7.0.6)
activesupport (= 7.0.6)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.4.2)
activesupport (= 7.0.4.2)
activejob (7.0.6)
activesupport (= 7.0.6)
globalid (>= 0.3.6)
activemodel (7.0.4.2)
activesupport (= 7.0.4.2)
activerecord (7.0.4.2)
activemodel (= 7.0.4.2)
activesupport (= 7.0.4.2)
activestorage (7.0.4.2)
actionpack (= 7.0.4.2)
activejob (= 7.0.4.2)
activerecord (= 7.0.4.2)
activesupport (= 7.0.4.2)
activemodel (7.0.6)
activesupport (= 7.0.6)
activerecord (7.0.6)
activemodel (= 7.0.6)
activesupport (= 7.0.6)
activestorage (7.0.6)
actionpack (= 7.0.6)
activejob (= 7.0.6)
activerecord (= 7.0.6)
activesupport (= 7.0.6)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.4.2)
activesupport (7.0.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -89,12 +89,13 @@ GEM
erubi (1.12.0)
globalid (1.1.0)
activesupport (>= 5.0)
i18n (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.3)
loofah (2.19.1)
language_server-protocol (3.17.0.3)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
Expand All @@ -103,9 +104,9 @@ GEM
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
minitest (5.17.0)
net-imap (0.3.4)
mini_portile2 (2.8.4)
minitest (5.18.1)
net-imap (0.3.6)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -114,58 +115,61 @@ GEM
timeout
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.14.2)
mini_portile2 (~> 2.8.0)
nio4r (2.5.9)
nokogiri (1.15.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.22.1)
parser (3.2.1.0)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
prometheus-client-mmap (0.16.2)
racc (1.6.2)
rack (2.2.6.3)
rack-test (2.0.2)
racc (1.7.1)
rack (2.2.7)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.4.2)
actioncable (= 7.0.4.2)
actionmailbox (= 7.0.4.2)
actionmailer (= 7.0.4.2)
actionpack (= 7.0.4.2)
actiontext (= 7.0.4.2)
actionview (= 7.0.4.2)
activejob (= 7.0.4.2)
activemodel (= 7.0.4.2)
activerecord (= 7.0.4.2)
activestorage (= 7.0.4.2)
activesupport (= 7.0.4.2)
rails (7.0.6)
actioncable (= 7.0.6)
actionmailbox (= 7.0.6)
actionmailer (= 7.0.6)
actionpack (= 7.0.6)
actiontext (= 7.0.6)
actionview (= 7.0.6)
activejob (= 7.0.6)
activemodel (= 7.0.6)
activerecord (= 7.0.6)
activestorage (= 7.0.6)
activesupport (= 7.0.6)
bundler (>= 1.15.0)
railties (= 7.0.4.2)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
railties (= 7.0.6)
rails-dom-testing (2.1.1)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
railties (7.0.4.2)
actionpack (= 7.0.4.2)
activesupport (= 7.0.4.2)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.6)
actionpack (= 7.0.6)
activesupport (= 7.0.6)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.7.0)
regexp_parser (2.8.1)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.1)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.3)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (5.1.2)
Expand All @@ -176,48 +180,52 @@ GEM
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.12.0)
rubocop (1.47.0)
rspec-support (3.12.1)
rubocop (1.54.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.0.0)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.26.0, < 2.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.27.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.17.1)
rubocop-capybara (2.18.0)
rubocop (~> 1.41)
rubocop-performance (1.16.0)
rubocop-factory_bot (2.23.1)
rubocop (~> 1.33)
rubocop-performance (1.18.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.18.0)
rubocop-rails (2.20.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-rspec (2.18.1)
rubocop-rspec (2.22.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
ruby-progressbar (1.12.0)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
thor (1.2.1)
timeout (0.3.2)
thor (1.2.2)
timeout (0.4.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
webrick (1.8.1)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.7)
zeitwerk (2.6.8)

PLATFORMS
ruby
Expand All @@ -240,4 +248,4 @@ DEPENDENCIES
webrick

BUNDLED WITH
2.3.16
2.4.17
6 changes: 3 additions & 3 deletions lib/promenade/client/rack/http_request_duration_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ module Promenade
module Client
module Rack
class HTTPRequestDurationCollector < MiddlwareBase
REQUEST_DURATION_HISTOGRAM_NAME = :http_req_duration_seconds
REQUEST_DURATION_HISTOGRAM_NAME = :http_request_duration_seconds

# We specifically want to record a separate metric `http_requests_total` even
# though we know it is a duplicate of http_req_duration_seconds_count.
# though we know it is a duplicate of http_request_duration_seconds_count.
# This is a very commonly used prometheus metric name, and is very useful
# e.g. for autoscaling. Using the http_req_duration_seconds_count in such
# e.g. for autoscaling. Using the http_request_duration_seconds_count in such
# queries can be confusing
REQUESTS_COUNTER_NAME = :http_requests_total

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Promenade
module Client
module Rack
class HTTPRequestQueueTimeCollector < MiddlwareBase
REQUEST_QUEUE_TIME_HISTOGRAM_NAME = :http_req_queue_time_seconds
REQUEST_QUEUE_TIME_HISTOGRAM_NAME = :http_request_queue_time_seconds

private_constant :REQUEST_QUEUE_TIME_HISTOGRAM_NAME

Expand Down
10 changes: 5 additions & 5 deletions spec/integration/exception_handling_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

RSpec.describe "Prometheus request tracking middleware", type: :request do
it "counts the desired labels for successful requests" do
histogram = Prometheus::Client.registry.get(:http_req_duration_seconds)
histogram = Prometheus::Client.registry.get(:http_request_duration_seconds)
response_duration = 1.0
expected_labels = {
code: "200",
Expand All @@ -21,7 +21,7 @@
end

it "counts the expected labels for 5XX error requests" do
histogram = Prometheus::Client.registry.get(:http_req_duration_seconds)
histogram = Prometheus::Client.registry.get(:http_request_duration_seconds)
response_duration = 1.0
expected_labels = {
code: "500",
Expand All @@ -40,7 +40,7 @@
end

it "counts the expected labels for 4XX error requests" do
histogram = Prometheus::Client.registry.get(:http_req_duration_seconds)
histogram = Prometheus::Client.registry.get(:http_request_duration_seconds)
response_duration = 1.0
expected_labels = {
code: "418",
Expand All @@ -59,7 +59,7 @@
end

it "counts the expected labels for 404 error requests" do
histogram = Prometheus::Client.registry.get(:http_req_duration_seconds)
histogram = Prometheus::Client.registry.get(:http_request_duration_seconds)
response_duration = 1.0
expected_labels = {
code: "404",
Expand All @@ -78,7 +78,7 @@
end

it "uses the correct labels for error requests that are redirected" do
histogram = Prometheus::Client.registry.get(:http_req_duration_seconds)
histogram = Prometheus::Client.registry.get(:http_request_duration_seconds)
response_duration = 1.0
expected_labels = {
code: "404",
Expand Down
Loading