From 7d339e8c7cff3a4fd718d4219fbb045ce269aa09 Mon Sep 17 00:00:00 2001 From: kohbis <18735471+kohbis@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:00:20 +0900 Subject: [PATCH 1/4] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20Sidekiq=20inst?= =?UTF-8?q?rumentation=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- instrumentation/sidekiq/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/instrumentation/sidekiq/README.md b/instrumentation/sidekiq/README.md index 461f9e717..dac4d2990 100644 --- a/instrumentation/sidekiq/README.md +++ b/instrumentation/sidekiq/README.md @@ -29,6 +29,27 @@ OpenTelemetry::SDK.configure do |c| c.use_all end ``` + +### Options + +If you wish to change any of the default behaviour, you can pass options during instrumentation setup: + +```ruby +OpenTelemetry::SDK.configure do |c| + c.use 'OpenTelemetry::Instrumentation::Sidekiq', span_naming: :job_class +end +``` + +|name|type|default|description| +|---|---|---|---| +|`span_naming`|symbol|`:quque`|Determines how spans are named| +|`propagation_style`|symbol|`:link`|Specify propagation style| +|`trace_launcher_heartbeat`|boolean|`false`|Allows tracing `Sidekiq::Launcher#heartbeat`| +|`trace_poller_enqueue`|boolean|`false`|Allows tracing `Sidekiq::Scheduled::Poller#enqueue`| +|`trace_poller_wait`|boolean|`false`|Allows tracing `Sidekiq::Scheduled::Poller#wait`| +|`trace_processor_process_one`|boolean|`false`|Allows tracing `Sidekiq::Processor#process_one`| +|`peer_service`|string|`nil`|Set name of the remote service| + ## Examples Example usage can be seen in the `./example/sidekiq.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/sidekiq/example/sidekiq.rb) From a0ad610190ad6905da3e8f810625af75ff097a34 Mon Sep 17 00:00:00 2001 From: kohbis <18735471+kohbis@users.noreply.github.com> Date: Thu, 18 Jan 2024 16:03:08 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Revert=20"docs:=20=E2=9C=8F=EF=B8=8F=20Side?= =?UTF-8?q?kiq=20instrumentation=20options"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 7d339e8c7cff3a4fd718d4219fbb045ce269aa09. --- instrumentation/sidekiq/README.md | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/instrumentation/sidekiq/README.md b/instrumentation/sidekiq/README.md index dac4d2990..461f9e717 100644 --- a/instrumentation/sidekiq/README.md +++ b/instrumentation/sidekiq/README.md @@ -29,27 +29,6 @@ OpenTelemetry::SDK.configure do |c| c.use_all end ``` - -### Options - -If you wish to change any of the default behaviour, you can pass options during instrumentation setup: - -```ruby -OpenTelemetry::SDK.configure do |c| - c.use 'OpenTelemetry::Instrumentation::Sidekiq', span_naming: :job_class -end -``` - -|name|type|default|description| -|---|---|---|---| -|`span_naming`|symbol|`:quque`|Determines how spans are named| -|`propagation_style`|symbol|`:link`|Specify propagation style| -|`trace_launcher_heartbeat`|boolean|`false`|Allows tracing `Sidekiq::Launcher#heartbeat`| -|`trace_poller_enqueue`|boolean|`false`|Allows tracing `Sidekiq::Scheduled::Poller#enqueue`| -|`trace_poller_wait`|boolean|`false`|Allows tracing `Sidekiq::Scheduled::Poller#wait`| -|`trace_processor_process_one`|boolean|`false`|Allows tracing `Sidekiq::Processor#process_one`| -|`peer_service`|string|`nil`|Set name of the remote service| - ## Examples Example usage can be seen in the `./example/sidekiq.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/sidekiq/example/sidekiq.rb) From a06d84e09d8d88e278f8dc2744a61bf998804dcb Mon Sep 17 00:00:00 2001 From: kohbis <18735471+kohbis@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:21:09 +0900 Subject: [PATCH 3/4] Generate rubydoc of sidekiq instrumentation options (simple) --- instrumentation/sidekiq/.yardopts | 1 + .../instrumentation/sidekiq/instrumentation.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/instrumentation/sidekiq/.yardopts b/instrumentation/sidekiq/.yardopts index 9f610acac..79e64ffc0 100644 --- a/instrumentation/sidekiq/.yardopts +++ b/instrumentation/sidekiq/.yardopts @@ -2,6 +2,7 @@ --title=OpenTelemetry Sidekiq Instrumentation --markup=markdown --main=README.md +--tag=instrumentation_option_default:"Default" ./lib/opentelemetry/instrumentation/**/*.rb ./lib/opentelemetry/instrumentation.rb - diff --git a/instrumentation/sidekiq/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb b/instrumentation/sidekiq/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb index b1ce910b4..d1da1102b 100644 --- a/instrumentation/sidekiq/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb +++ b/instrumentation/sidekiq/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb @@ -27,6 +27,11 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base gem_version >= MINIMUM_VERSION end + # @!group Instrumentation Options + # @!macro [attach] option + # @!method $1 + # @instrumentation_option_default `$2` + # @!scope class option :span_naming, default: :queue, validate: %I[job_class queue] option :propagation_style, default: :link, validate: %i[link child none] option :trace_launcher_heartbeat, default: false, validate: :boolean @@ -34,6 +39,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base option :trace_poller_wait, default: false, validate: :boolean option :trace_processor_process_one, default: false, validate: :boolean option :peer_service, default: nil, validate: :string + # @!endgroup private From c4c42cf9dce2549f104971b654d3c246f6f6acd8 Mon Sep 17 00:00:00 2001 From: kohbis <18735471+kohbis@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:33:12 +0900 Subject: [PATCH 4/4] Generate rubydoc of sidekiq instrumentation options (each macros) --- .../sidekiq/instrumentation.rb | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/instrumentation/sidekiq/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb b/instrumentation/sidekiq/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb index d1da1102b..5f374c0ca 100644 --- a/instrumentation/sidekiq/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb +++ b/instrumentation/sidekiq/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb @@ -28,16 +28,56 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base end # @!group Instrumentation Options - # @!macro [attach] option + # @!macro # @!method $1 - # @instrumentation_option_default `$2` + # @instrumentation_option_default `:$2` # @!scope class + # + # Specify how the span names are set. Can be one of: + # + # - `:queue` - the span names will be set to ' '. + # - `:job_class` - the span names will be set to ' '. option :span_naming, default: :queue, validate: %I[job_class queue] + # Controls how the job's execution is traced and related + # to the trace where the job was enqueued. Can be one of: + # + # - `:link` - the job will be executed in a separate trace. The + # initial span of the execution trace will be linked to the span that + # enqueued the job, via a Span Link. + # - `:child` - the job will be executed in the same logical trace, as a direct + # child of the span that enqueued the job. + # - `:none` - the job's execution will not be explicitly linked to the span that + # enqueued the job. option :propagation_style, default: :link, validate: %i[link child none] + # @!macro + # @!method $1 + # @instrumentation_option_default `:$2` + # @!scope class + # Allows tracing Sidekiq::Launcher#heartbeat. option :trace_launcher_heartbeat, default: false, validate: :boolean + # @!macro + # @!method $1 + # @instrumentation_option_default $2 + # @!scope class + # Allows tracing Sidekiq::Scheduled#enqueue. option :trace_poller_enqueue, default: false, validate: :boolean + # @!macro + # @!method $1 + # @instrumentation_option_default $2 + # @!scope class + # Allows trasing Sidekiq::Scheduled#wait option :trace_poller_wait, default: false, validate: :boolean + # @!macro + # @!method $1 + # @instrumentation_option_default $2 + # @!scope class + # Allows tracing Sidekiq::Processor#process_one. option :trace_processor_process_one, default: false, validate: :boolean + # @!macro + # @!method $1 + # @instrumentation_option_default $2 + # @!scope class + # Sets service name of the remote service. option :peer_service, default: nil, validate: :string # @!endgroup