Sha256: 0e13390d7b0288858b1ca07d0c741a97d58f77441651662edf7ded3fdb8b9217

Contents?: true

Size: 482 Bytes

Versions: 12

Compression:

Stored size: 482 Bytes

Contents

module PlainApm
  module Helpers
    def plain_apm_context(context = {})
      PlainApm::Extensions::Context.context.merge!(context)
    end

    def plain_apm_instrument(name, context = {}, &block)
      sanitized_name = name.gsub(/\W/, "_").gsub(/(?!^)([A-Z])/) { |m| "_#{m}" }.squeeze("_").downcase
      return unless defined?(ActiveSupport::Notifications)
      ActiveSupport::Notifications.instrument("#{sanitized_name}.manual_plain_apm", **context, &block)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
plain_apm-0.9.2 lib/plain_apm/helpers.rb
plain_apm-0.9.1 lib/plain_apm/helpers.rb
plain_apm-0.9.0 lib/plain_apm/helpers.rb
plain_apm-0.8.8 lib/plain_apm/helpers.rb
plain_apm-0.8.7 lib/plain_apm/helpers.rb
plain_apm-0.8.6 lib/plain_apm/helpers.rb
plain_apm-0.8.5 lib/plain_apm/helpers.rb
plain_apm-0.8.4 lib/plain_apm/helpers.rb
plain_apm-0.8.3 lib/plain_apm/helpers.rb
plain_apm-0.8.2 lib/plain_apm/helpers.rb
plain_apm-0.8.1 lib/plain_apm/helpers.rb
plain_apm-0.8.0 lib/plain_apm/helpers.rb