influxdb-rails 1.0.1.beta2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +18 -0
- data/.github/workflows/spec.yml +32 -0
- data/.rubocop.yml +36 -7
- data/CHANGELOG.md +22 -1
- data/README.md +43 -34
- data/gemfiles/Gemfile.rails-6.0.x +1 -2
- data/gemfiles/Gemfile.rails-6.1.x +9 -0
- data/influxdb-rails.gemspec +2 -2
- data/lib/influxdb/rails/middleware/active_job_subscriber.rb +11 -11
- data/lib/influxdb/rails/middleware/request_subscriber.rb +9 -1
- data/lib/influxdb/rails/railtie.rb +0 -1
- data/lib/influxdb/rails/sql/normalizer.rb +3 -3
- data/lib/influxdb/rails/tags.rb +2 -2
- data/lib/influxdb/rails/values.rb +1 -1
- data/lib/influxdb/rails/version.rb +1 -1
- data/lib/influxdb-rails.rb +1 -2
- data/lib/rails/generators/influxdb/templates/initializer.rb +4 -0
- data/sample-dashboard/Dockerfile +2 -2
- data/sample-dashboard/README.md +21 -28
- data/sample-dashboard/Rakefile +10 -5
- data/sample-dashboard/Ruby On Rails ActiveJob.json +600 -0
- data/sample-dashboard/{Ruby On Rails Performance (per Action).json → Ruby On Rails Performance per Action.json } +343 -589
- data/sample-dashboard/{Ruby On Rails Performance (per Request).json → Ruby On Rails Performance per Request.json } +361 -211
- data/sample-dashboard/Ruby On Rails Performance.json +1347 -1139
- data/sample-dashboard/Ruby On Rails Requests.json +834 -0
- data/sample-dashboard/Ruby On Rails Slowlog by Action.json +278 -0
- data/sample-dashboard/Ruby On Rails Slowlog by Request.json +277 -0
- data/sample-dashboard/Ruby On Rails Slowlog by SQL.json +328 -0
- data/sample-dashboard/docker-compose.yml +6 -1
- data/sample-dashboard/provisioning/activejob.json +600 -0
- data/sample-dashboard/provisioning/performance-action.json +334 -580
- data/sample-dashboard/provisioning/performance-request.json +355 -205
- data/sample-dashboard/provisioning/performance.json +1336 -1128
- data/sample-dashboard/provisioning/requests.json +834 -0
- data/sample-dashboard/provisioning/slowlog-action.json +278 -0
- data/sample-dashboard/provisioning/slowlog-requests.json +277 -0
- data/sample-dashboard/provisioning/slowlog-sql.json +328 -0
- data/spec/requests/action_controller_metrics_spec.rb +24 -10
- data/spec/requests/action_mailer_deliver_metrics_spec.rb +4 -11
- data/spec/requests/action_view_collection_metrics_spec.rb +7 -16
- data/spec/requests/action_view_partial_metrics_spec.rb +6 -15
- data/spec/requests/action_view_template_metrics_spec.rb +6 -15
- data/spec/requests/active_job_enqueue_metrics_spec.rb +6 -15
- data/spec/requests/active_job_perform_metrics_spec.rb +5 -11
- data/spec/requests/active_record_instantiation_metrics_spec.rb +7 -16
- data/spec/requests/active_record_sql_metrics_spec.rb +13 -29
- data/spec/requests/block_inistrumentation_spec.rb +8 -17
- data/spec/requests/context_spec.rb +1 -1
- data/spec/requests/logger_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/support/rails5/app.rb +3 -4
- data/spec/support/rails6/app.rb +3 -4
- data/spec/unit/tags.rb +47 -0
- metadata +25 -14
- data/.travis.yml +0 -28
- data/spec/requests/active_job_perform_start_metrics_spec.rb +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 613267c17473f3d84942b39e09a34d6e5797edf9bf3974426aea5d979016f5cb
|
4
|
+
data.tar.gz: afa98b412ac01fca796d23fcd80a838197c503cf76d2bfb5e921068d82db037d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af5f5e21271757564eb91176ee0339e385a56dd130e1d6236d46d3515882d00a749f0c38d1e4920dfc6a24385d838ec8c91b1d8b084015f2394e9448a3282d44
|
7
|
+
data.tar.gz: c755671a0160554f0b0012ad32afca0f760f4f98ca49df0854584009fb90c43855e1ce9238189db88482bc2d2ccc00bb06d460e4972d60c75006791c406f4a4f
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Rubocop
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rubocop:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 2.7
|
17
|
+
bundler-cache: true
|
18
|
+
- run: bundle exec rake rubocop
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Specs
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
spec:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby: [ '2.5', '2.6', '2.7', '3.0', 'head' ]
|
15
|
+
rails: [ 'gemfiles/Gemfile.rails-6.1.x', 'gemfiles/Gemfile.rails-6.0.x', 'gemfiles/Gemfile.rails-5.2.x']
|
16
|
+
exclude:
|
17
|
+
- { ruby: '2.7', rails: 'gemfiles/Gemfile.rails-5.2.x' }
|
18
|
+
- { ruby: '3.0', rails: 'gemfiles/Gemfile.rails-5.2.x' }
|
19
|
+
- { ruby: 'head', rails: 'gemfiles/Gemfile.rails-5.2.x' }
|
20
|
+
- { ruby: '2.5', rails: 'gemfiles/Gemfile.rails-6.0.x' }
|
21
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
22
|
+
env:
|
23
|
+
BUNDLE_GEMFILE: ${{ matrix.rails }}
|
24
|
+
name: Ruby ${{ matrix.ruby }} ${{ matrix.rails }} specs
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v2
|
27
|
+
- uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
30
|
+
bundler-cache: true
|
31
|
+
- name: Run tests
|
32
|
+
run: bundle exec rake spec
|
data/.rubocop.yml
CHANGED
@@ -11,10 +11,8 @@ AllCops:
|
|
11
11
|
- 'vendor/bundle/**/*'
|
12
12
|
DisplayCopNames: true
|
13
13
|
StyleGuideCopsOnly: false
|
14
|
-
TargetRubyVersion: 2.
|
15
|
-
|
16
|
-
Rails:
|
17
|
-
Enabled: false
|
14
|
+
TargetRubyVersion: 2.5
|
15
|
+
NewCops: enable
|
18
16
|
|
19
17
|
Layout/EmptyLinesAroundArguments:
|
20
18
|
Enabled: false
|
@@ -22,7 +20,7 @@ Layout/EmptyLinesAroundArguments:
|
|
22
20
|
Layout/SpaceBeforeBlockBraces:
|
23
21
|
EnforcedStyleForEmptyBraces: space
|
24
22
|
|
25
|
-
Layout/
|
23
|
+
Layout/HashAlignment:
|
26
24
|
EnforcedColonStyle: table
|
27
25
|
EnforcedHashRocketStyle: table
|
28
26
|
|
@@ -34,7 +32,7 @@ Metrics/BlockLength:
|
|
34
32
|
- 'spec/**/*.rb'
|
35
33
|
- 'influxdb-rails.gemspec'
|
36
34
|
|
37
|
-
|
35
|
+
Layout/LineLength:
|
38
36
|
Max: 100
|
39
37
|
Exclude:
|
40
38
|
- 'spec/**/*.rb'
|
@@ -46,7 +44,7 @@ Metrics/ModuleLength:
|
|
46
44
|
Metrics/ParameterLists:
|
47
45
|
Max: 6
|
48
46
|
|
49
|
-
Naming/
|
47
|
+
Naming/MethodParameterName:
|
50
48
|
AllowedNames: [io, id, db, ex]
|
51
49
|
|
52
50
|
Naming/FileName:
|
@@ -81,3 +79,34 @@ Style/TrailingCommaInHashLiteral:
|
|
81
79
|
EnforcedStyleForMultiline: comma
|
82
80
|
Exclude:
|
83
81
|
- "spec/**/*.rb"
|
82
|
+
|
83
|
+
Lint/DuplicateBranch:
|
84
|
+
Enabled: true
|
85
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
86
|
+
Enabled: true
|
87
|
+
Lint/EmptyBlock:
|
88
|
+
Enabled: true
|
89
|
+
Lint/EmptyClass:
|
90
|
+
Enabled: true
|
91
|
+
Lint/NoReturnInBeginEndBlocks:
|
92
|
+
Enabled: true
|
93
|
+
Lint/ToEnumArguments:
|
94
|
+
Enabled: true
|
95
|
+
Lint/UnexpectedBlockArity:
|
96
|
+
Enabled: true
|
97
|
+
Lint/UnmodifiedReduceAccumulator:
|
98
|
+
Enabled: true
|
99
|
+
Style/ArgumentsForwarding:
|
100
|
+
Enabled: true
|
101
|
+
Style/CollectionCompact:
|
102
|
+
Enabled: true
|
103
|
+
Style/DocumentDynamicEvalDefinition:
|
104
|
+
Enabled: true
|
105
|
+
Style/NegatedIfElseCondition:
|
106
|
+
Enabled: true
|
107
|
+
Style/NilLambda:
|
108
|
+
Enabled: true
|
109
|
+
Style/RedundantArgument:
|
110
|
+
Enabled: true
|
111
|
+
Style/SwapValues:
|
112
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,33 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
For the full commit log, [see here](https://github.com/influxdata/influxdb-rails/commits/
|
3
|
+
For the full commit log, [see here](https://github.com/influxdata/influxdb-rails/commits/one-stable).
|
4
|
+
|
5
|
+
## v1.0.3, released 2021-09-15
|
6
|
+
|
7
|
+
- In case of unhandled exceptions, set status in measurements like Rails.logger does
|
8
|
+
- Require Ruby 2.5
|
9
|
+
|
10
|
+
## v1.0.2, released 2021-04-13
|
11
|
+
|
12
|
+
Fix passing booleans to custom tags.
|
13
|
+
|
14
|
+
## v1.0.1, released 2021-03-23
|
15
|
+
|
16
|
+
The final release, no code changes.
|
17
|
+
|
18
|
+
## v1.0.1.beta3, released 2020-10-16
|
19
|
+
|
20
|
+
- Drop `perform_start.active_job` subscriber, it's rather useless on dashboards.
|
4
21
|
|
5
22
|
## v1.0.1.beta2, released 2020-09-14
|
23
|
+
|
6
24
|
- Implement [`deliver.action_mailer`](https://guides.rubyonrails.org/active_support_instrumentation.html#deliver-action-mailer) subscriber
|
7
25
|
- Add missing Active Job documentation
|
8
26
|
- Drop support for Ruby 2.4
|
9
27
|
- Drop support for Rails < 5.2
|
10
28
|
|
11
29
|
## v1.0.1.beta1, released 2020-08-21
|
30
|
+
|
12
31
|
- Drop support for Ruby 2.3
|
13
32
|
- Drop support for Rails 4.x
|
14
33
|
- Add `auth_method` to client configuration (#96, @anlek)
|
@@ -23,9 +42,11 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-rails
|
|
23
42
|
- Record unhandled exceptions as tags for process_action.action_controller
|
24
43
|
|
25
44
|
## v1.0.0, released 2019-10-23
|
45
|
+
|
26
46
|
The Final release, no code changes.
|
27
47
|
|
28
48
|
## v1.0.0.beta5, unreleased
|
49
|
+
|
29
50
|
- Silently eat all dropped configuration options and do not crash
|
30
51
|
- Add per action view to the sample dashboard
|
31
52
|
|
data/README.md
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
> :warning: You are looking at the README for the master branch of this gem.
|
2
|
-
> See the latest [released version (1.0.
|
2
|
+
> See the latest [released version (1.0.1)](https://github.com/influxdata/influxdb-rails/tree/v1.0.1#readme)
|
3
3
|
> instead.
|
4
4
|
|
5
5
|
# influxdb-rails
|
6
6
|
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/influxdb-rails.svg)](https://badge.fury.io/rb/influxdb-rails)
|
8
|
-
[![Build Status](https://
|
8
|
+
[![Build Status](https://github.com/influxdata/influxdb-rails/actions/workflows/spec.yml/badge.svg)](https://github.com/influxdata/influxdb-rails/actions)
|
9
9
|
|
10
|
-
Automatically instrument your Ruby on Rails applications and write the
|
11
|
-
|
12
|
-
|
13
|
-
This gem is designed for Rails 4.2+, Ruby 2.3+ and InfluxDB 0.9+.
|
10
|
+
Automatically instrument your Ruby on Rails applications and write the metrics directly into
|
11
|
+
[InfluxDB](https://www.influxdata.com/).
|
14
12
|
|
15
13
|
## Table of contents
|
16
14
|
|
@@ -41,8 +39,8 @@ configuration of this gem.
|
|
41
39
|
|
42
40
|
## Usage
|
43
41
|
|
44
|
-
Out of the box, you'll automatically get reporting for
|
45
|
-
|
42
|
+
Out of the box, you'll automatically get reporting for the Ruby on Rails components mentioned
|
43
|
+
below.
|
46
44
|
|
47
45
|
### Action Controller
|
48
46
|
|
@@ -55,9 +53,9 @@ Reported values:
|
|
55
53
|
|
56
54
|
```ruby
|
57
55
|
controller: 48.467,
|
58
|
-
view: 46.848
|
56
|
+
view: 46.848,
|
59
57
|
db: 0.157,
|
60
|
-
started: 1465839830100400200
|
58
|
+
started: 1465839830100400200,
|
61
59
|
request_id: "d5bf620b-3494-425b-b7e1-4953597ea744"
|
62
60
|
```
|
63
61
|
|
@@ -71,14 +69,12 @@ Reported tags:
|
|
71
69
|
method: "PostsController#index",
|
72
70
|
http_method: "GET",
|
73
71
|
format: "html",
|
74
|
-
status: ["200", ""]
|
75
|
-
exception:
|
72
|
+
status: ["200", ""],
|
73
|
+
exception: "ArgumentError"
|
76
74
|
}
|
77
75
|
```
|
78
76
|
|
79
|
-
*Note*: If an exception happens during that particular
|
80
|
-
`status` will be blank and the tag `exception` will contain the name of the
|
81
|
-
exception class.
|
77
|
+
*Note*: If an exception happens during that particular action the `status` will be blank and the tag `exception` will contain the name of the exception class. The status is blank because we can't know how you handle the exception outside the action.
|
82
78
|
|
83
79
|
### Action View
|
84
80
|
|
@@ -100,11 +96,11 @@ Reported values:
|
|
100
96
|
Reported tags:
|
101
97
|
|
102
98
|
```ruby
|
103
|
-
hook: ["render_template", "render_partial", "render_collection"]
|
99
|
+
hook: ["render_template", "render_partial", "render_collection"],
|
104
100
|
server: Socket.gethostname,
|
105
101
|
app_name: configuration.application_name,
|
106
102
|
location: "PostsController#index",
|
107
|
-
filename: "/some/file/action.html"
|
103
|
+
filename: "/some/file/action.html"
|
108
104
|
```
|
109
105
|
|
110
106
|
### Active Record
|
@@ -112,15 +108,16 @@ Reported tags:
|
|
112
108
|
Reported ActiveSupport instrumentation hooks:
|
113
109
|
|
114
110
|
- [sql.active\_record](https://guides.rubyonrails.org/active_support_instrumentation.html#sql-active-record)
|
111
|
+
- [instantiation.active\_record](https://guides.rubyonrails.org/active_support_instrumentation.html#instantiation-active-record)
|
115
112
|
|
116
|
-
Reported values:
|
113
|
+
Reported SQL values:
|
117
114
|
|
118
115
|
```ruby
|
119
116
|
sql: "SELECT \"posts\".* FROM \"posts\"",
|
120
117
|
request_id: "d5bf620b-3494-425b-b7e1-4953597ea744"
|
121
118
|
```
|
122
119
|
|
123
|
-
Reported tags:
|
120
|
+
Reported SQL tags:
|
124
121
|
|
125
122
|
```ruby
|
126
123
|
hook: "sql",
|
@@ -132,12 +129,29 @@ Reported tags:
|
|
132
129
|
name: "Post Load"
|
133
130
|
```
|
134
131
|
|
132
|
+
Reported instantiation values:
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
record_count: 1,
|
136
|
+
request_id: "d5bf620b-3494-425b-b7e1-4953597ea744"
|
137
|
+
value: 7.689
|
138
|
+
```
|
139
|
+
|
140
|
+
Reported instantiation tags:
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
hook: "instantiation",
|
144
|
+
server: Socket.gethostname,
|
145
|
+
app_name: configuration.application_name,
|
146
|
+
location: "PostsController#index",
|
147
|
+
class_name: "POST"
|
148
|
+
```
|
149
|
+
|
135
150
|
### Active Job
|
136
151
|
|
137
152
|
Reported ActiveSupport instrumentation hooks:
|
138
153
|
|
139
154
|
- [enqueue.active\_job](https://guides.rubyonrails.org/active_support_instrumentation.html#enqueue-active-job)
|
140
|
-
- [perform_start.active\_job](https://guides.rubyonrails.org/active_support_instrumentation.html#perform-start-active-job)
|
141
155
|
- [perform.active\_job](https://guides.rubyonrails.org/active_support_instrumentation.html#perform-active-job)
|
142
156
|
|
143
157
|
Reported values:
|
@@ -149,14 +163,14 @@ Reported values:
|
|
149
163
|
Reported tags:
|
150
164
|
|
151
165
|
```ruby
|
152
|
-
hook: ["enqueue", "
|
153
|
-
state: ["queued", "
|
166
|
+
hook: ["enqueue", "perform"],
|
167
|
+
state: ["queued", "succeeded", "failed"],
|
154
168
|
job: "SomeJobClassName",
|
155
169
|
queue: "queue_name"
|
156
170
|
```
|
157
171
|
|
158
172
|
*Note*: Only the measurements with the hook `perform` report a duration in the value.
|
159
|
-
The
|
173
|
+
The enqueue hook is a counter and always reports a value of `1`.
|
160
174
|
|
161
175
|
### Action Mailer
|
162
176
|
|
@@ -190,9 +204,7 @@ InfluxDB::Rails.configure do |config|
|
|
190
204
|
end
|
191
205
|
```
|
192
206
|
|
193
|
-
You'll find
|
194
|
-
canonical list of default values is located in `lib/influxdb/rails/configuration.rb`
|
195
|
-
(`InfluxDB::Rails::Configuration::DEFAULTS`).
|
207
|
+
You'll find all of the configuration settings in the initializer file.
|
196
208
|
|
197
209
|
### Custom Tags
|
198
210
|
|
@@ -240,7 +252,7 @@ end
|
|
240
252
|
Reported tags:
|
241
253
|
|
242
254
|
```ruby
|
243
|
-
hook: "block_instrumentation"
|
255
|
+
hook: "block_instrumentation",
|
244
256
|
server: Socket.gethostname,
|
245
257
|
app_name: configuration.application_name,
|
246
258
|
location: "PostsController#index",
|
@@ -249,7 +261,7 @@ Reported tags:
|
|
249
261
|
|
250
262
|
Reported values:
|
251
263
|
```ruby
|
252
|
-
value: 100 # execution time of the block
|
264
|
+
value: 100 # execution time of the block in ms
|
253
265
|
```
|
254
266
|
|
255
267
|
You can also overwrite the `value`
|
@@ -332,7 +344,7 @@ might cause performance issues on traffic intensive applications. Disable it in
|
|
332
344
|
the configuration if you are not willing to tolerate this.
|
333
345
|
|
334
346
|
By default, this gem performs writes to InfluxDB asynchronously. A single
|
335
|
-
|
347
|
+
hook usually only performs some time delta calculations, and then enqueues
|
336
348
|
the data point into a worker queue (which is processed by a background
|
337
349
|
thread).
|
338
350
|
|
@@ -356,8 +368,7 @@ implications, depending on the value of `config.client.async`:
|
|
356
368
|
cycle), it might block all available request threads
|
357
369
|
|
358
370
|
In both cases, your application server might become unresponsive and needs
|
359
|
-
to be restarted
|
360
|
-
like Docker containers).
|
371
|
+
to be restarted.
|
361
372
|
|
362
373
|
If you setup a maximum retry value (`Integer === config.client.retry`),
|
363
374
|
the client will try up to that amount of times to send the data to the server
|
@@ -388,13 +399,11 @@ The data points are simply discarded.
|
|
388
399
|
rake test:all
|
389
400
|
```
|
390
401
|
|
391
|
-
- or wait for [
|
402
|
+
- or wait for [our CI](https://github.com/influxdata/influxdb-rails/actions) to pick up your changes, *after*
|
392
403
|
you made a pull request.
|
393
404
|
- Send a pull request.
|
394
405
|
- If your changes are looking good, we'll merge them.
|
395
406
|
|
396
|
-
[travis-pr]: https://travis-ci.org/influxdata/influxdb-rails/pull_requests
|
397
|
-
|
398
407
|
### Testing Tasks
|
399
408
|
|
400
409
|
```console
|
data/influxdb-rails.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features|smoke)/})
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.required_ruby_version = ">= 2.
|
25
|
+
spec.required_ruby_version = ">= 2.5.0"
|
26
26
|
|
27
27
|
spec.add_runtime_dependency "influxdb", "~> 0.6", ">= 0.6.4"
|
28
28
|
spec.add_runtime_dependency "railties", ">= 5.0"
|
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency "rdoc"
|
39
39
|
spec.add_development_dependency "rspec"
|
40
40
|
spec.add_development_dependency "rspec-rails", ">= 3.0.0"
|
41
|
-
spec.add_development_dependency "rubocop", "~>
|
41
|
+
spec.add_development_dependency "rubocop", "~> 1.9.0"
|
42
42
|
spec.add_development_dependency "sqlite3"
|
43
43
|
spec.add_development_dependency "tzinfo"
|
44
44
|
end
|
@@ -6,6 +6,13 @@ module InfluxDB
|
|
6
6
|
class ActiveJobSubscriber < Subscriber # :nodoc:
|
7
7
|
private
|
8
8
|
|
9
|
+
JOB_STATE = {
|
10
|
+
"enqueue" => "queued",
|
11
|
+
"perform_start" => "running",
|
12
|
+
"perform" => "succeeded",
|
13
|
+
}.freeze
|
14
|
+
private_constant :JOB_STATE
|
15
|
+
|
9
16
|
def values
|
10
17
|
{
|
11
18
|
value: value,
|
@@ -24,14 +31,7 @@ module InfluxDB
|
|
24
31
|
def job_state
|
25
32
|
return "failed" if failed?
|
26
33
|
|
27
|
-
|
28
|
-
when "enqueue"
|
29
|
-
"queued"
|
30
|
-
when "perform_start"
|
31
|
-
"running"
|
32
|
-
when "perform"
|
33
|
-
"succeeded"
|
34
|
-
end
|
34
|
+
JOB_STATE[short_hook_name]
|
35
35
|
end
|
36
36
|
|
37
37
|
def measure_performance?
|
@@ -44,8 +44,8 @@ module InfluxDB
|
|
44
44
|
|
45
45
|
def fetch_short_hook_name
|
46
46
|
return "enqueue" if hook_name.include?("enqueue")
|
47
|
-
|
48
|
-
|
47
|
+
|
48
|
+
"perform"
|
49
49
|
end
|
50
50
|
|
51
51
|
def job
|
@@ -59,7 +59,7 @@ module InfluxDB
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def failed?
|
62
|
-
payload[:
|
62
|
+
payload[:aborted]
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|