lens 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a012ff1b501e256ecf5d23cd85ddbab93691ec19
4
- data.tar.gz: bca5e5234778aa9affe85d7f93a40897a4b8c752
3
+ metadata.gz: 2ae1d1e74e8a915445f14d4ab362a20f99a248b1
4
+ data.tar.gz: 13ac21b192e48507bffca37a8ad7888856ac63ba
5
5
  SHA512:
6
- metadata.gz: bb648a4b48e3111a157ed48553fba8f88ca266f614d16814798c62ca3df61e3f70c1b338bc077244e0e325d029e13331ab99f5e6d08d674d5e9b492048af89ca
7
- data.tar.gz: c020252259fa32e042c5654918e5d7cb3712a9d0138be712151913dfe2a7100fe0d9ee36397c28ec6afaf38755288bcf2d1b6f19aec2e04c7cc998fed780c448
6
+ metadata.gz: 2c46fe144edb80f0af68d13533be1238eed71ae37b2e899039079cadfc0afc73c7d627eda7a5bb2808471b30ebd18fb6e74098a039752a1b50194d383c4a818d
7
+ data.tar.gz: 0354d0099fec1e87a9a2b4e929d5686b252d259136c739082a9aaf04b5765bd4f4bb5a40ff550e2aa89262d8242109b1b23ed644ebd043bf40456ff02c3ade9e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lens (0.0.2)
4
+ lens (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -28,6 +28,7 @@ module Lens
28
28
  method: event_payload[:method],
29
29
  url: event_payload[:path],
30
30
  records: @records,
31
+ time: Time.now,
31
32
  duration: @event.duration,
32
33
  meta: {
33
34
  client_version: VERSION
data/lib/lens/sender.rb CHANGED
@@ -46,7 +46,7 @@ module Lens
46
46
  end
47
47
 
48
48
  def send_request(path, data, headers = {})
49
- http_connection.post(path, data.to_json, http_headers(headers))
49
+ http_connection.post(path, data, http_headers(headers))
50
50
  rescue *HTTP_ERRORS => e
51
51
  raise e
52
52
  nil
data/lib/lens/trace.rb CHANGED
@@ -8,13 +8,13 @@ module Lens
8
8
  end
9
9
 
10
10
  def add(event)
11
- @data.push event.payload
11
+ @data.push event.payload.merge(duration: event.duration)
12
12
  end
13
13
 
14
14
  def complete(event)
15
15
  formatted_data = Lens::EventFormatter.new(event, @data).json_formatted
16
- log(data)
17
- send(data)
16
+ log(formatted_data)
17
+ send(formatted_data)
18
18
  Thread.current[:__lens_trace] = nil
19
19
  end
20
20
 
data/lib/lens/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lens
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -19,5 +19,10 @@ describe Lens::EventFormatter do
19
19
  it "data key is not empty" do
20
20
  expect(subject[:data]).to_not be_empty
21
21
  end
22
+
23
+ it "required fields are present" do
24
+ required_keys = [:action, :controller, :params, :method, :url, :records, :time, :duration]
25
+ expect(required_keys - subject[:data].keys).to be_empty
26
+ end
22
27
  end
23
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lens
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kgorin