opentracing-python-instrumentation icon indicating copy to clipboard operation
opentracing-python-instrumentation copied to clipboard

Should span_in_stack_context be throwing exceptions?

Open yurishkuro opened this issue 5 years ago • 0 comments

@Jamim I'm interested in your thoughts. One of our users complained about getting this error:

# .../python2/local/lib/python2.7/site-packages/opentracing_instrumentation/client_hooks/boto3.pyc in perform_call(self, original_func, kind, service_name, operation_name, *args, **kwargs)
    135         span.set_tag('boto3.service_name', service_name)
    136 
--> 137         with span, span_in_stack_context(span):
    138             try:
    139                 response = original_func(*args, **kwargs)

# .../python2/local/lib/python2.7/site-packages/opentracing_instrumentation/request_context.pyc in span_in_stack_context(span)
    210 
    211     if not isinstance(opentracing.tracer.scope_manager, TornadoScopeManager):
--> 212         raise RuntimeError('scope_manager is not TornadoScopeManager')
    213 
    214     # Enter the newly created stack context so we have

They were running Jupyter notebook and trying to upload data using boto client. The notebook runs inside managed workspace for notebooks, which (apparently) enables Jaeger for all sessions automatically, but since they are not Tornado-based apps, it does not enable TornadoScopeManager.

it appears that boto instrumentation is just not usable wit non-tornado code. Would it make more sense for span_in_stack_context to fallback onto span_in_context when not in the tornado environment?

yurishkuro avatar Mar 31 '20 18:03 yurishkuro