Class: MetOnTheMiddle::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/met_on_the_middle/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



32
33
34
35
36
37
38
39
40
41
# File 'lib/met_on_the_middle/configuration.rb', line 32

def initialize
  @notifications_event_matcher = /.*/
  @event_mode= :sleep
  @tracker = nil
  @logger = Rails.logger
  @sender = Senders::FileSystem.new(Rails.root.join('log/met_on_the_middle.log'))
  @flush_interval = 60
  @mounting_enviroments = [:production]
  self.readers = [:RequestCount, :TotalTime, :DatabaseTime, :ViewTime]
end

Instance Attribute Details

#event_modeObject

type of timer to use, valid options are :sleep (default), :eventmachine, or :synchrony



10
11
12
# File 'lib/met_on_the_middle/configuration.rb', line 10

def event_mode
  @event_mode
end

#flush_intervalObject

Tempo in secondi ogni quanto eseguire un flush dei dati



14
15
16
# File 'lib/met_on_the_middle/configuration.rb', line 14

def flush_interval
  @flush_interval
end

#loggerObject

Returns the value of attribute logger.



27
28
29
# File 'lib/met_on_the_middle/configuration.rb', line 27

def logger
  @logger
end

#mounting_enviromentsObject

Enviroments dove installare il middleware default a sola produzione



19
20
21
# File 'lib/met_on_the_middle/configuration.rb', line 19

def mounting_enviroments
  @mounting_enviroments
end

#notifications_event_matcherObject

Regular expression per selezionare l’event matcher



6
7
8
# File 'lib/met_on_the_middle/configuration.rb', line 6

def notifications_event_matcher
  @notifications_event_matcher
end

#senderObject

Definisce la classe da utilizzare per spedire/registrazione le informazioni Default a MetOnTheMiddle::Senders::FileSystem configurato per scrivere in un file dentro alla cartella log dell’applicativo Rails



25
26
27
# File 'lib/met_on_the_middle/configuration.rb', line 25

def sender
  @sender
end

#trackerObject (readonly)

Returns the value of attribute tracker.



30
31
32
# File 'lib/met_on_the_middle/configuration.rb', line 30

def tracker
  @tracker
end

Instance Method Details

#dumpObject



44
45
46
47
48
49
50
51
# File 'lib/met_on_the_middle/configuration.rb', line 44

def dump

  {
      notifications_event_matcher: :notifications_event_matcher,
      event_mode: :event_mode
  }

end

#readersObject



64
65
66
# File 'lib/met_on_the_middle/configuration.rb', line 64

def readers
  @_readers
end

#readers=(array) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/met_on_the_middle/configuration.rb', line 54

def readers=(array)
  @_readers = array.collect {|c|
    if c.is_a?(Symbol)
      Readers.const_get(c)
    else
      c
    end
  }
end