Sha256: c7e89c5e7689e545bd49647730c0841164b70da14d9d3dfd9c0c83c573dfa804

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

require 'elastic_apm/context/request'
require 'elastic_apm/context/request/socket'
require 'elastic_apm/context/request/url'
require 'elastic_apm/context/response'
require 'elastic_apm/context/user'

module ElasticAPM
  # @api private
  class Context
    def initialize(custom: {}, labels: {}, user: nil)
      @custom = custom
      @labels = labels
      @user = user || User.new
    end

    attr_accessor :request
    attr_accessor :response
    attr_accessor :user
    attr_reader :custom
    attr_reader :labels

    def empty?
      return false if labels.any?
      return false if custom.any?
      return false if user.any?
      return false if request || response

      true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elastic-apm-3.0.0 lib/elastic_apm/context.rb
elastic-apm-2.12.0 lib/elastic_apm/context.rb