prometheus-client 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7017e1e3c284f9558d758e91d4855ad97b5df63fdef115cee035aa0948aed30
4
- data.tar.gz: 52a7abaadf1addf7bf9303d73a31a14338429882b488eb80c2144a6817cfdb7d
3
+ metadata.gz: d86fc24651a441455a293ead401451df5f6954499943f9c752117fe5f879b5cd
4
+ data.tar.gz: 5aaa58ced22e1050e7a4687a44b251710d5f12281f1572a2375d71f733c4ffc0
5
5
  SHA512:
6
- metadata.gz: 1e3b2ff9368dacbdc175ea8cb709e1ad7be73b0d8e644468f65bf36f44b517798a28d7f5dab73b538519fc1a918f977e083e101986a761fdf2fe42ab719fcc1d
7
- data.tar.gz: 7fb5a1887a88f7687f2af5ef4839e26030da25cc0c51a03445bbb43706caf8d2231c65108cf3265cc024bc286d5dc8a38ec5d29145b39b2f0cbd0277f29f1972
6
+ metadata.gz: 81ddb196287e2d977e6210c6b56a58459cbf4eab56e6e38ac55929a4a59d9749c64f043153b64ae120c591ed35a364b088df3f156b9825b79c69df8bfecbb240
7
+ data.tar.gz: dfe9c36fc511b3adde97198d6e53705d62d7502af016e6636cd9191cb94434126ee4a0d80e73eccddf8ad3c2d0fe116319c1f769b8fdedfcd0213a3d1176abce
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prometheus
4
4
  module Client
5
- VERSION = '3.0.0'
5
+ VERSION = '4.0.0'
6
6
  end
7
7
  end
@@ -72,12 +72,12 @@ module Prometheus
72
72
  counter_labels = {
73
73
  code: code,
74
74
  method: env['REQUEST_METHOD'].downcase,
75
- path: strip_ids_from_path(path),
75
+ path: path,
76
76
  }
77
77
 
78
78
  duration_labels = {
79
79
  method: env['REQUEST_METHOD'].downcase,
80
- path: strip_ids_from_path(path),
80
+ path: path,
81
81
  }
82
82
 
83
83
  @requests.increment(labels: counter_labels)
@@ -87,52 +87,10 @@ module Prometheus
87
87
  nil
88
88
  end
89
89
 
90
- # While `PATH_INFO` is framework agnostic, and works for any Rack app, some Ruby web
91
- # frameworks pass a more useful piece of information into the request env - the
92
- # route that the request matched.
93
- #
94
- # This means that rather than using our generic `:id` and `:uuid` replacements in
95
- # the `path` label for any path segments that look like dynamic IDs, we can put the
96
- # actual route that matched in there, with correctly named parameters. For example,
97
- # if a Sinatra app defined a route like:
98
- #
99
- # get "/foo/:bar" do
100
- # ...
101
- # end
102
- #
103
- # instead of containing `/foo/:id`, the `path` label would contain `/foo/:bar`.
104
- #
105
- # Sadly, Rails is a notable exception, and (as far as I can tell at the time of
106
- # writing) doesn't provide this info in the request env.
107
90
  def generate_path(env)
108
- if env['sinatra.route']
109
- route = env['sinatra.route'].partition(' ').last
110
- elsif env['grape.routing_args']
111
- # We are deep in the weeds of an object that Grape passes into the request env,
112
- # but don't document any explicit guarantees about. Let's have a fallback in
113
- # case they change it down the line.
114
- #
115
- # This code would be neater with the safe navigation operator (`&.`) here rather
116
- # than the much more verbose `respond_to?` calls, but unlike Rails' `try`
117
- # method, it still raises an error if the object is non-nil, but doesn't respond
118
- # to the method being called on it.
119
- route = nil
120
-
121
- route_info = env.dig('grape.routing_args', :route_info)
122
- if route_info.respond_to?(:pattern)
123
- pattern = route_info.pattern
124
- if pattern.respond_to?(:origin)
125
- route = pattern.origin
126
- end
127
- end
128
-
129
- # Fall back to PATH_INFO if Grape change the structure of `grape.routing_args`
130
- route ||= env['PATH_INFO']
131
- else
132
- route = env['PATH_INFO']
133
- end
134
-
135
- [env['SCRIPT_NAME'], route].join
91
+ full_path = [env['SCRIPT_NAME'], env['PATH_INFO']].join
92
+
93
+ strip_ids_from_path(full_path)
136
94
  end
137
95
 
138
96
  def strip_ids_from_path(path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Kochie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-02-05 00:00:00.000000000 Z
13
+ date: 2022-03-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: benchmark-ips
@@ -71,7 +71,7 @@ files:
71
71
  - lib/prometheus/middleware/exporter.rb
72
72
  homepage: https://github.com/prometheus/client_ruby
73
73
  licenses:
74
- - Apache 2.0
74
+ - Apache-2.0
75
75
  metadata: {}
76
76
  post_install_message:
77
77
  rdoc_options: []
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.2.32
91
+ rubygems_version: 3.3.4
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: A suite of instrumentation metric primitivesthat can be exposed through a