synapse-product/synapse/logging
Richard van der Hoff 31b554c297
Fixes for opentracing scopes (#11869)
`start_active_span` was inconsistent as to whether it would activate the span
immediately, or wait for `scope.__enter__` to happen (it depended on whether
the current logcontext already had an associated scope). The inconsistency was
rather confusing if you were hoping to set up a couple of separate spans before
activating either.

Looking at the other implementations of opentracing `ScopeManager`s, the
intention is that it *should* be activated immediately, as the name
implies. Indeed, the idea is that you don't have to use the scope as a
contextmanager at all - you can just call `.close` on the result. Hence, our
cleanup has to happen in `.close` rather than `.__exit__`.

So, the main change here is to ensure that `start_active_span` does activate
the span, and that `scope.close()` does close the scope.

We also add some tests, which requires a `tracer` param so that we don't have
to rely on the global variable in unit tests.
2022-02-02 22:41:57 +00:00
..
__init__.py Add debug logging for issue #9533 (#9959) 2021-05-11 11:04:03 +01:00
_remote.py Use auto_attribs/native type hints for attrs classes. (#11692) 2022-01-13 13:49:28 +00:00
_structured.py Use inline type hints in various other places (in synapse/) (#10380) 2021-07-15 11:02:43 +01:00
_terse_json.py Include exception in json logging (#11028) 2021-10-08 13:08:25 +02:00
context.py Use auto_attribs/native type hints for attrs classes. (#11692) 2022-01-13 13:49:28 +00:00
filter.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
formatter.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
handlers.py Add missing type hints to synapse.app. (#11287) 2021-11-10 15:06:54 -05:00
opentracing.py Fixes for opentracing scopes (#11869) 2022-02-02 22:41:57 +00:00
scopecontextmanager.py Fixes for opentracing scopes (#11869) 2022-02-02 22:41:57 +00:00