Sha256: 4b2b29ac09e81b8fe86a27e886fceb563bf1aef7a581d9420c55598391bee58c

Contents?: true

Size: 741 Bytes

Versions: 11

Compression:

Stored size: 741 Bytes

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

module NewRelic
  module ThreadLocalStorage
    def self.get(thread, key)
      if Agent.config[:thread_local_tracer_state]
        thread.thread_variable_get(key)
      else
        thread[key]
      end
    end

    def self.set(thread, key, value)
      if Agent.config[:thread_local_tracer_state]
        thread.thread_variable_set(key, value)
      else
        thread[key] = value
      end
    end

    def self.[](key)
      get(::Thread.current, key)
    end

    def self.[]=(key, value)
      set(::Thread.current, key, value)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
newrelic_rpm-9.16.0 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.15.0 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.14.0 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.13.0 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.12.0 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.11.0 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.10.2 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.10.1 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.10.0 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.9.0 lib/new_relic/thread_local_storage.rb
newrelic_rpm-9.8.0 lib/new_relic/thread_local_storage.rb