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.4.0 lib/honeybadger/util/lambda.rb
honeybadger-5.3.0 lib/honeybadger/util/lambda.rb
honeybadger-5.2.1 lib/honeybadger/util/lambda.rb
honeybadger-5.0.2 lib/honeybadger/util/lambda.rb
honeybadger-5.0.1 lib/honeybadger/util/lambda.rb
honeybadger-5.0.0 lib/honeybadger/util/lambda.rb
honeybadger-5.0.0.beta1 lib/honeybadger/util/lambda.rb
honeybadger-4.12.2 lib/honeybadger/util/lambda.rb
honeybadger-4.12.1 lib/honeybadger/util/lambda.rb
honeybadger-4.12.0 lib/honeybadger/util/lambda.rb
honeybadger-4.11.0 lib/honeybadger/util/lambda.rb
honeybadger-4.10.0 lib/honeybadger/util/lambda.rb
honeybadger-4.9.0 lib/honeybadger/util/lambda.rb
honeybadger-4.8.0 lib/honeybadger/util/lambda.rb
honeybadger-4.7.3 lib/honeybadger/util/lambda.rb