Module: App47AppAnalyzable

Extended by:
ActiveSupport::Concern
Included in:
B2bApp, InternalApp, ProductApp, WebApp
Defined in:
lib/models/concerns/app47_app_analyzable.rb

Overview

Apps that are analyazble, i.e., they have an agent associated with them. For now, web apps and internal apps have these properties.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Add fields, relationships and callbacks



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/models/concerns/app47_app_analyzable.rb', line 13

def self.included(base)
  base.class_eval do
    #
    # Fields
    #
    field :usage_ranking, type: Integer, default: 0
    field :analyzable, type: Mongoid::Boolean, default: true
    field :agent_count, type: Integer, default: 0
    field :agent_log_level, type: String, default: 'Info'
    field :agent_capture_timed_events, type: Mongoid::Boolean, default: true
    field :agent_capture_generic_events, type: Mongoid::Boolean, default: true
    field :agent_capture_sessions, type: Mongoid::Boolean, default: true
    field :agent_enabled, type: Mongoid::Boolean, default: true
    field :agent_upload_on_exit, type: Mongoid::Boolean, default: true
    field :agent_capture_crash_format, type: String, default: 'none'
    field :agent_delay_data_upload_interval, type: Integer, default: 1
    field :agent_configuration_update_frequency, type: Float, default: 1
    field :agent_session_threshold_seconds, type: Integer, default: 5
    #
    # Relationships
    #
    has_many :agents, dependent: :destroy, inverse_of: :app

    #
    # Is the api enabled for this app?
    #
    def api_enabled?
      agent_enabled? && .api_enabled?
    rescue StandardError
      false
    end
  end
end