Sha256: 279050f90e06968c85c5e47caa8287ecb3beec08993eb8683431a72252ec85db

Contents?: true

Size: 814 Bytes

Versions: 55

Compression:

Stored size: 814 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_LAMBDA_FUNCTION_NAME"]
        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

55 entries across 55 versions & 1 rubygems

Version Path
honeybadger-5.26.2 lib/honeybadger/util/lambda.rb
honeybadger-5.26.1 lib/honeybadger/util/lambda.rb
honeybadger-5.26.0 lib/honeybadger/util/lambda.rb
honeybadger-5.25.0 lib/honeybadger/util/lambda.rb
honeybadger-5.24.0 lib/honeybadger/util/lambda.rb
honeybadger-5.23.0 lib/honeybadger/util/lambda.rb
honeybadger-5.22.0 lib/honeybadger/util/lambda.rb
honeybadger-5.21.0 lib/honeybadger/util/lambda.rb
honeybadger-5.20.1 lib/honeybadger/util/lambda.rb
honeybadger-5.20.0 lib/honeybadger/util/lambda.rb
honeybadger-5.19.2 lib/honeybadger/util/lambda.rb
honeybadger-5.19.1 lib/honeybadger/util/lambda.rb
honeybadger-5.19.0 lib/honeybadger/util/lambda.rb
honeybadger-5.18.0 lib/honeybadger/util/lambda.rb
honeybadger-5.17.0 lib/honeybadger/util/lambda.rb
honeybadger-5.16.0 lib/honeybadger/util/lambda.rb
honeybadger-5.15.6 lib/honeybadger/util/lambda.rb
honeybadger-5.15.5 lib/honeybadger/util/lambda.rb
honeybadger-5.15.4 lib/honeybadger/util/lambda.rb
honeybadger-5.15.3 lib/honeybadger/util/lambda.rb