Sha256: 0b11f3b4ef195d86deee55f5031e0cfe70ab27ce04cbf9f98b951beed6f54936

Contents?: true

Size: 807 Bytes

Versions: 9

Compression:

Stored size: 807 Bytes

Contents

module Honeybadger
  module Util
    class Lambda
      AWS_ENV_MAP = {
        "_HANDLER" => "handler",
        "AWS_REGION" => "region",
        "AWS_EXECUTION_ENV" => "runtime",
        "AWS_LAMBDA_FUNCTION_NAME" => "function",
        "AWS_LAMBDA_FUNCTION_MEMORY_SIZE" => "memory",
        "AWS_LAMBDA_FUNCTION_VERSION" => "version",
        "AWS_LAMBDA_LOG_GROUP_NAME" => "log_group",
        "AWS_LAMBDA_LOG_STREAM_NAME" => "log_name"
      }.freeze

      class << self
        def lambda_execution?
          !!ENV["AWS_EXECUTION_ENV"]
        end

        def normalized_data
          AWS_ENV_MAP.each_with_object({}) do |(k, v), memo|
            memo[v] = ENV[k] if ENV[k]
          end
        end

        def trace_id
          ENV["_X_AMZN_TRACE_ID"]
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
honeybadger-4.7.2 lib/honeybadger/util/lambda.rb
honeybadger-4.7.1 lib/honeybadger/util/lambda.rb
honeybadger-4.7.0 lib/honeybadger/util/lambda.rb
honeybadger-4.6.0 lib/honeybadger/util/lambda.rb
honeybadger-4.5.6 lib/honeybadger/util/lambda.rb
honeybadger-4.5.5 lib/honeybadger/util/lambda.rb
honeybadger-4.5.4 lib/honeybadger/util/lambda.rb
honeybadger-4.5.3 lib/honeybadger/util/lambda.rb
honeybadger-4.5.2 lib/honeybadger/util/lambda.rb