Skip to content

Sidekiq integration can't be combined with other integrations #535

Description

@kevinnio

Hi. I'm new to opentelemetry-ruby so I may be missing something. I tried to make this work for a while, I looked around in the repo's issues, everything to no avail so now I'm asking here.

Whenever I include the sidekiq instrumentation in my configure block inside my rails app spans from other instrumentations are no longer generated, or at least not visible in the console anymore.

Let's ilustrate the issue by starting with only PG:

OpenTelemetry::SDK.configure do |c|
  c.service_name = 'MyApp'
  c.use 'OpenTelemetry::Instrumentation::PG'
end

OTEL_TRACES_EXPORTER is set to console.

# app/models/my_model.rb
class MyModel < ApplicationModel
end

# app/jobs/my_job.rb
class MyJob 
  include Sidekiq::Job
  
  def perform
    MyModel.find_or_create_by!(id: 1)
  end
end

# in a rails console
MyJob.perform_async

Let's say I boot up sidekiq. As expected, I can see a bunch of PG traces in the console.

Now, let's add the Sidekiq:

OpenTelemetry::SDK.configure do |c|
  c.service_name = 'MyApp'
  c.use 'OpenTelemetry::Instrumentation::PG'
  c.use 'OpenTelemetry::Instrumentation::Sidekiq'
end

Restart sidekiq and run the same job again. Now, only one single Sidekiq trace is visible in the console. The PG ones are missing. I expected to see one parent Sidekiq span and a bunch of PG child ones.

I tried with multiple instrumentations, not only PG. So far, this always happens.

I created an example app so you can replicate the issue: https://github.com/kevinnio/opentel-test. Please let me know if you need additional info.

bundle info:

* opentelemetry-sdk (1.2.1)
* opentelemetry-exporter-otlp (0.25.0)
* opentelemetry-instrumentation-pg (0.25.2)
* opentelemetry-instrumentation-sidekiq (0.24.1)
* rails (7.0.6)
* sidekiq (7.1.2)
* pg (1.5.3)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarks an issue/PR stale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions