redis_prometheus 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/redis_prometheus/middleware.rb +11 -6
- data/lib/redis_prometheus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d15bbf875ba90d1b3ae7cf5ce8c72e63846c3d4
|
4
|
+
data.tar.gz: 6524739795f794f0e9526cfffdcd8f9f6ae58254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8c479113ccee0b721b5ec4db66d1c7e272591cda666b5fd6dbef366abd021ca8a247b205446ecc8feb47af9fae7f95fa5d124526c6791878b8345405efeae06
|
7
|
+
data.tar.gz: 86ef33622f0083a7ef8e9b81b0b3d4027b0d6c30c537a94ed9127a01b3c794dabfc3b73a558b7d478e2e22f081f8b6b4e9906c68dda89aa79e2bd91aeca9fddf
|
@@ -51,10 +51,15 @@ module RedisPrometheus
|
|
51
51
|
response << "} #{values[i].to_f}\n"
|
52
52
|
end
|
53
53
|
|
54
|
-
response << "# TYPE
|
55
|
-
response << "# HELP
|
56
|
-
requests = Redis.current.get("
|
57
|
-
response << "
|
54
|
+
response << "# TYPE http_request_duration_seconds_count counter\n"
|
55
|
+
response << "# HELP http_request_duration_seconds_count The total number of HTTP requests handled by the Rack application.\n"
|
56
|
+
requests = Redis.current.get("http_request_duration_seconds_count/#{ENV["REDIS_PROMETHEUS_SERVICE"]}") || 0
|
57
|
+
response << "http_request_duration_seconds_count{service=\"#{ENV["REDIS_PROMETHEUS_SERVICE"]}\"} #{requests.to_f}\n"
|
58
|
+
|
59
|
+
response << "# TYPE http_request_duration_seconds_sum counter\n"
|
60
|
+
response << "# HELP http_request_duration_seconds_sum The total number of seconds spent processing HTTP requests by the Rack application.\n"
|
61
|
+
requests = Redis.current.get("http_request_duration_seconds_sum/#{ENV["REDIS_PROMETHEUS_SERVICE"]}") || 0
|
62
|
+
response << "http_request_duration_seconds_sum{service=\"#{ENV["REDIS_PROMETHEUS_SERVICE"]}\"} #{requests.to_f}\n"
|
58
63
|
|
59
64
|
response << "# TYPE http_request_client_errors_counter counter\n"
|
60
65
|
response << "# HELP http_request_client_errors_counter The total number of HTTP errors return by the Rack application.\n"
|
@@ -83,8 +88,8 @@ module RedisPrometheus
|
|
83
88
|
|
84
89
|
bucket = duration_to_bucket(duration)
|
85
90
|
Redis.current.incr("http_request_duration_seconds_bucket/#{ENV["REDIS_PROMETHEUS_SERVICE"]}:url=#{url}:le=#{bucket}")
|
86
|
-
Redis.current.incr("
|
87
|
-
Redis.current.incrbyfloat("
|
91
|
+
Redis.current.incr("http_request_duration_seconds_count/#{ENV["REDIS_PROMETHEUS_SERVICE"]}")
|
92
|
+
Redis.current.incrbyfloat("http_request_duration_seconds_sum/#{ENV["REDIS_PROMETHEUS_SERVICE"]}", duration)
|
88
93
|
if code.to_i >= 400 && code.to_i <= 499
|
89
94
|
Redis.current.incr("http_request_client_errors_counter/#{ENV["REDIS_PROMETHEUS_SERVICE"]}")
|
90
95
|
end
|