Class: Contrast::Framework::BaseSupport

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/framework/base_support.rb

Overview

The API for all subclasses to implement to correctly support a given framework

Direct Known Subclasses

Rack::Support, Rails::Support, Sinatra::Support

Class Method Summary collapse

Class Method Details

.after_load_patchesSet<Contrast::Agent::Patching::Policy::AfterLoadPatch>?

Some Frameworks require specific patching for their classes to handle functionality like routing. To accommodate this, this method provides a place to register those patches for invocation in our AfterLoadPatcher flow.

By default, and hopefully in all cases, we won’t need these patches, so we’re allowing nil here rather than raising an exception.

Returns:



62
# File 'lib/contrast/framework/base_support.rb', line 62

def after_load_patches; end

.application_nameObject

Raises:

  • (NoMethodError)


18
19
20
# File 'lib/contrast/framework/base_support.rb', line 18

def application_name
  raise NoMethodError, 'Subclasses of BaseSupport should implement this method'
end

.before_load_patches!Object

Some Frameworks require specific patching for their classes to handle functionality like configuration scanning. To accommodate this, this method provides a place to register those patches for invocation on Agent load.

By default, and hopefully in all cases, we won’t need these patches, so we’re allowing nil here rather than raising an exception.



49
# File 'lib/contrast/framework/base_support.rb', line 49

def before_load_patches!; end

.collect_routesObject

Find all the predefined routes for this application and append them to the provided inventory message msg should be a Contrast::Api::Dtm::ApplicationUpdate or some other msg that has a routes array consisting of Contrast::Api::Dtm::RouteCoverage

Raises:

  • (NoMethodError)


30
31
32
# File 'lib/contrast/framework/base_support.rb', line 30

def collect_routes
  raise NoMethodError, 'Subclasses of BaseSupport should implement this method'
end

.current_routeObject

Raises:

  • (NoMethodError)


34
35
36
# File 'lib/contrast/framework/base_support.rb', line 34

def current_route
  raise NoMethodError, 'Subclasses of BaseSupport should implement this method'
end

.detection_classObject

The top level module name used by the framework



10
11
12
# File 'lib/contrast/framework/base_support.rb', line 10

def detection_class
  raise NoMethodError('Subclasses of BaseSupport should implement this method')
end

.retrieve_request(_env) ⇒ Object

Raises:

  • (NoMethodError)


38
39
40
# File 'lib/contrast/framework/base_support.rb', line 38

def retrieve_request _env
  raise NoMethodError, 'Subclasses of BaseSupport should implement this method'
end

.server_typeObject

Raises:

  • (NoMethodError)


22
23
24
# File 'lib/contrast/framework/base_support.rb', line 22

def server_type
  raise NoMethodError, 'Subclasses of BaseSupport should implement this method'
end

.streaming?(_env) ⇒ Boolean

We only support websockets in rails right now, so we won’t detect streaming in any other framework

Returns:

  • (Boolean)


66
67
68
# File 'lib/contrast/framework/base_support.rb', line 66

def streaming? _env
  false
end

.versionObject



14
15
16
# File 'lib/contrast/framework/base_support.rb', line 14

def version
  raise NoMethodError('Subclasses of BaseSupport should implement this method')
end