Skip to content

Resque::Job instrumentation never flushing to OTLP when using BatchSpanProcessor #950

Answered by tlubz
tlubz asked this question in Q&A
Discussion options

You must be logged in to vote

Have you tried adding an at_exit handler and shutting down the SDK?

I see what you are saying. This workaround seems to get span batching to work as intended with forking resque workers:

at_exit do
  OpenTelemetry.tracer_provider.shutdown
end

worker = Resque::Worker.new('example')
worker.run_at_exit_hooks = true
worker.work_one_job

note the necessity of telling the worker to actually run at_exit hooks (also configurable as an env var RUN_AT_EXIT_HOOKS=true), as the default is to skip them with exit!

is putting OpenTelemetry.tracer_provider.shutdown in an at_exit hook best practice across opentelemetry-ruby instrumentation, or is this a special case workaround?

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tlubz
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working
2 participants
Converted from issue

This discussion was converted from issue #942 on April 27, 2024 15:42.