newrelic_rpm 3.9.3.241 → 3.9.4.245

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gitignore +1 -0
  3. data/CHANGELOG +29 -0
  4. data/Rakefile +41 -0
  5. data/cert/cacert.pem +1176 -117
  6. data/lib/new_relic/agent/agent_logger.rb +14 -0
  7. data/lib/new_relic/agent/configuration/default_source.rb +88 -86
  8. data/lib/new_relic/agent/configuration/environment_source.rb +5 -1
  9. data/lib/new_relic/agent/configuration/high_security_source.rb +3 -1
  10. data/lib/new_relic/agent/configuration/yaml_source.rb +3 -3
  11. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +4 -0
  12. data/lib/new_relic/agent/method_tracer.rb +17 -2
  13. data/lib/new_relic/agent/new_relic_service.rb +21 -19
  14. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +8 -2
  15. data/lib/new_relic/agent/request_sampler.rb +9 -11
  16. data/lib/new_relic/version.rb +1 -1
  17. data/lib/tasks/config.html.erb +2 -2
  18. data/lib/tasks/config.rake +6 -6
  19. data/test/environments/lib/environments/runner.rb +4 -4
  20. data/test/environments/rails42/Gemfile +35 -0
  21. data/test/environments/rails42/Rakefile +11 -0
  22. data/test/environments/rails42/config/application.rb +18 -0
  23. data/test/environments/rails42/config/boot.rb +10 -0
  24. data/test/environments/rails42/config/database.yml +26 -0
  25. data/test/environments/rails42/config/environment.rb +6 -0
  26. data/test/environments/rails42/db/schema.rb +5 -0
  27. data/test/fixtures/cross_agent_tests/README.md +40 -1
  28. data/test/fixtures/cross_agent_tests/cat_map.json +305 -73
  29. data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/README.md +4 -0
  30. data/test/fixtures/cross_agent_tests/sql_obfuscation/{end_of_line_comments_with_quotes.obfuscated → pathological/end_of_line_comments_with_quotes.obfuscated} +0 -0
  31. data/test/fixtures/cross_agent_tests/sql_obfuscation/{end_of_line_comments_with_quotes.sql → pathological/end_of_line_comments_with_quotes.sql} +0 -0
  32. data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_comments_and_quotes.obfuscated → pathological/mixed_comments_and_quotes.obfuscated} +0 -0
  33. data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_comments_and_quotes.sql → pathological/mixed_comments_and_quotes.sql} +0 -0
  34. data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_quotes_comments_and_newlines.obfuscated → pathological/mixed_quotes_comments_and_newlines.obfuscated} +0 -0
  35. data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_quotes_comments_and_newlines.sql → pathological/mixed_quotes_comments_and_newlines.sql} +0 -0
  36. data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_quotes_end_of_line_comments.obfuscated → pathological/mixed_quotes_end_of_line_comments.obfuscated} +0 -0
  37. data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_quotes_end_of_line_comments.sql → pathological/mixed_quotes_end_of_line_comments.sql} +0 -0
  38. data/test/fixtures/cross_agent_tests/sql_obfuscation/{quote_delimiters_in_comments.obfuscated → pathological/quote_delimiters_in_comments.obfuscated} +0 -0
  39. data/test/fixtures/cross_agent_tests/sql_obfuscation/{quote_delimiters_in_comments.sql → pathological/quote_delimiters_in_comments.sql} +0 -0
  40. data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +9 -4
  41. data/test/multiverse/suites/rails/Envfile +6 -0
  42. data/test/multiverse/suites/rails/ignore_test.rb +7 -7
  43. data/test/multiverse/suites/rails/view_instrumentation_test.rb +13 -13
  44. data/test/new_relic/agent/configuration/environment_source_test.rb +8 -0
  45. data/test/new_relic/agent/configuration/yaml_source_test.rb +1 -1
  46. data/test/new_relic/agent/database/sql_obfuscation_test.rb +17 -8
  47. data/test/new_relic/agent/instrumentation/active_record_test.rb +50 -7
  48. data/test/new_relic/agent/new_relic_service_test.rb +17 -4
  49. data/test/new_relic/http_client_test_cases.rb +15 -5
  50. data/test/performance/lib/performance.rb +8 -0
  51. data/test/performance/lib/performance/baseline.rb +36 -0
  52. data/test/performance/lib/performance/baseline_compare_reporter.rb +82 -0
  53. data/test/performance/lib/performance/baseline_save_reporter.rb +24 -0
  54. data/test/performance/lib/performance/console_reporter.rb +7 -20
  55. data/test/performance/lib/performance/reporting.rb +36 -0
  56. data/test/performance/lib/performance/table.rb +105 -0
  57. data/test/performance/script/runner +26 -20
  58. data/test/performance/suites/marshalling.rb +12 -12
  59. data/test/script/path_hash.rb +1 -1
  60. metadata +25 -25
  61. metadata.gz.sig +0 -0
  62. data/cert/oldsite.pem +0 -28
  63. data/cert/site.pem +0 -27
  64. data/test/flaky_proxy/Gemfile +0 -3
  65. data/test/flaky_proxy/README.md +0 -140
  66. data/test/flaky_proxy/lib/flaky_proxy.rb +0 -23
  67. data/test/flaky_proxy/lib/flaky_proxy/connection.rb +0 -45
  68. data/test/flaky_proxy/lib/flaky_proxy/http_message.rb +0 -107
  69. data/test/flaky_proxy/lib/flaky_proxy/proxy.rb +0 -58
  70. data/test/flaky_proxy/lib/flaky_proxy/rule.rb +0 -72
  71. data/test/flaky_proxy/lib/flaky_proxy/rule_set.rb +0 -45
  72. data/test/flaky_proxy/lib/flaky_proxy/sequence.rb +0 -14
  73. data/test/flaky_proxy/lib/flaky_proxy/server.rb +0 -22
  74. data/test/flaky_proxy/script/flaky_proxy +0 -39
@@ -147,19 +147,19 @@ class Marshalling < Performance::TestCase
147
147
  events = []
148
148
  1000.times do
149
149
  event = {
150
- :timestamp => Time.now.to_f,
151
- :name => "Controller/foo/bar",
152
- :type => "Transaction",
153
- :duration => rand,
154
- :databaseDuration => rand,
155
- :databaseCallCount=> rand,
156
- :gcCumulative => rand,
157
- :host => 'lo-calhost',
158
- :color => 'blue-green',
159
- :shape => 'squarish',
160
- :texture => 'sort of lumpy like a bag of frozen peas'
150
+ 'timestamp' => Time.now.to_f,
151
+ 'name' => "Controller/foo/bar",
152
+ 'type' => "Transaction",
153
+ 'duration' => rand,
154
+ 'databaseDuration' => rand,
155
+ 'databaseCallCount'=> rand,
156
+ 'gcCumulative' => rand,
157
+ 'host' => 'lo-calhost',
158
+ 'color' => 'blue-green',
159
+ 'shape' => 'squarish',
160
+ 'texture' => 'sort of lumpy like a bag of frozen peas'
161
161
  }
162
- events << [event]
162
+ events << [event, {}]
163
163
  end
164
164
  [rand(1000000), events]
165
165
  end
@@ -46,4 +46,4 @@ path.each do |hop|
46
46
  path_hash = xor_result
47
47
  end
48
48
 
49
- puts "Final result: 0x#{path_hash.to_s(16).rjust(8, '0')}"
49
+ puts "Final result: #{path_hash.to_s(16).rjust(8, '0')}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.3.241
4
+ version: 3.9.4.245
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -41,7 +41,7 @@ cert_chain:
41
41
  K0ZZTXduQWIrVm1OT2h2MVMrc0poYmpaMzBQS2d6NnZMaFQ2dW5pZUNqTGs5
42
42
  d0dHbWxTSwpZamJudkE5cXJhTExhalNqCi0tLS0tRU5EIENFUlRJRklDQVRF
43
43
  LS0tLS0K
44
- date: 2014-08-22 00:00:00.000000000 Z
44
+ date: 2014-09-04 00:00:00.000000000 Z
45
45
  dependencies:
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rake
@@ -246,8 +246,6 @@ files:
246
246
  - bin/newrelic_cmd
247
247
  - bin/nrdebug
248
248
  - cert/cacert.pem
249
- - cert/oldsite.pem
250
- - cert/site.pem
251
249
  - config.dot
252
250
  - config/database.yml
253
251
  - gem-public_cert.pem
@@ -554,6 +552,13 @@ files:
554
552
  - test/environments/rails41/config/database.yml
555
553
  - test/environments/rails41/config/environment.rb
556
554
  - test/environments/rails41/db/schema.rb
555
+ - test/environments/rails42/Gemfile
556
+ - test/environments/rails42/Rakefile
557
+ - test/environments/rails42/config/application.rb
558
+ - test/environments/rails42/config/boot.rb
559
+ - test/environments/rails42/config/database.yml
560
+ - test/environments/rails42/config/environment.rb
561
+ - test/environments/rails42/db/schema.rb
557
562
  - test/fixtures/cross_agent_tests/README.md
558
563
  - test/fixtures/cross_agent_tests/cat_map.json
559
564
  - test/fixtures/cross_agent_tests/labels.json
@@ -683,8 +688,6 @@ files:
683
688
  - test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.sql
684
689
  - test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.obfuscated
685
690
  - test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.sql
686
- - test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comments_with_quotes.obfuscated
687
- - test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comments_with_quotes.sql
688
691
  - test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.obfuscated
689
692
  - test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.sql
690
693
  - test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.obfuscated
@@ -695,20 +698,23 @@ files:
695
698
  - test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.sql
696
699
  - test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_double_quoted_string.mysql.sql
697
700
  - test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_single_quoted_string.sql
698
- - test/fixtures/cross_agent_tests/sql_obfuscation/mixed_comments_and_quotes.obfuscated
699
- - test/fixtures/cross_agent_tests/sql_obfuscation/mixed_comments_and_quotes.sql
700
- - test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_comments_and_newlines.obfuscated
701
- - test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_comments_and_newlines.sql
702
- - test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_end_of_line_comments.obfuscated
703
- - test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_end_of_line_comments.sql
704
701
  - test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.obfuscated
705
702
  - test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.sql
706
703
  - test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.obfuscated
707
704
  - test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.sql
708
705
  - test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.obfuscated
709
706
  - test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.sql
710
- - test/fixtures/cross_agent_tests/sql_obfuscation/quote_delimiters_in_comments.obfuscated
711
- - test/fixtures/cross_agent_tests/sql_obfuscation/quote_delimiters_in_comments.sql
707
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/README.md
708
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/end_of_line_comments_with_quotes.obfuscated
709
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/end_of_line_comments_with_quotes.sql
710
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_comments_and_quotes.obfuscated
711
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_comments_and_quotes.sql
712
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_comments_and_newlines.obfuscated
713
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_comments_and_newlines.sql
714
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_end_of_line_comments.obfuscated
715
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_end_of_line_comments.sql
716
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/quote_delimiters_in_comments.obfuscated
717
+ - test/fixtures/cross_agent_tests/sql_obfuscation/pathological/quote_delimiters_in_comments.sql
712
718
  - test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.obfuscated
713
719
  - test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.sql
714
720
  - test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.obfuscated
@@ -737,17 +743,6 @@ files:
737
743
  - test/fixtures/cross_agent_tests/url_clean.json
738
744
  - test/fixtures/cross_agent_tests/url_domain_extraction.json
739
745
  - test/fixtures/proc_cpuinfo.txt
740
- - test/flaky_proxy/Gemfile
741
- - test/flaky_proxy/README.md
742
- - test/flaky_proxy/lib/flaky_proxy.rb
743
- - test/flaky_proxy/lib/flaky_proxy/connection.rb
744
- - test/flaky_proxy/lib/flaky_proxy/http_message.rb
745
- - test/flaky_proxy/lib/flaky_proxy/proxy.rb
746
- - test/flaky_proxy/lib/flaky_proxy/rule.rb
747
- - test/flaky_proxy/lib/flaky_proxy/rule_set.rb
748
- - test/flaky_proxy/lib/flaky_proxy/sequence.rb
749
- - test/flaky_proxy/lib/flaky_proxy/server.rb
750
- - test/flaky_proxy/script/flaky_proxy
751
746
  - test/helpers/exceptions.rb
752
747
  - test/helpers/file_searching.rb
753
748
  - test/helpers/mongo_metric_builder.rb
@@ -1090,6 +1085,9 @@ files:
1090
1085
  - test/new_relic/version_number_test.rb
1091
1086
  - test/performance/README.md
1092
1087
  - test/performance/lib/performance.rb
1088
+ - test/performance/lib/performance/baseline.rb
1089
+ - test/performance/lib/performance/baseline_compare_reporter.rb
1090
+ - test/performance/lib/performance/baseline_save_reporter.rb
1093
1091
  - test/performance/lib/performance/console_reporter.rb
1094
1092
  - test/performance/lib/performance/hako_client.rb
1095
1093
  - test/performance/lib/performance/hako_reporter.rb
@@ -1100,8 +1098,10 @@ files:
1100
1098
  - test/performance/lib/performance/instrumentor.rb
1101
1099
  - test/performance/lib/performance/json_reporter.rb
1102
1100
  - test/performance/lib/performance/platform.rb
1101
+ - test/performance/lib/performance/reporting.rb
1103
1102
  - test/performance/lib/performance/result.rb
1104
1103
  - test/performance/lib/performance/runner.rb
1104
+ - test/performance/lib/performance/table.rb
1105
1105
  - test/performance/lib/performance/test_case.rb
1106
1106
  - test/performance/lib/performance/timer.rb
1107
1107
  - test/performance/script/baselines
metadata.gz.sig CHANGED
Binary file
data/cert/oldsite.pem DELETED
@@ -1,28 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIE1TCCA72gAwIBAgIEQ2DfKzANBgkqhkiG9w0BAQUFADCByjELMAkGA1UEBhMC
3
- VVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNV
4
- BAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlmaWNh
5
- dGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5IFNl
6
- Y3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5NjkyODcw
7
- HhcNMDkwMzE4MjEzMjI5WhcNMTEwNDMwMDIyNzExWjBVMRcwFQYDVQQKEw4qLm5l
8
- d3JlbGljLmNvbTEhMB8GA1UECxMYRG9tYWluIENvbnRyb2wgVmFsaWRhdGVkMRcw
9
- FQYDVQQDEw4qLm5ld3JlbGljLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
10
- gYEAuBCbjfFuWoIqosv2f9vofqeqZaCsKBWKs799M62BRJgatXM0sPR8T5FJAAYe
11
- /N5qX3Ei1paM9g8/VKM+w4fpKB9BceE7wwl77vFltgLz0o/IejLodcMDd9Inmt2P
12
- ax8VLkCxQup+21H3RIYRSyi4TKJeghq+MuDiYKksYZ65YnkCAwEAAaOCAbkwggG1
13
- MA8GA1UdEwEB/wQFMAMBAQAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC
14
- MA4GA1UdDwEB/wQEAwIFoDAyBgNVHR8EKzApMCegJaAjhiFodHRwOi8vY3JsLmdv
15
- ZGFkZHkuY29tL2dkczEtMy5jcmwwUwYDVR0gBEwwSjBIBgtghkgBhv1tAQcXATA5
16
- MDcGCCsGAQUFBwIBFitodHRwOi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N0LmNvbS9ndHNzbC5jcnQwDQYJKoZI
21
- hvcNAQEFBQADggEBAHuO8i5vPkZfPhT1a9GCn49J8Ada+faVpGnZ0nE3ufqhD52d
22
- dZaVyUgft+2s+ksxIGjCwl3X+jeLfOL+dqqt77E1JRAskrCIfFHeQDS/7P6Ch3pE
23
- zm8uTkMARuRARSi+O0jwTfYH5ApRb7eumgtz8sELg94yPCAKeegrK0zqhNGF6Bnp
24
- tuSN36tUDtZb1Xy+sz6RzNpQJS/b1KH7e+jbEudctO8b6mP8/5bGoDcWQqPn4YWd
25
- UAkOShAeRtdc0jsn62VlqDEfQQ16CsmD1Hoh9Mxhwj9rSqwpDSc9f0isJ6xypDhM
26
- 4cNwyeIvhj++8Ir5LdCmWGLcUtNqUs4jK36ph7k=
27
- -----END CERTIFICATE-----
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'http_parser.rb'
@@ -1,140 +0,0 @@
1
- ## flaky_proxy
2
-
3
- `flaky_proxy` helps you simulate failures in an HTTP service in a configurable
4
- way, without modifying the underlying service. Specifically, you can use it as a proxy in front of the collector in order to simulate bad network conditions and see how your agent responds.
5
-
6
- ## Usage
7
-
8
- ```
9
- flaky_proxy -l 8888 -t 8081 <rules_file>
10
- ```
11
-
12
- This tells `flaky_proxy` to listen on port 8888 for incoming connections, and
13
- forward them on to port 8081 of localhost. If you'd like to specify the bind
14
- host or target host, you can do that too:
15
-
16
- ```
17
- flaky_proxy -l localhost:8888 -t collector.newrelic.com:80 <rules_file>
18
- ```
19
-
20
- This example will instruct `flaky_proxy` to listen on port 8888 of localhost,
21
- and forward data to port 80 of `collector.newrelic.com`.
22
-
23
- ### Rules file format
24
-
25
- The `<rules_file>` file is a Ruby file written using a simple DSL, to tell the
26
- tool how to handle incoming traffic. It consists of a series of `match`
27
- expressions, each with an accompanying block to be executed in order to
28
- determine how to deal with a matching HTTP request.
29
-
30
- Each incoming HTTP request is evaluated against these match expressions, and the
31
- first matching expression is chosen. Matching is done by matching the request
32
- URL of incoming requests against a regular expression given as the first
33
- argument to `match`.
34
-
35
- In the body of the block passed to `match`, you may specify one of the following
36
- actions:
37
-
38
- * `pass` - pass the request through untouched to the target server
39
- * `respond` - respond with a canned response, without talking to the target server
40
- * `delay` - sleep for a specified number of seconds before passing the request through to the target server
41
- * `close` - close the TCP connection without sending a response
42
-
43
- Any incoming request that does not match any of the rules specified in your rules file will be treated as an implicit `pass`.
44
-
45
- A few examples to make things more concrete:
46
-
47
- Close the TCP connection without sending an HTTP response for any request with `foo` in the URL:
48
-
49
- ```
50
- match /foo/ { close }
51
- ```
52
-
53
- Respond with a 503 status code to 50% of incoming requests matching `metric_data`:
54
-
55
- ```
56
- match /metric_data/ do |req|
57
- if rand > 0.5
58
- pass
59
- else
60
- respond :status => 503
61
- end
62
- end
63
- ```
64
-
65
- Respond with a 200 OK status code and a custom body to requests matching `get_agent_commands`:
66
-
67
- ```
68
- match /get_agent_commands/ do |req|
69
- respond :body => '{ "error": "bad news" }'
70
- end
71
- ```
72
-
73
- Delay all requests matching `slowdown` by 10 seconds:
74
-
75
- ```
76
- match /slowdown/ do
77
- delay 10
78
- end
79
- ```
80
-
81
- The rules file will be watched for changes automatically, and the rules will
82
- be potentially reloaded each time the proxy accepts a new connection.
83
-
84
- ### Available Actions
85
-
86
- #### pass
87
-
88
- Pass the request on to the backend server without modification.
89
-
90
- #### close
91
-
92
- Close the TCP connection from the client before forwarding it on to the backend server.
93
-
94
- #### respond(response_spec)
95
-
96
- Respond to the client with a canned response, instead of forwarding the request on to the backend server. `response_spec` should be a `Hash` describing the canned response to be sent to the client. Recognized keys in the `response_spec` are:
97
-
98
- * `:status` - A `Fixnum` with the HTTP status code. Default: 200.
99
- * `:headers` - A `Hash` with response headers. Default: the `Content-Length` header will be automatically set based on the response body length.
100
- * `:body` - A `String` containing the HTTP response body. Default = `''`.
101
-
102
- #### delay(amount)
103
-
104
- Delay for `amount` seconds before forwarding the request on to the backend server.
105
-
106
- ### Sequences
107
-
108
- Sometimes it's useful to be able to easily express a sequence of actions to be
109
- taken upon matching a particular rule. To facilitate this, `flaky_proxy`
110
- supports defining actions using the `sequence` statement.
111
-
112
- For example:
113
-
114
- ```
115
- seq = sequence do
116
- pass
117
- respond :status => 503
118
- respond :status => 404
119
- end
120
-
121
- match /connect/, seq
122
- ```
123
-
124
- This will cause the first request matching `connect` to be passed through to the
125
- target server, the second to be responded to with a 503 status, and the third to
126
- be responded to with a 404 status. Any subsequent requests will get the default
127
- action of being passed through to the target server.
128
-
129
- Note that the block passed to `sequence` is evaluated only once, when the rules
130
- file is loaded, instead of once per request (as a block passed to `match` would
131
- be).
132
-
133
- ## Caveats
134
-
135
- * Entirely single-threaded and not evented, handles only one connection at a time
136
- * Almost certainly doesn't handle string encodings correctly
137
-
138
- ## Bugs? Feature Requests?
139
-
140
- Send 'em in! Find Ben Weintraub in the 'Ruby Agent Dev' room, or via email.
@@ -1,23 +0,0 @@
1
- # encoding: utf-8
2
- # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
-
5
- $: << File.expand_path(File.dirname(__FILE__))
6
-
7
- require 'logger'
8
-
9
- require 'flaky_proxy/server'
10
- require 'flaky_proxy/connection'
11
- require 'flaky_proxy/http_message'
12
- require 'flaky_proxy/rule'
13
- require 'flaky_proxy/rule_set'
14
- require 'flaky_proxy/proxy'
15
- require 'flaky_proxy/sequence'
16
-
17
- module FlakyProxy
18
- @logger = Logger.new($stderr)
19
-
20
- def self.logger
21
- @logger
22
- end
23
- end
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
- # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
-
5
- module FlakyProxy
6
- class Connection
7
- def initialize(client_socket, server, rules)
8
- @client_socket = client_socket
9
- @server_socket = nil
10
- @server = server
11
- @rules = rules
12
- end
13
-
14
- def client_socket
15
- @client_socket
16
- end
17
-
18
- def server_socket
19
- @server_socket ||= @server.open_socket
20
- end
21
-
22
- def shutdown
23
- @client_socket.close if @client_socket && !@client_socket.closed?
24
- @server_socket.close if @server_socket && !@server_socket.closed?
25
- @shutdown = true
26
- end
27
-
28
- def service
29
- loop do
30
- service_one
31
- break if @shutdown
32
- end
33
- end
34
-
35
- def service_one
36
- request = Request.read_from(client_socket)
37
- if request.complete?
38
- rule = @rules.match(request)
39
- rule.evaluate(request, self)
40
- else
41
- shutdown
42
- end
43
- end
44
- end
45
- end
@@ -1,107 +0,0 @@
1
- # encoding: utf-8
2
- # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
-
5
- require 'http/parser'
6
- require 'webrick'
7
-
8
- module FlakyProxy
9
- MAXBUF = 10 * 4096 # 40KB
10
-
11
- class HttpMessage
12
- def self.read_from(io)
13
- msg = self.new
14
- msg.read(io)
15
- msg
16
- end
17
-
18
- attr_reader :raw_data
19
-
20
- def initialize
21
- @parser = Http::Parser.new
22
- @raw_data = ''
23
- @complete = false
24
- @parser.on_message_complete = proc do |env|
25
- @complete = true
26
- end
27
- end
28
-
29
- def request_url
30
- @parser.request_url if complete?
31
- end
32
-
33
- def request_path
34
- @parser.request_path if complete?
35
- end
36
-
37
- def <<(data)
38
- @raw_data << data
39
- @parser << data
40
- end
41
-
42
- def read(io)
43
- loop do
44
- return if complete? || io.closed?
45
- ready = select([io])
46
- if ready && ready.first.include?(io)
47
- if io.eof?
48
- return
49
- else
50
- self << io.readpartial(MAXBUF)
51
- end
52
- end
53
- end
54
- rescue Errno::ECONNRESET
55
- FlakyProxy::Logger.warn("Connection reset by peer when reading from #{io}")
56
- end
57
-
58
- def complete?
59
- @complete
60
- end
61
-
62
- def relay_to(io)
63
- io.write(@raw_data)
64
- end
65
- end
66
-
67
- class Request < HttpMessage
68
- def request_method
69
- @parser.http_method
70
- end
71
- end
72
-
73
- class Response < HttpMessage
74
- def self.build(options={})
75
- defaults = {
76
- :status => 200,
77
- :headers => {},
78
- :body => ''
79
- }
80
- options = defaults.merge(options)
81
- status_line = build_status_line(options[:status])
82
- headers = build_headers(options[:body], options[:headers])
83
-
84
- rsp = self.new
85
- rsp << status_line
86
- rsp << headers
87
- rsp << "\r\n"
88
- rsp << options[:body]
89
- rsp
90
- end
91
-
92
- def self.build_status_line(status)
93
- status_text = WEBrick::HTTPStatus::StatusMessage[status]
94
- "HTTP/1.1 #{status} #{status_text}\r\n"
95
- end
96
-
97
- def self.build_headers(body, headers)
98
- default_headers = {
99
- 'Content-Length' => body.bytesize
100
- }
101
- headers = default_headers.merge(headers)
102
- headers.map do |key, value|
103
- "#{key}: #{value}\r\n"
104
- end.join
105
- end
106
- end
107
- end