Sha256: fe42b1009fc510953f62fc6af52d76d46c1b639838bb7b8fad1a7242970f59da

Contents?: true

Size: 1.32 KB

Versions: 208

Compression:

Stored size: 1.32 KB

Contents

shared_examples "activesupport finish_with_state override" do
  let(:instrumenter) { as.instrumenter }

  it "instruments an ActiveSupport::Notifications.start/finish event with payload on finish" do
    listeners_state = instrumenter.start("sql.active_record", {})
    instrumenter.finish_with_state(listeners_state, "sql.active_record", :sql => "SQL")

    expect(transaction.to_h["events"]).to match([
      {
        "allocation_count" => kind_of(Integer),
        "body" => "SQL",
        "body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
        "child_allocation_count" => kind_of(Integer),
        "child_duration" => kind_of(Float),
        "child_gc_duration" => kind_of(Float),
        "count" => 1,
        "duration" => kind_of(Float),
        "gc_duration" => kind_of(Float),
        "name" => "sql.active_record",
        "start" => kind_of(Float),
        "title" => ""
      }
    ])
  end

  it "does not instrument events whose name starts with a bang" do
    expect(Appsignal::Transaction.current).not_to receive(:start_event)
    expect(Appsignal::Transaction.current).not_to receive(:finish_event)

    listeners_state = instrumenter.start("!sql.active_record", {})
    instrumenter.finish_with_state(listeners_state, "!sql.active_record", :sql => "SQL")

    expect(transaction.to_h["events"]).to be_empty
  end
end

Version data entries

208 entries across 208 versions & 1 rubygems

Version Path
appsignal-3.0.19-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.19 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.18-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.18 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.17-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.17 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.16-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.16 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.15-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.15 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.14-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.14 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.13-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.13 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.12-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.12 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.11-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.11 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.10-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.0.10 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb