haproxy2rpm 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/README.md +15 -0
- data/lib/haproxy2rpm/rpm.rb +7 -2
- data/lib/haproxy2rpm/version.rb +1 -1
- data/test/rpm_test.rb +8 -0
- metadata +62 -96
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -27,6 +27,21 @@ Tell haproxy to log to syslog. e.g:
|
|
27
27
|
|
28
28
|
Check the examples folder
|
29
29
|
|
30
|
+
|
31
|
+
## Problems with haproxy timers
|
32
|
+
|
33
|
+
Slow clients (e.g mobile clients over an edge connection) influence the
|
34
|
+
measurements haproxy returns. The same happens for requests that do send
|
35
|
+
a lot of data (e.g POST/PUT). In that case, the 'tr' value provided by
|
36
|
+
haproxy is generally a bit higher. When you have many slow clients, it
|
37
|
+
is significantely higher. For more information about the values haproxy
|
38
|
+
provides, refer to the [manual](http://code.google.com/p/haproxy-docs/wiki/TimingEvents).
|
39
|
+
|
40
|
+
## The issue of the default route
|
41
|
+
|
42
|
+
When haproxy2rpm does not find a route, it will record it under a
|
43
|
+
default name so that NewRelic is not flooded with millions of routes. You can provide by setting 'config.default_route'.
|
44
|
+
|
30
45
|
## Node.js support
|
31
46
|
|
32
47
|
Check the examples folder
|
data/lib/haproxy2rpm/rpm.rb
CHANGED
@@ -2,6 +2,7 @@ module Haproxy2Rpm
|
|
2
2
|
class Rpm
|
3
3
|
|
4
4
|
attr_accessor :routes, :queue_time_stats_engine, :stats_engine
|
5
|
+
attr_writer :default_route
|
5
6
|
|
6
7
|
def initialize(options = {})
|
7
8
|
agent_options = {:log => Haproxy2Rpm.logger}
|
@@ -21,7 +22,11 @@ module Haproxy2Rpm
|
|
21
22
|
def config
|
22
23
|
self
|
23
24
|
end
|
24
|
-
|
25
|
+
|
26
|
+
def default_route
|
27
|
+
@default_route ||= '/default'
|
28
|
+
end
|
29
|
+
|
25
30
|
def process_and_send(line)
|
26
31
|
begin
|
27
32
|
message = message_parser.call(line)
|
@@ -88,7 +93,7 @@ module Haproxy2Rpm
|
|
88
93
|
return route[:target]
|
89
94
|
end
|
90
95
|
end
|
91
|
-
|
96
|
+
default_route
|
92
97
|
end
|
93
98
|
end
|
94
99
|
end
|
data/lib/haproxy2rpm/version.rb
CHANGED
data/test/rpm_test.rb
CHANGED
@@ -33,6 +33,7 @@ class RpmTest < Test::Unit::TestCase
|
|
33
33
|
end
|
34
34
|
|
35
35
|
should 'record the controller metric' do
|
36
|
+
@instance.routes = [{:pattern => %r{^/user/check$}, :target => '/user/check'}]
|
36
37
|
NewRelic::Agent.expects(:record_transaction).with(anything, has_entry('metric', 'Controller/user/check'))
|
37
38
|
@instance.process_and_send(log_entry(:http_path => "/user/check"))
|
38
39
|
end
|
@@ -42,6 +43,13 @@ class RpmTest < Test::Unit::TestCase
|
|
42
43
|
NewRelic::Agent.expects(:record_transaction).with(anything, has_entry('metric', 'Controller/user/update'))
|
43
44
|
@instance.process_and_send(log_entry(:http_path => "/49339032093/update"))
|
44
45
|
end
|
46
|
+
|
47
|
+
should 'fallback to default route when unknown' do
|
48
|
+
@instance.routes = []
|
49
|
+
@instance.default_route = '/default'
|
50
|
+
NewRelic::Agent.expects(:record_transaction).with(anything, has_entry('metric', 'Controller/default'))
|
51
|
+
@instance.process_and_send(log_entry(:http_path => "/unknown/route"))
|
52
|
+
end
|
45
53
|
|
46
54
|
should 'record the queue time' do
|
47
55
|
stats = mock
|
metadata
CHANGED
@@ -1,105 +1,81 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: haproxy2rpm
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Patrick Huesler
|
14
9
|
- Martin Rehfeld
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-01-05 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
23
16
|
name: newrelic_rpm
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70355528340020 !ruby/object:Gem::Requirement
|
26
18
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
34
23
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: eventmachine-tail
|
38
24
|
prerelease: false
|
39
|
-
|
25
|
+
version_requirements: *70355528340020
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: eventmachine-tail
|
28
|
+
requirement: &70355528339240 !ruby/object:Gem::Requirement
|
40
29
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
48
34
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rake
|
52
35
|
prerelease: false
|
53
|
-
|
36
|
+
version_requirements: *70355528339240
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
requirement: &70355528338720 !ruby/object:Gem::Requirement
|
54
40
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
62
45
|
type: :development
|
63
|
-
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: shoulda-context
|
66
46
|
prerelease: false
|
67
|
-
|
47
|
+
version_requirements: *70355528338720
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: shoulda-context
|
50
|
+
requirement: &70355528338120 !ruby/object:Gem::Requirement
|
68
51
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
76
56
|
type: :development
|
77
|
-
version_requirements: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: mocha
|
80
57
|
prerelease: false
|
81
|
-
|
58
|
+
version_requirements: *70355528338120
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: mocha
|
61
|
+
requirement: &70355528337540 !ruby/object:Gem::Requirement
|
82
62
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
90
67
|
type: :development
|
91
|
-
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70355528337540
|
92
70
|
description: Sending haproxy logs to new relic rpm
|
93
|
-
email:
|
71
|
+
email:
|
94
72
|
- patrick.huesler@wooga.com
|
95
73
|
- martin.rehfeld@wooga.com
|
96
|
-
executables:
|
74
|
+
executables:
|
97
75
|
- haproxy2rpm
|
98
76
|
extensions: []
|
99
|
-
|
100
77
|
extra_rdoc_files: []
|
101
|
-
|
102
|
-
files:
|
78
|
+
files:
|
103
79
|
- .gitignore
|
104
80
|
- .travis.yml
|
105
81
|
- CHANGELOG.md
|
@@ -126,41 +102,31 @@ files:
|
|
126
102
|
- test/rpm_test.rb
|
127
103
|
- test/syslog_test.rb
|
128
104
|
- test/test_helper.rb
|
129
|
-
has_rdoc: true
|
130
105
|
homepage: https://github.com/wooga/haproxy2rpm
|
131
106
|
licenses: []
|
132
|
-
|
133
107
|
post_install_message:
|
134
108
|
rdoc_options: []
|
135
|
-
|
136
|
-
require_paths:
|
109
|
+
require_paths:
|
137
110
|
- lib
|
138
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
112
|
none: false
|
140
|
-
requirements:
|
141
|
-
- -
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
|
144
|
-
|
145
|
-
- 0
|
146
|
-
version: "0"
|
147
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
118
|
none: false
|
149
|
-
requirements:
|
150
|
-
- -
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
|
153
|
-
segments:
|
154
|
-
- 0
|
155
|
-
version: "0"
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
156
123
|
requirements: []
|
157
|
-
|
158
124
|
rubyforge_project:
|
159
|
-
rubygems_version: 1.6
|
125
|
+
rubygems_version: 1.8.6
|
160
126
|
signing_key:
|
161
127
|
specification_version: 3
|
162
128
|
summary: Sending haproxy logs to new relic rpm
|
163
|
-
test_files:
|
129
|
+
test_files:
|
164
130
|
- test/fixtures/config.rb
|
165
131
|
- test/haproxy2pm_test.rb
|
166
132
|
- test/rpm_test.rb
|