Module: Appsignal::Aggregator::Middleware

Defined in:
lib/appsignal/aggregator/middleware/chain.rb,
lib/appsignal/aggregator/middleware/delete_blanks.rb,
lib/appsignal/aggregator/middleware/action_view_sanitizer.rb,
lib/appsignal/aggregator/middleware/active_record_sanitizer.rb

Overview

Middleware is code configured to run before/after a message is processed. It is patterned after Rack middleware.

Examples:

To add middleware:


Appsignal.post_processing_middleware do |chain|
  chain.add MyPostProcessingHook
end

To insert immediately preceding another entry:


Appsignal.post_process_middleware do |chain|
  chain.insert_before ActiveRecord, MyPostProcessingHook
end

To insert immediately after another entry:


Appsignal.post_process_middleware do |chain|
  chain.insert_after ActiveRecord, MyPostProcessingHook
end

This is an example of a minimal middleware class:


class MySHook
  def call(transaction)
    puts "Before post processing"
    yield
    puts "After post processing"
  end
end

Defined Under Namespace

Classes: ActionViewSanitizer, ActiveRecordSanitizer, Chain, DeleteBlanks, Entry