Link span of queue item to trigger event span

This change links the span of the queue item to the span of the
forwarded trigger event.

This adds a currently empty span context field to trigger events which
will be later populated by the drivers.

We also need to add add a span context field to
`ChangeManagementEvent`s, as some drivers add dequeue events to the
pipeline event queues directly.

Change-Id: Icd240712b86cc22e55fb67f6787a0974d5308043
This commit is contained in:
Simon Westphahl
2022-09-23 09:37:56 +02:00
parent 7d3b186b3d
commit aa30ed7b5c
3 changed files with 31 additions and 2 deletions

View File

@@ -584,8 +584,14 @@ class PipelineManager(metaclass=ABCMeta):
(change, change_queue, self.pipeline))
if enqueue_time is None:
enqueue_time = time.time()
event_span = tracing.restoreSpanContext(event.span_context)
link_attributes = {"rel": type(event).__name__}
link = trace.Link(event_span.get_span_context(),
attributes=link_attributes)
span_info = tracing.startSavedSpan(
'QueueItem', start_time=enqueue_time)
'QueueItem', start_time=enqueue_time, links=[link])
item = change_queue.enqueueChange(change, event,
span_info=span_info,
enqueue_time=enqueue_time)