From 58dc464cda51181141e5e7a5b6c77556aefc59ad Mon Sep 17 00:00:00 2001 From: Ariel Valentin <arielvalentin@github.com> Date: Tue, 10 Oct 2023 21:30:36 -0500 Subject: [PATCH] fix: add examples of in-line instrumentation --- instrumentation/active_job/example/active_job.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/instrumentation/active_job/example/active_job.rb b/instrumentation/active_job/example/active_job.rb index d7f13e7fdb..9ac36ac572 100644 --- a/instrumentation/active_job/example/active_job.rb +++ b/instrumentation/active_job/example/active_job.rb @@ -71,6 +71,18 @@ def perform end class TestJob < ::ActiveJob::Base + around_enqueue do |_job, block| + OpenTelemetry.tracer_provider.tracer('demo', '1.0').in_span('around_enqueue') do + block.call + end + end + + around_perform do |_job, block| + OpenTelemetry.tracer_provider.tracer("demo", 1.0).in_span("around_perform") do + block.call + end + end + def perform puts <<~EOS