Skip to content

Commit

Permalink
diasble context exctration for message post endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
abdollahis2 authored and abdollahis2 committed Jul 8, 2024
1 parent d2ef020 commit e96bd52
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tr_sys/tr_ars/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,15 @@ def message(req, key):
return HttpResponse('Unknown message: %s' % key, status=404)

elif req.method == 'POST':
headers = dict(req.headers)
if 'Traceparent' in headers.keys():
logging.info('traceparent for mesg pk: %s is %s'% (str(key),headers['Traceparent']))
else:
logging.info('there is not Traceparent for mesg pk: %s'% (str(key)))
carrier ={'traceparent': headers['Traceparent']}
ctx = TraceContextTextMapPropagator().extract(carrier=carrier)
with tracer.start_as_current_span('message', context=ctx) as span:
# headers = dict(req.headers)
# if 'Traceparent' in headers.keys():
# logging.info('traceparent for mesg pk: %s is %s'% (str(key),headers['Traceparent']))
# else:
# logging.info('there is not Traceparent for mesg pk: %s'% (str(key)))
# carrier ={'traceparent': headers['Traceparent']}
# ctx = TraceContextTextMapPropagator().extract(carrier=carrier)
# with tracer.start_as_current_span('message', context=ctx) as span:
with tracer.start_as_current_span('message') as span:
span.set_attribute("pk", str(key))
try:
data = json.loads(req.body)
Expand Down

0 comments on commit e96bd52

Please sign in to comment.