Sha256: 0ecf46ea0922ccb04ba286f0e1367373732848232814ae085d873aaa09433a44

Contents?: true

Size: 1.13 KB

Versions: 19

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

# This test is based on the example code at:
# https://docs.newrelic.com/docs/ruby/ruby-custom-metric-collection#example_class
# 
# See https://newrelic.atlassian.net/browse/RUBY-1116 for details on how this
# was broken previously.

require 'new_relic/agent/method_tracer' 

class StandaloneInstrumentationTest < Minitest::Test
  class InstrumentedClass
    def instance_method(*args)
      args
    end

    def self.class_method(*args)
      args
    end

    include NewRelic::Agent::MethodTracer
    add_method_tracer :instance_method

    class << self
      include ::NewRelic::Agent::MethodTracer
      add_method_tracer :class_method
    end
  end

  def test_instance_method_tracers_should_not_cause_errors
    args = [1, 2, 3]
    result = InstrumentedClass.new.instance_method(*args)
    assert_equal(args, result)
  end

  def test_class_method_tracer_should_not_cause_errors
    args = [1, 2, 3]
    result = InstrumentedClass.class_method(*args)
    assert_equal(args, result)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
newrelic_rpm-3.12.0.288 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.11.2.286 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.11.1.284 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.11.0.283 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.10.0.279 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.9.275 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.8.273 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.7.266 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.6.257 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.5.251 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.4.245 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.3.241 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.2.239 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.1.236 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.9.0.229 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.8.1.221 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.8.0.218 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.7.3.204 test/multiverse/suites/bare/standalone_instrumentation_test.rb
newrelic_rpm-3.7.3.199 test/multiverse/suites/bare/standalone_instrumentation_test.rb