instana 1.13.0 → 1.193.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +200 -133
  3. data/.editorconfig +10 -0
  4. data/.gitignore +3 -0
  5. data/.rubocop.yml +5 -1147
  6. data/.rubocop_todo.yml +1140 -0
  7. data/Appraisals +100 -0
  8. data/Gemfile +11 -32
  9. data/Rakefile +16 -39
  10. data/bin/console +5 -4
  11. data/gemfiles/.bundle/config +1 -2
  12. data/gemfiles/cuba_30.gemfile +15 -0
  13. data/gemfiles/dalli_20.gemfile +15 -0
  14. data/gemfiles/excon_02.gemfile +15 -0
  15. data/gemfiles/graphql_10.gemfile +15 -0
  16. data/gemfiles/grpc_10.gemfile +15 -0
  17. data/gemfiles/net_http_01.gemfile +14 -0
  18. data/gemfiles/rack_16.gemfile +15 -0
  19. data/gemfiles/rack_20.gemfile +15 -0
  20. data/gemfiles/rails_42.gemfile +18 -0
  21. data/gemfiles/rails_50.gemfile +18 -0
  22. data/gemfiles/rails_52.gemfile +18 -0
  23. data/gemfiles/rails_60.gemfile +18 -0
  24. data/gemfiles/redis_40.gemfile +15 -0
  25. data/gemfiles/resque_122.gemfile +16 -0
  26. data/gemfiles/resque_20.gemfile +15 -0
  27. data/gemfiles/rest_client_16.gemfile +15 -0
  28. data/gemfiles/rest_client_20.gemfile +15 -0
  29. data/gemfiles/roda_20.gemfile +15 -0
  30. data/gemfiles/roda_30.gemfile +15 -0
  31. data/gemfiles/sidekiq_42.gemfile +15 -0
  32. data/gemfiles/sidekiq_50.gemfile +15 -0
  33. data/gemfiles/sinatra_14.gemfile +15 -0
  34. data/instana.gemspec +1 -7
  35. data/lib/instana/activator.rb +41 -0
  36. data/lib/instana/activators/action_controller_api.rb +18 -0
  37. data/lib/instana/activators/action_controller_base.rb +18 -0
  38. data/lib/instana/activators/action_view.rb +18 -0
  39. data/lib/instana/activators/active_record.rb +18 -0
  40. data/lib/instana/activators/cuba.rb +18 -0
  41. data/lib/instana/activators/dalli.rb +20 -0
  42. data/lib/instana/activators/excon.rb +17 -0
  43. data/lib/instana/activators/graphql.rb +19 -0
  44. data/lib/instana/activators/grpc_client.rb +17 -0
  45. data/lib/instana/activators/grpc_server.rb +17 -0
  46. data/lib/instana/activators/net_http.rb +17 -0
  47. data/lib/instana/activators/rack.rb +13 -0
  48. data/lib/instana/activators/rails.rb +15 -0
  49. data/lib/instana/activators/redis.rb +17 -0
  50. data/lib/instana/activators/resque_client.rb +18 -0
  51. data/lib/instana/activators/resque_worker.rb +30 -0
  52. data/lib/instana/activators/rest_client.rb +17 -0
  53. data/lib/instana/activators/roda.rb +18 -0
  54. data/lib/instana/activators/sidekiq_client.rb +21 -0
  55. data/lib/instana/activators/sidekiq_worker.rb +21 -0
  56. data/lib/instana/activators/sinatra.rb +18 -0
  57. data/lib/instana/config.rb +11 -0
  58. data/lib/instana/frameworks/cuba.rb +6 -13
  59. data/lib/instana/frameworks/rails.rb +20 -33
  60. data/lib/instana/frameworks/roda.rb +7 -13
  61. data/lib/instana/frameworks/sinatra.rb +1 -8
  62. data/lib/instana/instrumentation/action_controller.rb +81 -0
  63. data/lib/instana/instrumentation/action_view.rb +27 -0
  64. data/lib/instana/instrumentation/active_record.rb +47 -0
  65. data/lib/instana/instrumentation/dalli.rb +7 -18
  66. data/lib/instana/instrumentation/excon.rb +51 -57
  67. data/lib/instana/instrumentation/graphql.rb +75 -0
  68. data/lib/instana/instrumentation/grpc.rb +70 -66
  69. data/lib/instana/instrumentation/instrumented_request.rb +69 -0
  70. data/lib/instana/instrumentation/net-http.rb +43 -47
  71. data/lib/instana/instrumentation/rack.rb +14 -53
  72. data/lib/instana/instrumentation/redis.rb +10 -18
  73. data/lib/instana/instrumentation/resque.rb +14 -50
  74. data/lib/instana/instrumentation/rest-client.rb +2 -17
  75. data/lib/instana/instrumentation/sidekiq-client.rb +0 -9
  76. data/lib/instana/instrumentation/sidekiq-worker.rb +0 -9
  77. data/lib/instana/secrets.rb +7 -7
  78. data/lib/instana/setup.rb +3 -1
  79. data/lib/instana/tracer.rb +6 -0
  80. data/lib/instana/tracing/span.rb +14 -10
  81. data/lib/instana/util.rb +15 -69
  82. data/lib/instana/version.rb +1 -1
  83. data/test/activator_test.rb +27 -0
  84. data/test/frameworks/cuba_test.rb +38 -40
  85. data/test/frameworks/roda_test.rb +39 -41
  86. data/test/frameworks/sinatra_test.rb +61 -64
  87. data/test/instrumentation/excon_test.rb +1 -2
  88. data/test/instrumentation/graphql_test.rb +116 -0
  89. data/test/instrumentation/grpc_test.rb +2 -1
  90. data/test/instrumentation/{net-http_test.rb → net_http_test.rb} +1 -0
  91. data/test/instrumentation/rack_instrumented_request_test.rb +84 -0
  92. data/test/{frameworks → instrumentation}/rack_test.rb +32 -20
  93. data/test/{frameworks/rails/actioncontroller_test.rb → instrumentation/rails_action_controller_test.rb} +37 -21
  94. data/test/instrumentation/rails_action_view_test.rb +138 -0
  95. data/test/instrumentation/rails_active_record_test.rb +121 -0
  96. data/test/instrumentation/redis_test.rb +10 -0
  97. data/test/instrumentation/resque_test.rb +3 -11
  98. data/test/instrumentation/{rest-client_test.rb → rest_client_test.rb} +6 -0
  99. data/test/instrumentation/sidekiq-client_test.rb +1 -0
  100. data/test/instrumentation/sidekiq-worker_test.rb +1 -0
  101. data/test/support/apps/active_record/active_record.rb +21 -0
  102. data/test/{servers/grpc_50051.rb → support/apps/grpc/boot.rb} +1 -1
  103. data/test/{apps → support/apps/grpc}/grpc_server.rb +0 -0
  104. data/test/{servers/rackapp_6511.rb → support/apps/http_endpoint/boot.rb} +0 -0
  105. data/test/{servers/rails_3205.rb → support/apps/rails/boot.rb} +8 -14
  106. data/test/{models → support/apps/rails/models}/block.rb +1 -1
  107. data/test/{models → support/apps/rails/models}/block6.rb +0 -0
  108. data/test/support/apps/resque/boot.rb +2 -0
  109. data/test/{jobs → support/apps/resque/jobs}/resque_error_job.rb +0 -0
  110. data/test/{jobs → support/apps/resque/jobs}/resque_fast_job.rb +0 -0
  111. data/test/support/apps/sidekiq/boot.rb +21 -0
  112. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_1.rb +0 -0
  113. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_2.rb +0 -0
  114. data/test/{servers → support/apps}/sidekiq/worker.rb +2 -2
  115. data/test/support/helpers.rb +94 -0
  116. data/test/test_helper.rb +24 -144
  117. data/test/tracing/id_management_test.rb +4 -66
  118. metadata +106 -95
  119. data/gemfiles/libraries.gemfile +0 -71
  120. data/gemfiles/rails32.gemfile +0 -51
  121. data/gemfiles/rails42.gemfile +0 -50
  122. data/gemfiles/rails50.gemfile +0 -52
  123. data/gemfiles/rails52.gemfile +0 -52
  124. data/gemfiles/rails60.gemfile +0 -72
  125. data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +0 -58
  126. data/lib/instana/frameworks/instrumentation/action_controller.rb +0 -194
  127. data/lib/instana/frameworks/instrumentation/action_view.rb +0 -43
  128. data/lib/instana/frameworks/instrumentation/active_record.rb +0 -27
  129. data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +0 -81
  130. data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +0 -56
  131. data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +0 -85
  132. data/lib/instana/instrumentation.rb +0 -25
  133. data/lib/instana/test.rb +0 -43
  134. data/test/apps/cuba.rb +0 -19
  135. data/test/apps/roda.rb +0 -13
  136. data/test/apps/sinatra.rb +0 -9
  137. data/test/frameworks/rails/actionview3_test.rb +0 -210
  138. data/test/frameworks/rails/actionview4_test.rb +0 -208
  139. data/test/frameworks/rails/actionview5_test.rb +0 -221
  140. data/test/frameworks/rails/activerecord_test.rb +0 -227
  141. data/test/servers/helpers/sidekiq_worker_initializer.rb +0 -27
@@ -0,0 +1,13 @@
1
+ module Instana
2
+ module Activators
3
+ class Rack < Activator
4
+ def can_instrument?
5
+ defined?(::Rack)
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/rack'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Instana
2
+ module Activators
3
+ class Rails < Activator
4
+ def can_instrument?
5
+ defined?(::Instana::Rack) &&
6
+ defined?(::Rails) &&
7
+ defined?(::Rails::VERSION)
8
+ end
9
+
10
+ def instrument
11
+ require 'instana/frameworks/rails'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module Instana
2
+ module Activators
3
+ class Redis < Activator
4
+ def can_instrument?
5
+ defined?(::Redis) && ::Instana.config[:redis][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/redis'
10
+
11
+ ::Redis::Client.prepend(::Instana::RedisInstrumentation)
12
+
13
+ true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ module Instana
2
+ module Activators
3
+ class ResqueClient < Activator
4
+ def can_instrument?
5
+ defined?(::Resque) &&
6
+ ::Instana.config[:'resque-client'][:enabled]
7
+ end
8
+
9
+ def instrument
10
+ require 'instana/instrumentation/resque'
11
+
12
+ ::Resque.prepend(::Instana::Instrumentation::ResqueClient)
13
+
14
+ true
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ module Instana
2
+ module Activators
3
+ class ResqueWorker < Activator
4
+ def can_instrument?
5
+ defined?(::Resque::Worker) &&
6
+ defined?(::Resque::Job) &&
7
+ ::Instana.config[:'resque-worker'][:enabled]
8
+ end
9
+
10
+ def instrument
11
+ require 'instana/instrumentation/resque'
12
+
13
+ ::Resque::Worker.prepend(::Instana::Instrumentation::ResqueWorker)
14
+ ::Resque::Job.prepend(::Instana::Instrumentation::ResqueJob)
15
+
16
+ ::Resque.before_fork do |_job|
17
+ ::Instana.agent.before_resque_fork
18
+ end
19
+ ::Resque.after_fork do |_job|
20
+ ::Instana.agent.after_resque_fork
21
+ end
22
+
23
+ # Set this so we assure that any remaining collected traces are reported at_exit
24
+ ENV['RUN_AT_EXIT_HOOKS'] = "1"
25
+
26
+ true
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ module Instana
2
+ module Activators
3
+ class RestClient < Activator
4
+ def can_instrument?
5
+ defined?(::RestClient::Request) && ::Instana.config[:'rest-client'][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/rest-client'
10
+
11
+ ::RestClient::Request.prepend ::Instana::Instrumentation::RestClientRequest
12
+
13
+ true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ module Instana
2
+ module Activators
3
+ class Roda < Activator
4
+ def can_instrument?
5
+ defined?(::Instana::Rack) && defined?(::Roda)
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/frameworks/roda'
10
+
11
+ ::Roda.use ::Instana::Rack
12
+ ::Roda.plugin ::Instana::RodaPathTemplateExtractor
13
+
14
+ true
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ module Instana
2
+ module Activators
3
+ class SidekiqClient < Activator
4
+ def can_instrument?
5
+ defined?(::Sidekiq) && ::Instana.config[:'sidekiq-client'][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/sidekiq-client'
10
+
11
+ ::Sidekiq.configure_client do |cfg|
12
+ cfg.client_middleware do |chain|
13
+ chain.add ::Instana::Instrumentation::SidekiqClient
14
+ end
15
+ end
16
+
17
+ true
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module Instana
2
+ module Activators
3
+ class SidekiqWorker < Activator
4
+ def can_instrument?
5
+ defined?(::Sidekiq) && ::Instana.config[:'sidekiq-worker'][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/sidekiq-worker'
10
+
11
+ ::Sidekiq.configure_server do |cfg|
12
+ cfg.server_middleware do |chain|
13
+ chain.add ::Instana::Instrumentation::SidekiqWorker
14
+ end
15
+ end
16
+
17
+ true
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module Instana
2
+ module Activators
3
+ class Sinatra < Activator
4
+ def can_instrument?
5
+ defined?(::Instana::Rack) && defined?(::Sinatra)
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/frameworks/sinatra'
10
+
11
+ ::Sinatra::Base.use ::Instana::Rack
12
+ ::Sinatra::Base.register ::Instana::SinatraPathTemplateExtractor
13
+
14
+ true
15
+ end
16
+ end
17
+ end
18
+ end
@@ -42,12 +42,23 @@ module Instana
42
42
  # ::Instana.config[:collect_backtraces] = true
43
43
  @config[:collect_backtraces] = false
44
44
 
45
+ # By default, collected SQL will be sanitized to remove potentially sensitive bind params such as:
46
+ # > SELECT "blocks".* FROM "blocks" WHERE "blocks"."name" = "Mr. Smith"
47
+ #
48
+ # ...would be sanitized to be:
49
+ # > SELECT "blocks".* FROM "blocks" WHERE "blocks"."name" = ?
50
+ #
51
+ # This sanitization step can be disabled by setting the following value to false.
52
+ # ::Instana.config[:sanitize_sql] = false
53
+ @config[:sanitize_sql] = true
54
+
45
55
  @config[:action_controller] = { :enabled => true }
46
56
  @config[:action_view] = { :enabled => true }
47
57
  @config[:active_record] = { :enabled => true }
48
58
  @config[:dalli] = { :enabled => true }
49
59
  @config[:excon] = { :enabled => true }
50
60
  @config[:grpc] = { :enabled => true }
61
+ @config[:graphql] = { :enabled => true }
51
62
  @config[:nethttp] = { :enabled => true }
52
63
  @config[:redis] = { :enabled => true }
53
64
  @config[:'resque-client'] = { :enabled => true }
@@ -3,23 +3,23 @@ require "instana/rack"
3
3
  module Instana
4
4
  module CubaPathTemplateExtractor
5
5
  REPLACE_TARGET = /:(?<term>[^\/]+)/i
6
-
6
+
7
7
  def self.prepended(base)
8
8
  ::Instana.logger.debug "#{base} prepended #{self}"
9
9
  end
10
-
11
- def on(*args, &blk)
10
+
11
+ def on(*args, &blk)
12
12
  wrapper = lambda do |*caputres|
13
13
  env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] << args
14
14
  .select { |a| a.is_a?(String) }
15
15
  .join('/')
16
-
16
+
17
17
  blk.call(*captures)
18
18
  end
19
-
19
+
20
20
  super(*args, &wrapper)
21
21
  end
22
-
22
+
23
23
  def call!(env)
24
24
  env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] = []
25
25
  response = super(env)
@@ -30,10 +30,3 @@ module Instana
30
30
  end
31
31
  end
32
32
  end
33
-
34
-
35
- if defined?(::Cuba)
36
- ::Instana.logger.debug "Instrumenting Cuba"
37
- Cuba.use ::Instana::Rack
38
- Cuba.prepend ::Instana::CubaPathTemplateExtractor
39
- end
@@ -1,40 +1,27 @@
1
- require "instana/rack"
1
+ if ::Rails::VERSION::MAJOR < 3
2
+ ::Rails.configuration.after_initialize do
3
+ # In Rails, let's use the Rails logger
4
+ ::Instana.logger = ::Rails.logger if ::Rails.logger
2
5
 
3
- if defined?(::Rails)
4
-
5
- if ::Rails::VERSION::MAJOR < 3
6
- ::Rails.configuration.after_initialize do
7
- # In Rails, let's use the Rails logger
8
- ::Instana.logger = ::Rails.logger if ::Rails.logger
9
-
10
- if ::Instana.config[:tracing][:enabled]
11
- ::Instana.logger.debug "Instrumenting Rack"
12
- ::Rails.configuration.middleware.insert 0, ::Instana::Rack
13
- else
14
- ::Instana.logger.info "Rack: Tracing disabled via config. Not enabling middleware."
15
- end
6
+ if ::Instana.config[:tracing][:enabled]
7
+ ::Instana.logger.debug "Instrumenting Rack"
8
+ ::Rails.configuration.middleware.insert 0, ::Instana::Rack
9
+ else
10
+ ::Instana.logger.info "Rack: Tracing disabled via config. Not enabling middleware."
16
11
  end
17
- else
18
- module ::Instana
19
- class Railtie < ::Rails::Railtie
20
- initializer 'instana.rack' do |app|
21
- # In Rails, let's use the Rails logger
22
- ::Instana.logger = ::Rails.logger if ::Rails.logger
23
-
24
- if ::Instana.config[:tracing][:enabled]
25
- ::Instana.logger.debug "Instrumenting Rack"
26
- app.config.middleware.insert 0, ::Instana::Rack
27
- else
28
- ::Instana.logger.info "Rack: Tracing disabled via config. Not enabling middleware."
29
- end
30
- end
12
+ end
13
+ else
14
+ module ::Instana
15
+ class Railtie < ::Rails::Railtie
16
+ initializer 'instana.rack' do |app|
17
+ # In Rails, let's use the Rails logger
18
+ ::Instana.logger = ::Rails.logger if ::Rails.logger
31
19
 
32
20
  if ::Instana.config[:tracing][:enabled]
33
- config.after_initialize do
34
- require "instana/frameworks/instrumentation/active_record"
35
- require "instana/frameworks/instrumentation/action_controller"
36
- require "instana/frameworks/instrumentation/action_view"
37
- end
21
+ ::Instana.logger.debug "Instrumenting Rack"
22
+ app.config.middleware.insert 0, ::Instana::Rack
23
+ else
24
+ ::Instana.logger.info "Rack: Tracing disabled via config. Not enabling middleware."
38
25
  end
39
26
  end
40
27
  end
@@ -4,11 +4,11 @@ module Instana
4
4
  module RodaPathTemplateExtractor
5
5
  module RequestMethods
6
6
  TERM = defined?(::Roda) ? ::Roda::RodaPlugins::Base::RequestMethods::TERM : Object
7
-
7
+
8
8
  def if_match(args, &blk)
9
9
  path = @remaining_path
10
10
  captures = @captures.clear
11
-
11
+
12
12
  if match_all(args)
13
13
  (env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] ||= []).concat(named_args(args, blk))
14
14
  block_result(blk.(*captures))
@@ -21,10 +21,10 @@ module Instana
21
21
  false
22
22
  end
23
23
  end
24
-
25
- def named_args(args, blk)
26
- parameters = blk.parameters
27
- args.map do |a|
24
+
25
+ def named_args(args, blk)
26
+ parameters = blk.parameters
27
+ args.map do |a|
28
28
  case a
29
29
  when String
30
30
  a
@@ -35,13 +35,7 @@ module Instana
35
35
  "{#{name}}"
36
36
  end
37
37
  end.compact
38
- end
38
+ end
39
39
  end
40
40
  end
41
41
  end
42
-
43
- if defined?(::Roda)
44
- ::Instana.logger.debug "Instrumenting Roda"
45
- Roda.use ::Instana::Rack
46
- Roda.plugin ::Instana::RodaPathTemplateExtractor
47
- end
@@ -6,10 +6,9 @@ require "instana/rack"
6
6
  module Instana
7
7
  module SinatraPathTemplateExtractor
8
8
  def self.extended(base)
9
- ::Instana.logger.debug "#{base} extended #{self}"
10
9
  base.store_path_template
11
10
  end
12
-
11
+
13
12
  def store_path_template
14
13
  after do
15
14
  @env["INSTANA_HTTP_PATH_TEMPLATE"] = @env["sinatra.route"]
@@ -18,9 +17,3 @@ module Instana
18
17
  end
19
18
  end
20
19
  end
21
-
22
- if defined?(::Sinatra)
23
- ::Instana.logger.debug "Instrumenting Sinatra"
24
- ::Sinatra::Base.use ::Instana::Rack
25
- ::Sinatra::Base.register ::Instana::SinatraPathTemplateExtractor
26
- end
@@ -0,0 +1,81 @@
1
+ module Instana
2
+ module Instrumentation
3
+ module ActionController
4
+ def process_action(*args)
5
+ call_payload = {
6
+ actioncontroller: {
7
+ controller: self.class.name,
8
+ action: action_name
9
+ }
10
+ }
11
+
12
+ request.env['INSTANA_HTTP_PATH_TEMPLATE'] = matched_path_template
13
+ ::Instana::Tracer.trace(:actioncontroller, call_payload) { super(*args) }
14
+ end
15
+
16
+ def render(*args, &block)
17
+ call_payload = {
18
+ actionview: {
19
+ name: describe_render_options(args.first) || 'Default'
20
+ }
21
+ }
22
+
23
+ ::Instana::Tracer.trace(:actionview, call_payload) { super(*args, &block) }
24
+ end
25
+
26
+ private
27
+
28
+ def matched_path_template
29
+ Rails.application.routes.router.recognize(request) do |route, _, _|
30
+ path = route.path
31
+ return path.spec.to_s
32
+ end
33
+
34
+ nil
35
+ end
36
+
37
+ def describe_render_options(options)
38
+ return unless options
39
+
40
+ describe_layout(options[:layout]) ||
41
+ describe_direct(options)
42
+ end
43
+
44
+ def describe_layout(layout)
45
+ return unless layout
46
+
47
+ case layout
48
+ when FalseClass
49
+ 'Without layout'
50
+ when String
51
+ layout
52
+ when Proc
53
+ 'Proc'
54
+ else
55
+ 'Default'
56
+ end
57
+ end
58
+
59
+ def describe_direct(options)
60
+ case options
61
+ when ->(o) { o.key?(:nothing) }
62
+ 'Nothing'
63
+ when ->(o) { o.key?(:plain) }
64
+ 'Plaintext'
65
+ when ->(o) { o.key?(:json) }
66
+ 'JSON'
67
+ when ->(o) { o.key?(:xml) }
68
+ 'XML'
69
+ when ->(o) { o.key?(:body) }
70
+ 'Raw'
71
+ when ->(o) { o.key?(:js) }
72
+ 'Javascript'
73
+ when ->(o) { o.key?(:template) }
74
+ options[:template]
75
+ when ->(o) { o.key?(:file) }
76
+ options[:file]
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end