yabeda-anycable 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +35 -32
- data/README.md +2 -0
- data/grafana-dashboard.json +283 -0
- data/lib/yabeda/anycable/middleware.rb +3 -2
- data/lib/yabeda/anycable/version.rb +1 -1
- data/lib/yabeda/anycable.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4da9d968e7d617ba3db90b0f0090675c296530f2baea4350ee41ed506e06da0c
|
4
|
+
data.tar.gz: edc35b76bb13d5e2bb5b9b0ffd7660dfd5b6d05b404236b048da1033a1e7f433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 903ddeba8c0e58af2aeed7e6e98b63cbe9814f41aa4edcb317d7eb531b59d96329ccdce6ba12f959e292c35821b9f77e289087f1b16167d0fc4c65f2b33538d0
|
7
|
+
data.tar.gz: 18316773bf7eeb452fd5f842e9ce3269b654c8bbb7a563215cbe9f6f5c6e113edcc6d05ce7957381a32cf369e9eb2ecaae1f82da3031a337b990b9cbe1056a63
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
## [
|
1
|
+
## [0.1.2] - 2022-09-21
|
2
|
+
|
3
|
+
### Fixed
|
4
|
+
|
5
|
+
- Handle the case when application code raises an error on command. See [pull request №4](https://github.com/yabeda-rb/yabeda-anycable/pull/4)
|
6
|
+
|
7
|
+
## [0.1.1] - 2022-02-15
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Add instrumentation middleware to AnyCable RPC only when Yabeda is actually used (configured). See [issue №2](https://github.com/yabeda-rb/yabeda-anycable/issues/2)
|
2
12
|
|
3
13
|
## [0.1.0] - 2021-07-22
|
4
14
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
yabeda-anycable (0.1.
|
4
|
+
yabeda-anycable (0.1.1)
|
5
5
|
anycable-core (~> 1.1)
|
6
6
|
yabeda (~> 0.10)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
anycable-core (1.
|
11
|
+
anycable-core (1.2.0)
|
12
12
|
anyway_config (>= 2.1.0)
|
13
13
|
google-protobuf (>= 3.13)
|
14
|
-
anyway_config (2.
|
15
|
-
ruby-next-core (>= 0.
|
14
|
+
anyway_config (2.2.3)
|
15
|
+
ruby-next-core (>= 0.14.0)
|
16
16
|
ast (2.4.2)
|
17
17
|
byebug (11.1.3)
|
18
18
|
coderay (1.1.3)
|
19
19
|
concurrent-ruby (1.1.9)
|
20
|
-
diff-lcs (1.
|
21
|
-
dry-initializer (3.
|
22
|
-
google-protobuf (3.
|
20
|
+
diff-lcs (1.5.0)
|
21
|
+
dry-initializer (3.1.1)
|
22
|
+
google-protobuf (3.19.4)
|
23
23
|
method_source (1.0.0)
|
24
|
-
parallel (1.
|
25
|
-
parser (3.0.
|
24
|
+
parallel (1.21.0)
|
25
|
+
parser (3.1.0.0)
|
26
26
|
ast (~> 2.4.1)
|
27
27
|
pry (0.14.1)
|
28
28
|
coderay (~> 1.1)
|
@@ -30,45 +30,47 @@ GEM
|
|
30
30
|
pry-byebug (3.8.0)
|
31
31
|
byebug (~> 11.0)
|
32
32
|
pry (~> 0.10)
|
33
|
-
pry-doc (1.
|
33
|
+
pry-doc (1.3.0)
|
34
34
|
pry (~> 0.11)
|
35
35
|
yard (~> 0.9.11)
|
36
|
-
rainbow (3.
|
36
|
+
rainbow (3.1.1)
|
37
37
|
rake (13.0.6)
|
38
|
-
regexp_parser (2.
|
38
|
+
regexp_parser (2.2.1)
|
39
39
|
rexml (3.2.5)
|
40
|
-
rspec (3.
|
41
|
-
rspec-core (~> 3.
|
42
|
-
rspec-expectations (~> 3.
|
43
|
-
rspec-mocks (~> 3.
|
44
|
-
rspec-core (3.
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-expectations (3.
|
40
|
+
rspec (3.11.0)
|
41
|
+
rspec-core (~> 3.11.0)
|
42
|
+
rspec-expectations (~> 3.11.0)
|
43
|
+
rspec-mocks (~> 3.11.0)
|
44
|
+
rspec-core (3.11.0)
|
45
|
+
rspec-support (~> 3.11.0)
|
46
|
+
rspec-expectations (3.11.0)
|
47
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-mocks (3.
|
48
|
+
rspec-support (~> 3.11.0)
|
49
|
+
rspec-mocks (3.11.0)
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-support (3.
|
53
|
-
rubocop (1.
|
51
|
+
rspec-support (~> 3.11.0)
|
52
|
+
rspec-support (3.11.0)
|
53
|
+
rubocop (1.25.1)
|
54
54
|
parallel (~> 1.10)
|
55
|
-
parser (>= 3.
|
55
|
+
parser (>= 3.1.0.0)
|
56
56
|
rainbow (>= 2.2.2, < 4.0)
|
57
57
|
regexp_parser (>= 1.8, < 3.0)
|
58
58
|
rexml
|
59
|
-
rubocop-ast (>= 1.
|
59
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
60
60
|
ruby-progressbar (~> 1.7)
|
61
61
|
unicode-display_width (>= 1.4.0, < 3.0)
|
62
|
-
rubocop-ast (1.
|
62
|
+
rubocop-ast (1.15.2)
|
63
63
|
parser (>= 3.0.1.1)
|
64
|
-
ruby-next-core (0.
|
64
|
+
ruby-next-core (0.14.1)
|
65
65
|
ruby-progressbar (1.11.0)
|
66
|
-
unicode-display_width (2.
|
67
|
-
|
68
|
-
|
66
|
+
unicode-display_width (2.1.0)
|
67
|
+
webrick (1.7.0)
|
68
|
+
yabeda (0.11.0)
|
69
|
+
anyway_config (>= 1.0, < 3)
|
69
70
|
concurrent-ruby
|
70
71
|
dry-initializer
|
71
|
-
yard (0.9.
|
72
|
+
yard (0.9.27)
|
73
|
+
webrick (~> 1.7.0)
|
72
74
|
|
73
75
|
PLATFORMS
|
74
76
|
x86_64-linux
|
@@ -80,6 +82,7 @@ DEPENDENCIES
|
|
80
82
|
rake (~> 13.0)
|
81
83
|
rspec (~> 3.0)
|
82
84
|
rubocop (~> 1.7)
|
85
|
+
yabeda (~> 0.11)
|
83
86
|
yabeda-anycable!
|
84
87
|
|
85
88
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Built-in metrics for monitoring [AnyCable] RPC server out of the box! Part of th
|
|
4
4
|
|
5
5
|
See [AnyCable architecture](https://docs.anycable.io/architecture) on details on what AnyCable RPC server is. For monitoring of [AnyCable] websocket server you will need to use [monitoring capabilities](https://docs.anycable.io/anycable-go/instrumentation) built in [anycable-go] itself.
|
6
6
|
|
7
|
+
Get sample Grafana dashboard from [Grafana.com #14793](https://grafana.com/grafana/dashboards/14793) or from [`grafana-dashboard.json`](./grafana-dashboard.json) file.
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
```ruby
|
@@ -0,0 +1,283 @@
|
|
1
|
+
{
|
2
|
+
"__inputs": [
|
3
|
+
{
|
4
|
+
"name": "DS_PROMETHEUS",
|
5
|
+
"label": "Prometheus",
|
6
|
+
"description": "",
|
7
|
+
"type": "datasource",
|
8
|
+
"pluginId": "prometheus",
|
9
|
+
"pluginName": "Prometheus"
|
10
|
+
}
|
11
|
+
],
|
12
|
+
"__requires": [
|
13
|
+
{
|
14
|
+
"type": "grafana",
|
15
|
+
"id": "grafana",
|
16
|
+
"name": "Grafana",
|
17
|
+
"version": "6.6.0"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"type": "panel",
|
21
|
+
"id": "graph",
|
22
|
+
"name": "Graph",
|
23
|
+
"version": ""
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"type": "datasource",
|
27
|
+
"id": "prometheus",
|
28
|
+
"name": "Prometheus",
|
29
|
+
"version": "1.0.0"
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"annotations": {
|
33
|
+
"list": [
|
34
|
+
{
|
35
|
+
"builtIn": 1,
|
36
|
+
"datasource": "-- Grafana --",
|
37
|
+
"enable": true,
|
38
|
+
"hide": true,
|
39
|
+
"iconColor": "rgba(0, 211, 255, 1)",
|
40
|
+
"name": "Annotations & Alerts",
|
41
|
+
"type": "dashboard"
|
42
|
+
}
|
43
|
+
]
|
44
|
+
},
|
45
|
+
"description": "",
|
46
|
+
"editable": true,
|
47
|
+
"gnetId": null,
|
48
|
+
"graphTooltip": 0,
|
49
|
+
"id": null,
|
50
|
+
"links": [
|
51
|
+
{
|
52
|
+
"asDropdown": false,
|
53
|
+
"icon": "doc",
|
54
|
+
"includeVars": false,
|
55
|
+
"keepTime": false,
|
56
|
+
"tags": [],
|
57
|
+
"targetBlank": true,
|
58
|
+
"title": "yabeda-anycable",
|
59
|
+
"tooltip": "Open anycable-yabeda homepage and docs",
|
60
|
+
"type": "link",
|
61
|
+
"url": "https://github.com/yabeda-rb/yabeda-anycable"
|
62
|
+
}
|
63
|
+
],
|
64
|
+
"panels": [
|
65
|
+
{
|
66
|
+
"aliasColors": {},
|
67
|
+
"bars": false,
|
68
|
+
"dashLength": 10,
|
69
|
+
"dashes": false,
|
70
|
+
"datasource": null,
|
71
|
+
"decimals": null,
|
72
|
+
"fieldConfig": {
|
73
|
+
"defaults": {},
|
74
|
+
"overrides": []
|
75
|
+
},
|
76
|
+
"fill": 1,
|
77
|
+
"fillGradient": 0,
|
78
|
+
"gridPos": {
|
79
|
+
"h": 9,
|
80
|
+
"w": 23,
|
81
|
+
"x": 0,
|
82
|
+
"y": 0
|
83
|
+
},
|
84
|
+
"hiddenSeries": false,
|
85
|
+
"id": 4,
|
86
|
+
"legend": {
|
87
|
+
"alignAsTable": true,
|
88
|
+
"avg": false,
|
89
|
+
"current": true,
|
90
|
+
"hideEmpty": true,
|
91
|
+
"max": true,
|
92
|
+
"min": false,
|
93
|
+
"rightSide": true,
|
94
|
+
"show": true,
|
95
|
+
"sideWidth": 350,
|
96
|
+
"sort": "max",
|
97
|
+
"sortDesc": true,
|
98
|
+
"total": false,
|
99
|
+
"values": true
|
100
|
+
},
|
101
|
+
"lines": true,
|
102
|
+
"linewidth": 1,
|
103
|
+
"nullPointMode": "null",
|
104
|
+
"options": {
|
105
|
+
"alertThreshold": true
|
106
|
+
},
|
107
|
+
"percentage": false,
|
108
|
+
"pluginVersion": "7.5.3",
|
109
|
+
"pointradius": 2,
|
110
|
+
"points": false,
|
111
|
+
"renderer": "flot",
|
112
|
+
"seriesOverrides": [],
|
113
|
+
"spaceLength": 10,
|
114
|
+
"stack": false,
|
115
|
+
"steppedLine": false,
|
116
|
+
"targets": [
|
117
|
+
{
|
118
|
+
"exemplar": true,
|
119
|
+
"expr": "histogram_quantile(0.95, sum(rate(anycable_rpc_call_runtime_seconds_bucket[1m])) by (method,command,le))",
|
120
|
+
"interval": "",
|
121
|
+
"legendFormat": "{{method}}: {{command}}",
|
122
|
+
"refId": "A"
|
123
|
+
}
|
124
|
+
],
|
125
|
+
"thresholds": [],
|
126
|
+
"timeFrom": null,
|
127
|
+
"timeRegions": [],
|
128
|
+
"timeShift": null,
|
129
|
+
"title": "RPC call runtime (95th percentile)",
|
130
|
+
"tooltip": {
|
131
|
+
"shared": true,
|
132
|
+
"sort": 2,
|
133
|
+
"value_type": "individual"
|
134
|
+
},
|
135
|
+
"type": "graph",
|
136
|
+
"xaxis": {
|
137
|
+
"buckets": null,
|
138
|
+
"mode": "time",
|
139
|
+
"name": null,
|
140
|
+
"show": true,
|
141
|
+
"values": []
|
142
|
+
},
|
143
|
+
"yaxes": [
|
144
|
+
{
|
145
|
+
"format": "s",
|
146
|
+
"label": null,
|
147
|
+
"logBase": 1,
|
148
|
+
"max": null,
|
149
|
+
"min": "0",
|
150
|
+
"show": true
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"format": "short",
|
154
|
+
"label": null,
|
155
|
+
"logBase": 1,
|
156
|
+
"max": null,
|
157
|
+
"min": null,
|
158
|
+
"show": false
|
159
|
+
}
|
160
|
+
],
|
161
|
+
"yaxis": {
|
162
|
+
"align": false,
|
163
|
+
"alignLevel": null
|
164
|
+
}
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"aliasColors": {},
|
168
|
+
"bars": false,
|
169
|
+
"dashLength": 10,
|
170
|
+
"dashes": false,
|
171
|
+
"datasource": null,
|
172
|
+
"fieldConfig": {
|
173
|
+
"defaults": {},
|
174
|
+
"overrides": []
|
175
|
+
},
|
176
|
+
"fill": 1,
|
177
|
+
"fillGradient": 0,
|
178
|
+
"gridPos": {
|
179
|
+
"h": 9,
|
180
|
+
"w": 23,
|
181
|
+
"x": 0,
|
182
|
+
"y": 9
|
183
|
+
},
|
184
|
+
"hiddenSeries": false,
|
185
|
+
"id": 2,
|
186
|
+
"legend": {
|
187
|
+
"alignAsTable": true,
|
188
|
+
"avg": false,
|
189
|
+
"current": true,
|
190
|
+
"hideEmpty": true,
|
191
|
+
"max": true,
|
192
|
+
"min": false,
|
193
|
+
"rightSide": true,
|
194
|
+
"show": true,
|
195
|
+
"sideWidth": 350,
|
196
|
+
"sort": "max",
|
197
|
+
"sortDesc": true,
|
198
|
+
"total": false,
|
199
|
+
"values": true
|
200
|
+
},
|
201
|
+
"lines": true,
|
202
|
+
"linewidth": 1,
|
203
|
+
"nullPointMode": "null",
|
204
|
+
"options": {
|
205
|
+
"alertThreshold": true
|
206
|
+
},
|
207
|
+
"percentage": false,
|
208
|
+
"pluginVersion": "7.5.3",
|
209
|
+
"pointradius": 2,
|
210
|
+
"points": false,
|
211
|
+
"renderer": "flot",
|
212
|
+
"seriesOverrides": [],
|
213
|
+
"spaceLength": 10,
|
214
|
+
"stack": false,
|
215
|
+
"steppedLine": false,
|
216
|
+
"targets": [
|
217
|
+
{
|
218
|
+
"exemplar": true,
|
219
|
+
"expr": "sum(rate(anycable_rpc_call_count[1m])) by (method, command, status)",
|
220
|
+
"interval": "",
|
221
|
+
"legendFormat": "{{method}}: {{command}} ({{status}})",
|
222
|
+
"refId": "A"
|
223
|
+
}
|
224
|
+
],
|
225
|
+
"thresholds": [],
|
226
|
+
"timeFrom": null,
|
227
|
+
"timeRegions": [],
|
228
|
+
"timeShift": null,
|
229
|
+
"title": "RPC call throughput",
|
230
|
+
"tooltip": {
|
231
|
+
"shared": true,
|
232
|
+
"sort": 2,
|
233
|
+
"value_type": "individual"
|
234
|
+
},
|
235
|
+
"type": "graph",
|
236
|
+
"xaxis": {
|
237
|
+
"buckets": null,
|
238
|
+
"mode": "time",
|
239
|
+
"name": null,
|
240
|
+
"show": true,
|
241
|
+
"values": []
|
242
|
+
},
|
243
|
+
"yaxes": [
|
244
|
+
{
|
245
|
+
"decimals": 0,
|
246
|
+
"format": "reqps",
|
247
|
+
"label": null,
|
248
|
+
"logBase": 1,
|
249
|
+
"max": null,
|
250
|
+
"min": "0",
|
251
|
+
"show": true
|
252
|
+
},
|
253
|
+
{
|
254
|
+
"format": "short",
|
255
|
+
"label": null,
|
256
|
+
"logBase": 1,
|
257
|
+
"max": null,
|
258
|
+
"min": null,
|
259
|
+
"show": false
|
260
|
+
}
|
261
|
+
],
|
262
|
+
"yaxis": {
|
263
|
+
"align": false,
|
264
|
+
"alignLevel": null
|
265
|
+
}
|
266
|
+
}
|
267
|
+
],
|
268
|
+
"schemaVersion": 27,
|
269
|
+
"style": "dark",
|
270
|
+
"tags": [],
|
271
|
+
"templating": {
|
272
|
+
"list": []
|
273
|
+
},
|
274
|
+
"time": {
|
275
|
+
"from": "now-6h",
|
276
|
+
"to": "now"
|
277
|
+
},
|
278
|
+
"timepicker": {},
|
279
|
+
"timezone": "",
|
280
|
+
"title": "AnyCable RPC",
|
281
|
+
"uid": "yabeda-anycable",
|
282
|
+
"version": 1
|
283
|
+
}
|
@@ -11,8 +11,9 @@ module Yabeda
|
|
11
11
|
(response = yield)
|
12
12
|
ensure
|
13
13
|
elapsed = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - started).round(4)
|
14
|
-
|
15
|
-
|
14
|
+
status = response.respond_to?(:status) ? response.status.to_s : "ERROR"
|
15
|
+
command = request.respond_to?(:command) ? request.command : ""
|
16
|
+
labels = { method: rpc_method_name.to_s, status: status, command: command }
|
16
17
|
::Yabeda.anycable.rpc_call_count.increment(labels)
|
17
18
|
::Yabeda.anycable.rpc_call_runtime.measure(labels, elapsed)
|
18
19
|
end
|
data/lib/yabeda/anycable.rb
CHANGED
@@ -16,9 +16,9 @@ module Yabeda
|
|
16
16
|
].freeze
|
17
17
|
|
18
18
|
::AnyCable.configure_server do
|
19
|
-
::AnyCable.middleware.use(Middleware)
|
20
|
-
|
21
19
|
::Yabeda.configure do
|
20
|
+
::AnyCable.middleware.use(Middleware)
|
21
|
+
|
22
22
|
group :anycable
|
23
23
|
|
24
24
|
counter :rpc_call_count, tags: %i[method command status], comment: "RPC calls count"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-anycable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anycable-core
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- Rakefile
|
62
62
|
- bin/console
|
63
63
|
- bin/setup
|
64
|
+
- grafana-dashboard.json
|
64
65
|
- lib/yabeda/anycable.rb
|
65
66
|
- lib/yabeda/anycable/middleware.rb
|
66
67
|
- lib/yabeda/anycable/version.rb
|
@@ -88,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
89
|
- !ruby/object:Gem::Version
|
89
90
|
version: '0'
|
90
91
|
requirements: []
|
91
|
-
rubygems_version: 3.2.
|
92
|
+
rubygems_version: 3.2.33
|
92
93
|
signing_key:
|
93
94
|
specification_version: 4
|
94
95
|
summary: Collect performance metrics for AnyCable RPC server
|