airbrake-ruby 3.0.0.rc.3 → 3.0.0.rc.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/airbrake-ruby/route_sender.rb +3 -3
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/route_sender_spec.rb +9 -9
- 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: a2c26bbe2effb0671dd84b762fa9787e8f5bc4cb
|
4
|
+
data.tar.gz: 964f77831dc4162e3268f5714c11ef648c2609f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4979b96aa750761944b0d778a625801f808dc08cf92b81c722cdf309d0b02986c83b02786e93922ebe1dcf280acc73a500010fb21ca9192c2c709b7bfda286e0
|
7
|
+
data.tar.gz: e0f39ae0d44ab1d13dfc3066caecc1eeedbb21260c3f34a923054b8bcd6240ea6f438e677be59a1dbb12d0fc7ec54e64a1a83b1861a1659bb4f3e2eacc2407e7
|
@@ -49,7 +49,7 @@ module Airbrake
|
|
49
49
|
using TDigestBigEndianness
|
50
50
|
|
51
51
|
# The key that represents a route.
|
52
|
-
RouteKey = Struct.new(:method, :route, :
|
52
|
+
RouteKey = Struct.new(:method, :route, :status_code, :time)
|
53
53
|
|
54
54
|
# RouteStat holds data that describes a route's performance.
|
55
55
|
RouteStat = Struct.new(:count, :sum, :sumsq, :tdigest) do
|
@@ -71,7 +71,7 @@ module Airbrake
|
|
71
71
|
'count' => count,
|
72
72
|
'sum' => sum,
|
73
73
|
'sumsq' => sumsq,
|
74
|
-
'
|
74
|
+
'tdigest' => Base64.strict_encode64(tdigest.as_small_bytes)
|
75
75
|
}
|
76
76
|
end
|
77
77
|
end
|
@@ -156,7 +156,7 @@ module Airbrake
|
|
156
156
|
@sender.send(
|
157
157
|
{ routes: routes.map { |k, v| k.to_h.merge(v.to_h) } },
|
158
158
|
promise,
|
159
|
-
URI.join(@config.host, "api/
|
159
|
+
URI.join(@config.host, "api/v5/projects/#{@config.project_id}/routes-stats")
|
160
160
|
)
|
161
161
|
end
|
162
162
|
end
|
data/spec/route_sender_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Airbrake::RouteSender do
|
4
|
-
let(:endpoint) { 'https://api.airbrake.io/api/
|
4
|
+
let(:endpoint) { 'https://api.airbrake.io/api/v5/projects/1/routes-stats' }
|
5
5
|
|
6
6
|
let(:config) do
|
7
7
|
Airbrake::Config.new(
|
@@ -46,12 +46,12 @@ RSpec.describe Airbrake::RouteSender do
|
|
46
46
|
a_request(:put, endpoint).with(
|
47
47
|
body: %r|\A
|
48
48
|
{"routes":\[
|
49
|
-
{"method":"GET","route":"/foo","
|
49
|
+
{"method":"GET","route":"/foo","status_code":200,
|
50
50
|
"time":"2018-01-01T00:00:00\+00:00","count":1,"sum":24.0,
|
51
|
-
"sumsq":576.0,"
|
52
|
-
{"method":"GET","route":"/foo","
|
51
|
+
"sumsq":576.0,"tdigest":"AAAAAkA0AAAAAAAAAAAAAUHAAAAB"},
|
52
|
+
{"method":"GET","route":"/foo","status_code":200,
|
53
53
|
"time":"2018-01-01T00:01:00\+00:00","count":1,"sum":10.0,
|
54
|
-
"sumsq":100.0,"
|
54
|
+
"sumsq":100.0,"tdigest":"AAAAAkA0AAAAAAAAAAAAAUEgAAAB"}\]}
|
55
55
|
\z|x
|
56
56
|
)
|
57
57
|
).to have_been_made
|
@@ -65,12 +65,12 @@ RSpec.describe Airbrake::RouteSender do
|
|
65
65
|
a_request(:put, endpoint).with(
|
66
66
|
body: %r|\A
|
67
67
|
{"routes":\[
|
68
|
-
{"method":"GET","route":"/foo","
|
68
|
+
{"method":"GET","route":"/foo","status_code":200,
|
69
69
|
"time":"2018-01-01T00:00:00\+00:00","count":1,"sum":24.0,
|
70
|
-
"sumsq":576.0,"
|
71
|
-
{"method":"POST","route":"/foo","
|
70
|
+
"sumsq":576.0,"tdigest":"AAAAAkA0AAAAAAAAAAAAAUHAAAAB"},
|
71
|
+
{"method":"POST","route":"/foo","status_code":200,
|
72
72
|
"time":"2018-01-01T00:00:00\+00:00","count":1,"sum":10.0,
|
73
|
-
"sumsq":100.0,"
|
73
|
+
"sumsq":100.0,"tdigest":"AAAAAkA0AAAAAAAAAAAAAUEgAAAB"}\]}
|
74
74
|
\z|x
|
75
75
|
)
|
76
76
|
).to have_been_made
|