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.9.2-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.9.2 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.9.1-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.9.1 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.9.0-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.9.0 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.8.1-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.8.1 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.8.0-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.8.0 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.7.6-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.7.6 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.7.2-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.7.2 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.7.1-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.7.1 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.7.0-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.7.0 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.6.5-java spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
appsignal-3.6.5 spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb