Skip to content

Commit

Permalink
feat: pass context in options["trace_ctx"] instead of options
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-natan committed Apr 27, 2022
1 parent fc79f80 commit 8eab917
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, _tracer):
self._span_registry = {}

def before_process_message(self, _broker, message):
trace_ctx = extract(message.options) # FIXME: extract/inject in message.option["trace_ctx"]
trace_ctx = extract(message.options["trace_ctx"])
operation_name = "remoulade/process"

span = self._tracer.start_span(operation_name, kind=trace.SpanKind.CONSUMER, context=trace_ctx)
Expand Down Expand Up @@ -69,7 +69,9 @@ def before_enqueue(self, _broker, message, delay):

utils.attach_span(self._span_registry, message.message_id, (span, activation), is_publish=True)

inject(message.options) # FIXME: extract/inject in message.option["trace_ctx"]
if "trace_ctx" not in message.options:
message.options["trace_ctx"] = {}
inject(message.options["trace_ctx"])

def after_enqueue(self, _broker, message, delay, exception=None):
_, activation = utils.retrieve_span(self._span_registry, message.message_id, is_publish=True)
Expand Down

0 comments on commit 8eab917

Please sign in to comment.