Sha256: dec17c056c15780785e29a14bbb1422a11e9f37ef0f6b5017023b2eccb07d52b

Contents?: true

Size: 845 Bytes

Versions: 12

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

module WCC::Contentful
  module Instrumentation
    extend ActiveSupport::Concern

    def _instrumentation_event_prefix
      @_instrumentation_event_prefix ||=
        # WCC::Contentful => contentful.wcc
        '.' + (is_a?(Class) || is_a?(Module) ? self : self.class)
          .name.parameterize.split('-').reverse.join('.')
    end

    included do
      protected

      def _instrument(name, payload = {}, &block)
        name += _instrumentation_event_prefix
        (@_instrumentation ||= WCC::Contentful::Services.instance.instrumentation)
          .instrument(name, payload, &block)
      end
    end

    class << self
      def instrument(name, payload = {}, &block)
        WCC::Contentful::Services.instance
          .instrumentation.instrument(name, payload, &block)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
wcc-contentful-1.0.8 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.7 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.6 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.5 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.4 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.3 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.2 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.1 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.0 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.0.pre.rc3 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.0.pre.rc2 lib/wcc/contentful/instrumentation.rb
wcc-contentful-1.0.0.pre.rc1 lib/wcc/contentful/instrumentation.rb