Sha256: 026df3239f79b5a1d89b04c8a2f5126f1607404fc56f89e38930433b127850e5

Contents?: true

Size: 963 Bytes

Versions: 13

Compression:

Stored size: 963 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

13 entries across 13 versions & 1 rubygems

Version Path
appsignal-0.6.7 lib/appsignal/marker.rb
appsignal-0.6.6 lib/appsignal/marker.rb
appsignal-0.6.5 lib/appsignal/marker.rb
appsignal-0.6.4 lib/appsignal/marker.rb
appsignal-0.6.3 lib/appsignal/marker.rb
appsignal-0.6.3.beta.3 lib/appsignal/marker.rb
appsignal-0.6.3.beta.2 lib/appsignal/marker.rb
appsignal-0.6.3.beta.1 lib/appsignal/marker.rb
appsignal-0.6.2 lib/appsignal/marker.rb
appsignal-0.6.1 lib/appsignal/marker.rb
appsignal-0.6.0.beta.2 lib/appsignal/marker.rb
appsignal-0.6.0.beta.1 lib/appsignal/marker.rb
appsignal-0.5.5 lib/appsignal/marker.rb