Module: Contrast::Framework::BaseSupport

Included in:
Grape::Support, Rack::Support, Rails::Support, Sinatra::Support
Defined in:
lib/contrast/framework/base_support.rb

Overview

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

Instance Method Summary collapse

Instance 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:



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

def after_load_patches; end

#application_nameObject

Raises:

  • (NoMethodError)

    raises error if subclass does not implement this method



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

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.



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

def before_load_patches!; end

#collect_routesArray<Contrast::Agent::Reporting::DiscoveredRoute>

Find all the predefined routes for this application

Returns:

Raises:

  • (NoMethodError)

    raises error if subclass does not implement this method



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

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

#current_route_coverageObject

Raises:

  • (NoMethodError)

    raises error if subclass does not implement this method



40
41
42
# File 'lib/contrast/framework/base_support.rb', line 40

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

#detection_classObject

The top level module name used by the framework

Raises:

  • (NoMethodError)

    raises error if subclass does not implement this method



12
13
14
# File 'lib/contrast/framework/base_support.rb', line 12

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

#retrieve_request(_env) ⇒ Object

Raises:

  • (NoMethodError)

    raises error if subclass does not implement this method



45
46
47
# File 'lib/contrast/framework/base_support.rb', line 45

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

#server_typeObject

Raises:

  • (NoMethodError)

    raises error if subclass does not implement this method



27
28
29
# File 'lib/contrast/framework/base_support.rb', line 27

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)


73
74
75
# File 'lib/contrast/framework/base_support.rb', line 73

def streaming? _env
  false
end

#versionObject

Raises:

  • (NoMethodError)

    raises error if subclass does not implement this method



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

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