Class: Appsignal::Marker
- Inherits:
-
Object
- Object
- Appsignal::Marker
- Defined in:
- lib/appsignal/marker.rb
Constant Summary collapse
- ACTION =
'markers'
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#marker_data ⇒ Object
readonly
Returns the value of attribute marker_data.
Instance Method Summary collapse
-
#initialize(marker_data, root_path, rails_env, logger) ⇒ Marker
constructor
A new instance of Marker.
- #transmit ⇒ Object
Constructor Details
#initialize(marker_data, root_path, rails_env, logger) ⇒ Marker
Returns a new instance of Marker.
6 7 8 9 10 |
# File 'lib/appsignal/marker.rb', line 6 def initialize(marker_data, root_path, rails_env, logger) @marker_data = marker_data @config = Appsignal::Config.new(root_path, rails_env, logger).load @logger = logger end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/appsignal/marker.rb', line 3 def config @config end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/appsignal/marker.rb', line 3 def logger @logger end |
#marker_data ⇒ Object (readonly)
Returns the value of attribute marker_data.
3 4 5 |
# File 'lib/appsignal/marker.rb', line 3 def marker_data @marker_data end |
Instance Method Details
#transmit ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/appsignal/marker.rb', line 12 def transmit begin transmitter = Transmitter.new( @config[:endpoint], ACTION, @config[:api_key] ) @logger.info "Notifying Appsignal of deploy..." result = transmitter.transmit(marker_data) if result == '200' @logger.info "Appsignal has been notified of this deploy!" else raise "#{result} at #{transmitter.uri}" end rescue Exception => e = "Something went wrong while trying to notify Appsignal: #{e}" if @logger.respond_to?(:important) # This is a Capistrano logger @logger.important else @logger.error end end end |