I am trying to trace the execution of a task in Celery through the Publisher -> Queue -> Consumer lifecycle. I am using OpenTelemetry 1.16.0 in Python 3.9.15 in order to instrument the application. I already know how to propagate a trace through the Queue as described in the answers to this stackoverflow question.
OpenTelemetry Python - How to instanciate a new span as a child span for a given trace_id
In addition to propagating the trace through the Queue I want to create a span in the trace for the time spent on the Queue. Right now, that period of time just appears as a gap in the trace as viewed in Grafana Tempo. I should be able to manually create this span assuming that I have trace id, parent span id, timestamp for when task is added to Queue, and timestamp for when task is taken from Queue.