Sha256: eb455e8ee0fd8f591385bf604f104b6f0e44d9d8197cffb95e9ae06f3dd3daba

Contents?: true

Size: 961 Bytes

Versions: 4

Compression:

Stored size: 961 Bytes

Contents

require 'appsignal/careful_logger'

module Appsignal
  class Marker
    include Appsignal::CarefulLogger

    attr_reader :marker_data, :config, :logger
    ACTION = 'markers'

    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

    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
        message = "Something went wrong while trying to notify Appsignal: #{e}"
        carefully_log_error message
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
appsignal-0.5.3 lib/appsignal/marker.rb
appsignal-0.5.1 lib/appsignal/marker.rb
appsignal-0.5.0 lib/appsignal/marker.rb
appsignal-0.4.7 lib/appsignal/marker.rb