Commit 5294ab72 authored by Igor's avatar Igor
Browse files

rename some bits

parent 6b5b3d21
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@ module Labkit
          subscriber = new

          subscriptions = [
            ActiveSupport::Notifications.subscribe(RENDER_TEMPLATE_NOTIFICATION_TOPIC, ActionViewRenderTemplateSubscriber.new),
            ActiveSupport::Notifications.subscribe(RENDER_COLLECTION_NOTIFICATION_TOPIC, ActionViewRenderCollectionSubscriber.new),
            ActiveSupport::Notifications.subscribe(RENDER_PARTIAL_NOTIFICATION_TOPIC, ActionViewRenderPartialSubscriber.new),
            ActiveSupport::Notifications.subscribe(RENDER_TEMPLATE_NOTIFICATION_TOPIC, RenderTemplateSubscriber.new),
            ActiveSupport::Notifications.subscribe(RENDER_COLLECTION_NOTIFICATION_TOPIC, RenderCollectionSubscriber.new),
            ActiveSupport::Notifications.subscribe(RENDER_PARTIAL_NOTIFICATION_TOPIC, RenderPartialSubscriber.new),
          ]

          create_unsubscriber subscriptions
@@ -29,7 +29,7 @@ module Labkit

        # For more information on the payloads: https://guides.rubyonrails.org/active_support_instrumentation.html

        class ActionViewRenderTemplateSubscriber < AbstractSubscriber
        class RenderTemplateSubscriber < AbstractSubscriber
          def span_name(payload)
            "render_template"
          end
@@ -39,7 +39,7 @@ module Labkit
          end
        end

        class ActionViewRenderCollectionSubscriber < AbstractSubscriber
        class RenderCollectionSubscriber < AbstractSubscriber
          def span_name(payload)
            "render_collection"
          end
@@ -54,7 +54,7 @@ module Labkit
          end
        end

        class ActionViewRenderPartialSubscriber < AbstractSubscriber
        class RenderPartialSubscriber < AbstractSubscriber
          def span_name(payload)
            "render_partial"
          end
+2 −2
Original line number Diff line number Diff line
@@ -17,14 +17,14 @@ module Labkit
        def self.instrument
          subscriber = new

          subscription = ActiveSupport::Notifications.subscribe(ACTIVE_RECORD_NOTIFICATION_TOPIC, ActiveRecordSqlSubscriber.new)
          subscription = ActiveSupport::Notifications.subscribe(ACTIVE_RECORD_NOTIFICATION_TOPIC, SqlSubscriber.new)

          create_unsubscriber [subscription]
        end

        # For more information on the payloads: https://guides.rubyonrails.org/active_support_instrumentation.html

        class ActiveRecordSqlSubscriber < AbstractSubscriber
        class SqlSubscriber < AbstractSubscriber
          def span_name(payload)
            OPERATION_NAME_PREFIX + (payload[:name].presence || DEFAULT_OPERATION_NAME)
          end
+10 −10
Original line number Diff line number Diff line
@@ -22,11 +22,11 @@ module Labkit
          subscriber = new

          subscriptions = [
            ActiveSupportCacheReadSubscriber.new,
            ActiveSupportCacheGenerateSubscriber.new,
            ActiveSupportCacheFetchHitSubscriber.new,
            ActiveSupportCacheWriteSubscriber.new,
            ActiveSupportCacheDeleteSubscriber.new,
            CacheReadSubscriber.new,
            CacheGenerateSubscriber.new,
            CacheFetchHitSubscriber.new,
            CacheWriteSubscriber.new,
            CacheDeleteSubscriber.new,
          ]

          create_unsubscriber subscriptions
@@ -34,7 +34,7 @@ module Labkit

        # For more information on the payloads: https://guides.rubyonrails.org/active_support_instrumentation.html#active-support

        class ActiveSupportCacheReadSubscriber < AbstractSubscriber
        class CacheReadSubscriber < AbstractSubscriber
          def span_name(payload)
            "cache_read"
          end
@@ -49,7 +49,7 @@ module Labkit
          end
        end

        class ActiveSupportCacheGenerateSubscriber < AbstractSubscriber
        class CacheGenerateSubscriber < AbstractSubscriber
          def span_name(payload)
            "cache_generate"
          end
@@ -59,7 +59,7 @@ module Labkit
          end
        end

        class ActiveSupportCacheFetchHitSubscriber < AbstractSubscriber
        class CacheFetchHitSubscriber < AbstractSubscriber
          def span_name(payload)
            "cache_fetch_hit"
          end
@@ -69,7 +69,7 @@ module Labkit
          end
        end

        class ActiveSupportCacheWriteSubscriber < AbstractSubscriber
        class CacheWriteSubscriber < AbstractSubscriber
          def span_name(payload)
            "cache_write"
          end
@@ -79,7 +79,7 @@ module Labkit
          end
        end

        class ActiveSupportCacheDeleteSubscriber < AbstractSubscriber
        class CacheDeleteSubscriber < AbstractSubscriber
          def span_name(payload)
            "cache_delete"
          end
+2 −2
Original line number Diff line number Diff line
@@ -14,12 +14,12 @@ module Labkit
          def start(name, id, payload)
            scope = OpenTracing.start_active_span(span_name(payload))

            stack = Thread.current[:_labkit_span_stack] ||= []
            stack = Thread.current[:_labkit_trace_scope_stack] ||= []
            stack.push scope
          end

          def finish(name, id, payload)
            stack = Thread.current[:_labkit_span_stack]
            stack = Thread.current[:_labkit_trace_scope_stack]
            scope = stack.pop
            span = scope.span