Class: Appsignal::Marker
- Inherits:
-
Object
- Object
- Appsignal::Marker
- Includes:
- CarefulLogger
- 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, config, logger) ⇒ Marker
constructor
A new instance of Marker.
- #transmit ⇒ Object
Methods included from CarefulLogger
Constructor Details
#initialize(marker_data, config, logger) ⇒ Marker
Returns a new instance of Marker.
10 11 12 13 14 |
# File 'lib/appsignal/marker.rb', line 10 def initialize(marker_data, config, logger) @marker_data = marker_data @config = config @logger = logger end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/appsignal/marker.rb', line 7 def config @config end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/appsignal/marker.rb', line 7 def logger @logger end |
#marker_data ⇒ Object (readonly)
Returns the value of attribute marker_data.
7 8 9 |
# File 'lib/appsignal/marker.rb', line 7 def marker_data @marker_data end |
Instance Method Details
#transmit ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/appsignal/marker.rb', line 16 def transmit begin transmitter = Transmitter.new(ACTION, config) logger.info("Notifying Appsignal of deploy with: revision: #{marker_data[:revision]}, user: #{marker_data[:user]}") 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 carefully_log_error( "Something went wrong while trying to notify Appsignal: #{e}" ) end end |