newrelic-slack-ruby-bot 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -2
- data/Gemfile.lock +52 -65
- data/LICENSE.md +1 -1
- data/README.md +3 -3
- data/Rakefile +3 -1
- data/lib/newrelic-slack-ruby-bot.rb +2 -0
- data/lib/newrelic-slack-ruby-bot/instrumentation.rb +12 -6
- data/lib/newrelic-slack-ruby-bot/version.rb +3 -1
- data/newrelic-slack-ruby-bot.gemspec +3 -1
- data/spec/newrelic-slack-ruby-bot/instrumentation_spec.rb +80 -45
- data/spec/newrelic-slack-ruby-bot/version_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- metadata +3 -6
- data/pkg/newrelic-slack-ruby-bot-0.1.1.gem +0 -0
- data/pkg/newrelic-slack-ruby-bot-0.2.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2cb67fa2a3365be4cf7624aad1b391739dbc1d5fe31193c3ca694c926b8ada97
|
4
|
+
data.tar.gz: 8d98258d66a8b9d0e337bec40f2938ea2e3040f90b400f990aa198899d949a30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cb7049323accdd887f3cdf68f1e897bbe8454b594abf81bb7cbd7cc7aad108f4153edacd052f47c3ca65b77cba92407b1ce3d149dc86be9ecdfdf02bcf947e3
|
7
|
+
data.tar.gz: e66bd3876eac0c16c7d04a7a0c3b49b574a3cec37128147d24652edd1f635ae64d26e21e3e3f1292d17c4e976ed921468633dddd95cf6221547c0d35ecc36c35
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
### 0.2.2 (4/7/2020)
|
2
|
+
|
3
|
+
* [#12](https://github.com/slack-ruby/newrelic-slack-ruby-bot/pull/12): Add support for slack-ruby-bot 0.14.0 - [@dblock](https://github.com/dblock).
|
4
|
+
|
1
5
|
### 0.2.1 (11/10/2017)
|
2
6
|
|
3
7
|
* [#6](https://github.com/slack-ruby/newrelic-slack-ruby-bot/pull/6): Add team, channel, and user attributes to New Relic traces - [@kstole](https://github.com/kstole).
|
data/Gemfile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'http://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
4
6
|
|
5
7
|
group :test do
|
6
|
-
gem '
|
8
|
+
gem 'async-websocket', '~> 0.8.0'
|
7
9
|
gem 'rake', '< 11.0'
|
8
10
|
gem 'rspec', '~> 3.4.0'
|
9
|
-
gem 'rubocop', '0.
|
11
|
+
gem 'rubocop', '0.81.0'
|
10
12
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,64 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
newrelic-slack-ruby-bot (0.2.
|
4
|
+
newrelic-slack-ruby-bot (0.2.2)
|
5
5
|
newrelic_rpm
|
6
6
|
slack-ruby-bot (>= 0.10.5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
11
|
+
activesupport (6.0.2.2)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
-
i18n (
|
13
|
+
i18n (>= 0.7, < 2)
|
14
14
|
minitest (~> 5.1)
|
15
15
|
tzinfo (~> 1.1)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
timers (>= 4.1.1)
|
30
|
-
celluloid-fsm (0.20.5)
|
31
|
-
timers (>= 4.1.1)
|
32
|
-
celluloid-io (0.17.3)
|
33
|
-
celluloid (>= 0.17.2)
|
34
|
-
nio4r (>= 1.1)
|
35
|
-
timers (>= 4.1.1)
|
36
|
-
celluloid-pool (0.20.5)
|
37
|
-
timers (>= 4.1.1)
|
38
|
-
celluloid-supervision (0.20.6)
|
39
|
-
timers (>= 4.1.1)
|
40
|
-
concurrent-ruby (1.0.5)
|
16
|
+
zeitwerk (~> 2.2)
|
17
|
+
ast (2.4.0)
|
18
|
+
async (1.24.2)
|
19
|
+
console (~> 1.0)
|
20
|
+
nio4r (~> 2.3)
|
21
|
+
timers (~> 4.1)
|
22
|
+
async-io (1.28.0)
|
23
|
+
async (~> 1.14)
|
24
|
+
async-websocket (0.8.0)
|
25
|
+
async-io
|
26
|
+
websocket-driver (~> 0.7.0)
|
27
|
+
concurrent-ruby (1.1.6)
|
28
|
+
console (1.8.2)
|
41
29
|
diff-lcs (1.3)
|
42
|
-
faraday (0.
|
30
|
+
faraday (1.0.1)
|
43
31
|
multipart-post (>= 1.2, < 3)
|
44
|
-
faraday_middleware (0.
|
45
|
-
faraday (
|
46
|
-
gli (2.
|
47
|
-
hashie (
|
48
|
-
|
49
|
-
i18n (0.9.1)
|
32
|
+
faraday_middleware (1.0.0)
|
33
|
+
faraday (~> 1.0)
|
34
|
+
gli (2.19.0)
|
35
|
+
hashie (4.1.0)
|
36
|
+
i18n (1.8.2)
|
50
37
|
concurrent-ruby (~> 1.0)
|
51
|
-
|
52
|
-
minitest (5.
|
53
|
-
multipart-post (2.
|
54
|
-
newrelic_rpm (
|
55
|
-
nio4r (2.
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
rainbow (
|
60
|
-
rake
|
38
|
+
jaro_winkler (1.5.4)
|
39
|
+
minitest (5.14.0)
|
40
|
+
multipart-post (2.1.1)
|
41
|
+
newrelic_rpm (6.9.0.363)
|
42
|
+
nio4r (2.5.2)
|
43
|
+
parallel (1.19.1)
|
44
|
+
parser (2.7.1.0)
|
45
|
+
ast (~> 2.4.0)
|
46
|
+
rainbow (3.0.0)
|
61
47
|
rake (10.5.0)
|
48
|
+
rexml (3.2.4)
|
62
49
|
rspec (3.4.0)
|
63
50
|
rspec-core (~> 3.4.0)
|
64
51
|
rspec-expectations (~> 3.4.0)
|
@@ -72,44 +59,44 @@ GEM
|
|
72
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
73
60
|
rspec-support (~> 3.4.0)
|
74
61
|
rspec-support (3.4.1)
|
75
|
-
rubocop (0.
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
rainbow (>=
|
62
|
+
rubocop (0.81.0)
|
63
|
+
jaro_winkler (~> 1.5.1)
|
64
|
+
parallel (~> 1.10)
|
65
|
+
parser (>= 2.7.0.1)
|
66
|
+
rainbow (>= 2.2.2, < 4.0)
|
67
|
+
rexml
|
80
68
|
ruby-progressbar (~> 1.7)
|
81
|
-
|
82
|
-
ruby-progressbar (1.
|
83
|
-
slack-ruby-bot (0.
|
69
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
70
|
+
ruby-progressbar (1.10.1)
|
71
|
+
slack-ruby-bot (0.14.0)
|
84
72
|
hashie
|
85
|
-
slack-ruby-client (>= 0.
|
86
|
-
slack-ruby-client (0.
|
73
|
+
slack-ruby-client (>= 0.14.0)
|
74
|
+
slack-ruby-client (0.14.6)
|
87
75
|
activesupport
|
88
76
|
faraday (>= 0.9)
|
89
77
|
faraday_middleware
|
90
78
|
gli
|
91
79
|
hashie
|
92
|
-
json
|
93
80
|
websocket-driver
|
94
81
|
thread_safe (0.3.6)
|
95
|
-
timers (4.
|
96
|
-
|
97
|
-
tins (1.6.0)
|
98
|
-
tzinfo (1.2.4)
|
82
|
+
timers (4.3.0)
|
83
|
+
tzinfo (1.2.7)
|
99
84
|
thread_safe (~> 0.1)
|
100
|
-
|
85
|
+
unicode-display_width (1.7.0)
|
86
|
+
websocket-driver (0.7.1)
|
101
87
|
websocket-extensions (>= 0.1.0)
|
102
|
-
websocket-extensions (0.1.
|
88
|
+
websocket-extensions (0.1.4)
|
89
|
+
zeitwerk (2.3.0)
|
103
90
|
|
104
91
|
PLATFORMS
|
105
92
|
ruby
|
106
93
|
|
107
94
|
DEPENDENCIES
|
108
|
-
|
95
|
+
async-websocket (~> 0.8.0)
|
109
96
|
newrelic-slack-ruby-bot!
|
110
97
|
rake (< 11.0)
|
111
98
|
rspec (~> 3.4.0)
|
112
|
-
rubocop (= 0.
|
99
|
+
rubocop (= 0.81.0)
|
113
100
|
|
114
101
|
BUNDLED WITH
|
115
|
-
1.
|
102
|
+
1.17.2
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
NewRelic Instrumentation for SlackRubyBot
|
2
2
|
=========================================
|
3
3
|
|
4
|
-
[![Gem Version](
|
5
|
-
[![Build Status](
|
6
|
-
[![Code Climate](https://codeclimate.com/github/
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/newrelic-slack-ruby-bot.svg)](https://badge.fury.io/rb/newrelic-slack-ruby-bot)
|
5
|
+
[![Build Status](https://travis-ci.org/slack-ruby/newrelic-slack-ruby-bot.svg?branch=master)](https://travis-ci.org/slack-ruby/newrelic-slack-ruby-bot)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/slack-ruby/newrelic-slack-ruby-bot.svg)](https://codeclimate.com/github/slack-ruby/newrelic-slack-ruby-bot)
|
7
7
|
|
8
8
|
NewRelic instrumentation for [slack-ruby-bot](https://github.com/slack-ruby/slack-ruby-bot).
|
9
9
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
DependencyDetection.defer do
|
2
4
|
named :slack_ruby_bot
|
3
5
|
|
@@ -19,9 +21,11 @@ DependencyDetection.defer do
|
|
19
21
|
|
20
22
|
def message_with_new_relic(client, data)
|
21
23
|
perform_action_with_newrelic_trace(name: 'call', category: 'OtherTransaction/Slack') do
|
22
|
-
::NewRelic::Agent.add_custom_attributes(
|
23
|
-
|
24
|
-
|
24
|
+
::NewRelic::Agent.add_custom_attributes(
|
25
|
+
team: data.team,
|
26
|
+
channel: data.channel,
|
27
|
+
user: data.user
|
28
|
+
)
|
25
29
|
message_without_new_relic(client, data)
|
26
30
|
end
|
27
31
|
end
|
@@ -35,7 +39,7 @@ DependencyDetection.defer do
|
|
35
39
|
::SlackRubyBot::Commands::Base.class_eval do
|
36
40
|
class << self
|
37
41
|
def command_name(match)
|
38
|
-
if match.
|
42
|
+
if match.respond_to?(:names) && match.respond_to?(:[])
|
39
43
|
if match.names.include? 'command'
|
40
44
|
match[:command].downcase
|
41
45
|
elsif match.names.include? 'operator'
|
@@ -50,9 +54,11 @@ DependencyDetection.defer do
|
|
50
54
|
|
51
55
|
def call_command_with_new_relic(client, data, match, block)
|
52
56
|
::NewRelic::Agent.set_transaction_name("#{self}/#{command_name(match)}")
|
53
|
-
if match.
|
57
|
+
if match.respond_to?(:names) && match.respond_to?(:captures)
|
54
58
|
::NewRelic::Agent
|
55
|
-
.add_custom_attributes(
|
59
|
+
.add_custom_attributes(
|
60
|
+
Hash[match.names.map(&:to_sym).zip(match.captures)]
|
61
|
+
)
|
56
62
|
end
|
57
63
|
call_command_without_new_relic(client, data, match, block)
|
58
64
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe NewRelic::Agent::Instrumentation do
|
@@ -11,11 +13,16 @@ describe NewRelic::Agent::Instrumentation do
|
|
11
13
|
.with(hash_including(name: 'call', category: 'OtherTransaction/Slack'))
|
12
14
|
.and_yield
|
13
15
|
|
14
|
-
subject.call(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
subject.call(
|
17
|
+
client,
|
18
|
+
Slack::Messages::Message.new(
|
19
|
+
message: 'message',
|
20
|
+
text: 'hi',
|
21
|
+
team: 'TEAM',
|
22
|
+
channel: 'CHANNEL',
|
23
|
+
user: 'USER'
|
24
|
+
)
|
25
|
+
)
|
19
26
|
end
|
20
27
|
|
21
28
|
context 'operator' do
|
@@ -32,20 +39,30 @@ describe NewRelic::Agent::Instrumentation do
|
|
32
39
|
.to receive(:add_custom_attributes)
|
33
40
|
.with(hash_including(operator: '+', expression: '42'))
|
34
41
|
|
35
|
-
subject.call(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
42
|
+
subject.call(
|
43
|
+
client,
|
44
|
+
Slack::Messages::Message.new(
|
45
|
+
message: 'message',
|
46
|
+
text: '+42',
|
47
|
+
team: 'TEAM',
|
48
|
+
channel: 'CHANNEL',
|
49
|
+
user: 'USER'
|
50
|
+
)
|
51
|
+
)
|
40
52
|
end
|
41
53
|
it 'sets transaction name' do
|
42
54
|
expect(::NewRelic::Agent).to receive(:set_transaction_name).with('MyOperatorClass/+')
|
43
55
|
|
44
|
-
subject.call(
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
56
|
+
subject.call(
|
57
|
+
client,
|
58
|
+
Slack::Messages::Message.new(
|
59
|
+
message: 'message',
|
60
|
+
text: '+42',
|
61
|
+
team: 'TEAM',
|
62
|
+
channel: 'CHANNEL',
|
63
|
+
user: 'USER'
|
64
|
+
)
|
65
|
+
)
|
49
66
|
end
|
50
67
|
end
|
51
68
|
|
@@ -63,20 +80,30 @@ describe NewRelic::Agent::Instrumentation do
|
|
63
80
|
.to receive(:add_custom_attributes)
|
64
81
|
.with(hash_including(bot: 'mybot', command: 'this', expression: 'is the command'))
|
65
82
|
|
66
|
-
subject.call(
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
83
|
+
subject.call(
|
84
|
+
client,
|
85
|
+
Slack::Messages::Message.new(
|
86
|
+
message: 'message',
|
87
|
+
text: "#{client.name} this is the command",
|
88
|
+
team: 'TEAM',
|
89
|
+
channel: 'CHANNEL',
|
90
|
+
user: 'USER'
|
91
|
+
)
|
92
|
+
)
|
71
93
|
end
|
72
94
|
it 'sets transaction name' do
|
73
95
|
expect(::NewRelic::Agent).to receive(:set_transaction_name).with('MyCommandClass/this')
|
74
96
|
|
75
|
-
subject.call(
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
97
|
+
subject.call(
|
98
|
+
client,
|
99
|
+
Slack::Messages::Message.new(
|
100
|
+
message: 'message',
|
101
|
+
text: "#{client.name} this is the command",
|
102
|
+
team: 'TEAM',
|
103
|
+
channel: 'CHANNEL',
|
104
|
+
user: 'USER'
|
105
|
+
)
|
106
|
+
)
|
80
107
|
end
|
81
108
|
end
|
82
109
|
|
@@ -92,20 +119,24 @@ describe NewRelic::Agent::Instrumentation do
|
|
92
119
|
.with(hash_including(team: 'TEAM', channel: 'CHANNEL', user: 'USER'))
|
93
120
|
expect(::NewRelic::Agent).to receive(:add_custom_attributes).with({})
|
94
121
|
|
95
|
-
subject.call(client, Slack::Messages::Message.new(
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
122
|
+
subject.call(client, Slack::Messages::Message.new(
|
123
|
+
message: 'message',
|
124
|
+
text: 'read this',
|
125
|
+
team: 'TEAM',
|
126
|
+
channel: 'CHANNEL',
|
127
|
+
user: 'USER'
|
128
|
+
))
|
100
129
|
end
|
101
130
|
it 'sets transaction name' do
|
102
131
|
expect(::NewRelic::Agent).to receive(:set_transaction_name).with('MyMatchClass/match')
|
103
132
|
|
104
|
-
subject.call(client, Slack::Messages::Message.new(
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
133
|
+
subject.call(client, Slack::Messages::Message.new(
|
134
|
+
message: 'message',
|
135
|
+
text: 'read this',
|
136
|
+
team: 'TEAM',
|
137
|
+
channel: 'CHANNEL',
|
138
|
+
user: 'USER'
|
139
|
+
))
|
109
140
|
end
|
110
141
|
end
|
111
142
|
|
@@ -121,20 +152,24 @@ describe NewRelic::Agent::Instrumentation do
|
|
121
152
|
.with(hash_including(team: 'TEAM', channel: 'CHANNEL', user: 'USER'))
|
122
153
|
expect(::NewRelic::Agent).not_to receive(:add_custom_attributes)
|
123
154
|
|
124
|
-
subject.call(client, Slack::Messages::Message.new(
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
155
|
+
subject.call(client, Slack::Messages::Message.new(
|
156
|
+
message: 'message',
|
157
|
+
text: 'I scanned this',
|
158
|
+
team: 'TEAM',
|
159
|
+
channel: 'CHANNEL',
|
160
|
+
user: 'USER'
|
161
|
+
))
|
129
162
|
end
|
130
163
|
it 'sets transaction name' do
|
131
164
|
expect(::NewRelic::Agent).to receive(:set_transaction_name).with('MyScanClass/scan')
|
132
165
|
|
133
|
-
subject.call(client, Slack::Messages::Message.new(
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
166
|
+
subject.call(client, Slack::Messages::Message.new(
|
167
|
+
message: 'message',
|
168
|
+
text: 'I scanned this',
|
169
|
+
team: 'TEAM',
|
170
|
+
channel: 'CHANNEL',
|
171
|
+
user: 'USER'
|
172
|
+
))
|
138
173
|
end
|
139
174
|
end
|
140
175
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic-slack-ruby-bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: newrelic_rpm
|
@@ -56,8 +56,6 @@ files:
|
|
56
56
|
- lib/newrelic-slack-ruby-bot/instrumentation.rb
|
57
57
|
- lib/newrelic-slack-ruby-bot/version.rb
|
58
58
|
- newrelic-slack-ruby-bot.gemspec
|
59
|
-
- pkg/newrelic-slack-ruby-bot-0.1.1.gem
|
60
|
-
- pkg/newrelic-slack-ruby-bot-0.2.0.gem
|
61
59
|
- screenshots/newrelic_calculate_breakdown.png
|
62
60
|
- screenshots/newrelic_transactions.png
|
63
61
|
- spec/newrelic-slack-ruby-bot/instrumentation_spec.rb
|
@@ -82,8 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
80
|
- !ruby/object:Gem::Version
|
83
81
|
version: 1.3.6
|
84
82
|
requirements: []
|
85
|
-
|
86
|
-
rubygems_version: 2.6.13
|
83
|
+
rubygems_version: 3.0.3
|
87
84
|
signing_key:
|
88
85
|
specification_version: 4
|
89
86
|
summary: NewRelic instrumentation for slack-ruby-bot.
|
Binary file
|
Binary file
|