diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2022-02-02 22:41:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 22:41:57 +0000 |
commit | 31b554c2976612ce5fd983517615906261c39cea (patch) | |
tree | 7cc9f5f467b9b320b264428ba715e5d198a3c9cd /changelog.d | |
parent | Invalidate the get_users_in_room{_with_profile} caches only when necessary. (... (diff) | |
download | synapse-31b554c2976612ce5fd983517615906261c39cea.tar.xz |
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.
Diffstat (limited to 'changelog.d')
-rw-r--r-- | changelog.d/11869.misc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/changelog.d/11869.misc b/changelog.d/11869.misc new file mode 100644 index 0000000000..054fbf6101 --- /dev/null +++ b/changelog.d/11869.misc @@ -0,0 +1 @@ +Ensure that `opentracing` scopes are activated and closed at the right time. |