liveqa 1.9.5 → 1.9.6
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/liveqa.rb +2 -2
- data/lib/liveqa/message.rb +11 -3
- data/lib/liveqa/plugins/sidekiq/server_middleware.rb +1 -0
- data/lib/liveqa/version.rb +1 -1
- data/spec/lib/liveqa/message_spec.rb +56 -46
- data/spec/lib/liveqa/plugins/sidekiq/server_middleware_spec.rb +1 -0
- data/spec/lib/liveqa_spec.rb +6 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09aa604e7e84377ff259a8d5cf24eee8b130e188'
|
4
|
+
data.tar.gz: 5b54f896360e16c32f6125a5e91d5808002b7262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa2416a0f721914d1d61bd5dcefd712434c52588266b1fbf7e67128d508765e3958040e6d9d59b361fbf67bd7309fd171291a33e7ee4cfd3974858635bb171ad
|
7
|
+
data.tar.gz: 790d47c0e5ffb8368d8a97426d18897c80cc1848b2ffb76ce8d53f56b5b630a607f4e0c0a2e69649331b66a9379393927b0d7930b93acdef34337d7aee481f22
|
data/lib/liveqa.rb
CHANGED
@@ -141,7 +141,7 @@ module LiveQA
|
|
141
141
|
payload = Message.base.merge(payload)
|
142
142
|
|
143
143
|
if configurations.async
|
144
|
-
payload[:
|
144
|
+
payload[:external_id] = group_id
|
145
145
|
|
146
146
|
return processor.enqueue(
|
147
147
|
action: GROUPS_UPDATE_ACTION,
|
@@ -168,7 +168,7 @@ module LiveQA
|
|
168
168
|
payload = Message.base.merge(payload)
|
169
169
|
|
170
170
|
if configurations.async
|
171
|
-
payload[:
|
171
|
+
payload[:external_id] = user_id
|
172
172
|
|
173
173
|
return processor.enqueue(
|
174
174
|
action: IDENTITIES_UPDATE_ACTION,
|
data/lib/liveqa/message.rb
CHANGED
@@ -11,7 +11,6 @@ module LiveQA
|
|
11
11
|
message_id: SecureRandom.uuid,
|
12
12
|
timestamp: Time.now.utc.iso8601(3),
|
13
13
|
session_tracker_id: session_tracker_id,
|
14
|
-
metadata: metadata
|
15
14
|
)
|
16
15
|
end
|
17
16
|
|
@@ -21,7 +20,8 @@ module LiveQA
|
|
21
20
|
server: server,
|
22
21
|
request: LiveQA::Store.get(:request),
|
23
22
|
worker: LiveQA::Store.get(:worker),
|
24
|
-
environment: LiveQA::Store.get(:environment)
|
23
|
+
environment: LiveQA::Store.get(:environment) || LiveQA.configurations.environment_name,
|
24
|
+
metadata: metadata
|
25
25
|
).merge(base)
|
26
26
|
end
|
27
27
|
|
@@ -45,10 +45,18 @@ module LiveQA
|
|
45
45
|
{
|
46
46
|
host: Socket.gethostname,
|
47
47
|
pid: Process.pid,
|
48
|
-
software: LiveQA::Store.get(:server_software),
|
48
|
+
software: LiveQA::Store.get(:server_software) || program_name,
|
49
49
|
}
|
50
50
|
end
|
51
51
|
|
52
|
+
def program_name
|
53
|
+
name = $PROGRAM_NAME
|
54
|
+
|
55
|
+
name.split('/').last
|
56
|
+
rescue StandardError => _e
|
57
|
+
name
|
58
|
+
end
|
59
|
+
|
52
60
|
def metadata
|
53
61
|
return nil if LiveQA.configurations.metadata.nil?
|
54
62
|
|
@@ -10,6 +10,7 @@ module LiveQA
|
|
10
10
|
|
11
11
|
def call(_worker, job, _queue)
|
12
12
|
LiveQA::Store.set(:session_tracker_id, job['liveqa_session_tracker_id'] || SecureRandom.uuid)
|
13
|
+
LiveQA::Store.set(:server_software, "Sidekiq #{::Sidekiq::VERSION}")
|
13
14
|
store_worker_data(job)
|
14
15
|
yield
|
15
16
|
ensure
|
data/lib/liveqa/version.rb
CHANGED
@@ -25,51 +25,6 @@ describe LiveQA::Message do
|
|
25
25
|
|
26
26
|
it { expect(base.base).to match(expected_hash) }
|
27
27
|
end
|
28
|
-
|
29
|
-
context 'with metadata' do
|
30
|
-
|
31
|
-
|
32
|
-
let(:expected_hash) {{
|
33
|
-
message_id: kind_of(String),
|
34
|
-
timestamp: kind_of(String),
|
35
|
-
session_tracker_id: kind_of(String),
|
36
|
-
metadata: {
|
37
|
-
deployment_id: 42
|
38
|
-
}
|
39
|
-
}}
|
40
|
-
|
41
|
-
context 'hash type' do
|
42
|
-
before do
|
43
|
-
LiveQA.configurations.metadata = {
|
44
|
-
deployment_id: 42
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
|
-
it { expect(base.base).to match(expected_hash) }
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'proc type' do
|
52
|
-
before do
|
53
|
-
LiveQA.configurations.metadata = {
|
54
|
-
deployment_id: lambda { 84 / 2 }
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
it { expect(base.base).to match(expected_hash) }
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'proc & raise type' do
|
62
|
-
before do
|
63
|
-
LiveQA.configurations.metadata = {
|
64
|
-
deployment_id: -> { 84 / 2 },
|
65
|
-
other_id: -> { hello }
|
66
|
-
}
|
67
|
-
end
|
68
|
-
|
69
|
-
it { expect(base.base).to match(expected_hash) }
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
28
|
end
|
74
29
|
|
75
30
|
describe '#extended' do
|
@@ -77,6 +32,7 @@ describe LiveQA::Message do
|
|
77
32
|
message_id: kind_of(String),
|
78
33
|
timestamp: kind_of(String),
|
79
34
|
session_tracker_id: kind_of(String),
|
35
|
+
environment: 'test',
|
80
36
|
library: {
|
81
37
|
name: "liveqa",
|
82
38
|
language: "ruby",
|
@@ -84,7 +40,8 @@ describe LiveQA::Message do
|
|
84
40
|
},
|
85
41
|
server: {
|
86
42
|
host: kind_of(String),
|
87
|
-
pid: kind_of(Numeric)
|
43
|
+
pid: kind_of(Numeric),
|
44
|
+
software: 'rspec'
|
88
45
|
}
|
89
46
|
}}
|
90
47
|
|
@@ -163,6 +120,59 @@ describe LiveQA::Message do
|
|
163
120
|
|
164
121
|
it { expect(base.extended).to match(expected_hash) }
|
165
122
|
end
|
123
|
+
|
124
|
+
context 'with metadata' do
|
125
|
+
let(:expected_hash) {{
|
126
|
+
message_id: kind_of(String),
|
127
|
+
timestamp: kind_of(String),
|
128
|
+
session_tracker_id: kind_of(String),
|
129
|
+
environment: 'test',
|
130
|
+
library: {
|
131
|
+
name: "liveqa",
|
132
|
+
language: "ruby",
|
133
|
+
version: kind_of(String)
|
134
|
+
},
|
135
|
+
server: {
|
136
|
+
host: kind_of(String),
|
137
|
+
pid: kind_of(Numeric),
|
138
|
+
software: 'rspec'
|
139
|
+
},
|
140
|
+
metadata: {
|
141
|
+
deployment_id: 42
|
142
|
+
},
|
143
|
+
}}
|
144
|
+
|
145
|
+
context 'hash type' do
|
146
|
+
before do
|
147
|
+
LiveQA.configurations.metadata = {
|
148
|
+
deployment_id: 42
|
149
|
+
}
|
150
|
+
end
|
151
|
+
|
152
|
+
it { expect(base.extended).to match(expected_hash) }
|
153
|
+
end
|
154
|
+
|
155
|
+
context 'proc type' do
|
156
|
+
before do
|
157
|
+
LiveQA.configurations.metadata = {
|
158
|
+
deployment_id: lambda { 84 / 2 }
|
159
|
+
}
|
160
|
+
end
|
161
|
+
|
162
|
+
it { expect(base.extended).to match(expected_hash) }
|
163
|
+
end
|
164
|
+
|
165
|
+
context 'proc & raise type' do
|
166
|
+
before do
|
167
|
+
LiveQA.configurations.metadata = {
|
168
|
+
deployment_id: -> { 84 / 2 },
|
169
|
+
other_id: -> { hello }
|
170
|
+
}
|
171
|
+
end
|
172
|
+
|
173
|
+
it { expect(base.extended).to match(expected_hash) }
|
174
|
+
end
|
175
|
+
end
|
166
176
|
end
|
167
177
|
|
168
178
|
end
|
data/spec/lib/liveqa_spec.rb
CHANGED
@@ -24,7 +24,8 @@ describe LiveQA::Event do
|
|
24
24
|
},
|
25
25
|
server: {
|
26
26
|
host: kind_of(String),
|
27
|
-
pid: kind_of(Numeric)
|
27
|
+
pid: kind_of(Numeric),
|
28
|
+
software: 'rspec',
|
28
29
|
},
|
29
30
|
}}
|
30
31
|
let(:response) { double('LiveQA::Event', successful?: true) }
|
@@ -77,7 +78,8 @@ describe LiveQA::Event do
|
|
77
78
|
},
|
78
79
|
server: {
|
79
80
|
host: kind_of(String),
|
80
|
-
pid: kind_of(Numeric)
|
81
|
+
pid: kind_of(Numeric),
|
82
|
+
software: 'rspec',
|
81
83
|
},
|
82
84
|
}}
|
83
85
|
let(:response) { double('LiveQA::Event', successful?: true) }
|
@@ -130,7 +132,7 @@ describe LiveQA::Event do
|
|
130
132
|
LiveQA.set_group(42, { properties: { name: 'John Group' }}, no_ssl: true, space_name: 'test')
|
131
133
|
end
|
132
134
|
|
133
|
-
it { expect(processor_mock).to have_received(:enqueue).with(action: 'groups:update', payload: hash_including(expected_arg.merge(
|
135
|
+
it { expect(processor_mock).to have_received(:enqueue).with(action: 'groups:update', payload: hash_including(expected_arg.merge(external_id: 42)), options: { space_name: 'test' }) }
|
134
136
|
end
|
135
137
|
|
136
138
|
context 'without async' do
|
@@ -171,7 +173,7 @@ describe LiveQA::Event do
|
|
171
173
|
LiveQA.set_identity(42, { properties: { name: 'John Doe' }}, no_ssl: true, space_name: 'test')
|
172
174
|
end
|
173
175
|
|
174
|
-
it { expect(processor_mock).to have_received(:enqueue).with(action: 'identities:update', payload: hash_including(expected_arg.merge(
|
176
|
+
it { expect(processor_mock).to have_received(:enqueue).with(action: 'identities:update', payload: hash_including(expected_arg.merge(external_id: 42)), options: { space_name: 'test' }) }
|
175
177
|
end
|
176
178
|
|
177
179
|
context 'without async' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liveqa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LiveQA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|