logjam_agent 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,8 @@
1
- require "json"
1
+ begin
2
+ require "oj"
3
+ rescue LoadError
4
+ require "json"
5
+ end
2
6
 
3
7
  module LogjamAgent
4
8
  class Request
@@ -37,13 +41,25 @@ module LogjamAgent
37
41
 
38
42
  def forward
39
43
  engine = @fields.delete(:engine)
40
- @forwarder.forward(@fields.to_json, engine)
44
+ @forwarder.forward(encode_payload, engine)
41
45
  rescue Exception => e
42
46
  handle_forwarding_error(e)
43
47
  end
44
48
 
45
49
  private
46
50
 
51
+ if defined?(Oj)
52
+ def encode_payload
53
+ Oj.dump(@fields, :mode => :compat)
54
+ rescue
55
+ @fields.to_son
56
+ end
57
+ else
58
+ def encode_payload
59
+ @fields.to_json
60
+ end
61
+ end
62
+
47
63
  def format_time(t)
48
64
  # iso time with microseconds
49
65
  t.strftime("%Y-%m-%dT%H:%M:%S.#{"%06d" % t.usec}")
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.8"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 7
10
- version: 0.5.7
9
+ - 8
10
+ version: 0.5.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stefan Kaes
@@ -15,9 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-10-02 00:00:00 Z
18
+ date: 2012-10-26 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ name: rake
22
+ prerelease: false
21
23
  requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
@@ -27,11 +29,11 @@ dependencies:
27
29
  segments:
28
30
  - 0
29
31
  version: "0"
30
- version_requirements: *id001
31
- prerelease: false
32
32
  type: :development
33
- name: rake
33
+ version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
35
+ name: i18n
36
+ prerelease: false
35
37
  requirement: &id002 !ruby/object:Gem::Requirement
36
38
  none: false
37
39
  requirements:
@@ -41,11 +43,11 @@ dependencies:
41
43
  segments:
42
44
  - 0
43
45
  version: "0"
44
- version_requirements: *id002
45
- prerelease: false
46
46
  type: :development
47
- name: i18n
47
+ version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
49
+ name: activesupport
50
+ prerelease: false
49
51
  requirement: &id003 !ruby/object:Gem::Requirement
50
52
  none: false
51
53
  requirements:
@@ -55,11 +57,11 @@ dependencies:
55
57
  segments:
56
58
  - 0
57
59
  version: "0"
58
- version_requirements: *id003
59
- prerelease: false
60
60
  type: :runtime
61
- name: activesupport
61
+ version_requirements: *id003
62
62
  - !ruby/object:Gem::Dependency
63
+ name: uuid4r
64
+ prerelease: false
63
65
  requirement: &id004 !ruby/object:Gem::Requirement
64
66
  none: false
65
67
  requirements:
@@ -69,11 +71,11 @@ dependencies:
69
71
  segments:
70
72
  - 0
71
73
  version: "0"
72
- version_requirements: *id004
73
- prerelease: false
74
74
  type: :runtime
75
- name: uuid4r
75
+ version_requirements: *id004
76
76
  - !ruby/object:Gem::Dependency
77
+ name: time_bandits
78
+ prerelease: false
77
79
  requirement: &id005 !ruby/object:Gem::Requirement
78
80
  none: false
79
81
  requirements:
@@ -85,10 +87,8 @@ dependencies:
85
87
  - 2
86
88
  - 2
87
89
  version: 0.2.2
88
- version_requirements: *id005
89
- prerelease: false
90
90
  type: :runtime
91
- name: time_bandits
91
+ version_requirements: *id005
92
92
  description: Logjam logger and request information forwarding
93
93
  email:
94
94
  - stefan.kaes@xing.com