Loading lib/labkit/tracing/rails/action_view_subscriber.rb +6 −6 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -39,7 +39,7 @@ module Labkit end end class ActionViewRenderCollectionSubscriber < AbstractSubscriber class RenderCollectionSubscriber < AbstractSubscriber def span_name(payload) "render_collection" end Loading @@ -54,7 +54,7 @@ module Labkit end end class ActionViewRenderPartialSubscriber < AbstractSubscriber class RenderPartialSubscriber < AbstractSubscriber def span_name(payload) "render_partial" end Loading lib/labkit/tracing/rails/active_record_subscriber.rb +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading lib/labkit/tracing/rails/active_support_subscriber.rb +10 −10 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -49,7 +49,7 @@ module Labkit end end class ActiveSupportCacheGenerateSubscriber < AbstractSubscriber class CacheGenerateSubscriber < AbstractSubscriber def span_name(payload) "cache_generate" end Loading @@ -59,7 +59,7 @@ module Labkit end end class ActiveSupportCacheFetchHitSubscriber < AbstractSubscriber class CacheFetchHitSubscriber < AbstractSubscriber def span_name(payload) "cache_fetch_hit" end Loading @@ -69,7 +69,7 @@ module Labkit end end class ActiveSupportCacheWriteSubscriber < AbstractSubscriber class CacheWriteSubscriber < AbstractSubscriber def span_name(payload) "cache_write" end Loading @@ -79,7 +79,7 @@ module Labkit end end class ActiveSupportCacheDeleteSubscriber < AbstractSubscriber class CacheDeleteSubscriber < AbstractSubscriber def span_name(payload) "cache_delete" end Loading lib/labkit/tracing/rails/rails_common.rb +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
lib/labkit/tracing/rails/action_view_subscriber.rb +6 −6 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -39,7 +39,7 @@ module Labkit end end class ActionViewRenderCollectionSubscriber < AbstractSubscriber class RenderCollectionSubscriber < AbstractSubscriber def span_name(payload) "render_collection" end Loading @@ -54,7 +54,7 @@ module Labkit end end class ActionViewRenderPartialSubscriber < AbstractSubscriber class RenderPartialSubscriber < AbstractSubscriber def span_name(payload) "render_partial" end Loading
lib/labkit/tracing/rails/active_record_subscriber.rb +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading
lib/labkit/tracing/rails/active_support_subscriber.rb +10 −10 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -49,7 +49,7 @@ module Labkit end end class ActiveSupportCacheGenerateSubscriber < AbstractSubscriber class CacheGenerateSubscriber < AbstractSubscriber def span_name(payload) "cache_generate" end Loading @@ -59,7 +59,7 @@ module Labkit end end class ActiveSupportCacheFetchHitSubscriber < AbstractSubscriber class CacheFetchHitSubscriber < AbstractSubscriber def span_name(payload) "cache_fetch_hit" end Loading @@ -69,7 +69,7 @@ module Labkit end end class ActiveSupportCacheWriteSubscriber < AbstractSubscriber class CacheWriteSubscriber < AbstractSubscriber def span_name(payload) "cache_write" end Loading @@ -79,7 +79,7 @@ module Labkit end end class ActiveSupportCacheDeleteSubscriber < AbstractSubscriber class CacheDeleteSubscriber < AbstractSubscriber def span_name(payload) "cache_delete" end Loading
lib/labkit/tracing/rails/rails_common.rb +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading