summary refs log tree commit diff
path: root/changelog.d
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2021-10-12 11:23:46 +0100
committerGitHub <noreply@github.com>2021-10-12 11:23:46 +0100
commit6b18eb443054087c4a8153b19b3cc4d3b731d324 (patch)
treea1fdaf5c1283026131d8c13160b4f4b861af69ab /changelog.d
parentAdd an approximate difference method to StateFilters (#10825) (diff)
downloadsynapse-6b18eb443054087c4a8153b19b3cc4d3b731d324.tar.xz
Fix opentracing and Prometheus metrics for replication requests (#10996)
This commit fixes two bugs to do with decorators not instrumenting
`ReplicationEndpoint`'s `send_request` correctly. There are two
decorators on `send_request`: Prometheus' `Gauge.track_inprogress()`
and Synapse's `opentracing.trace`.

`Gauge.track_inprogress()` does not have any support for async
functions when used as a decorator. Since async functions behave like
regular functions that return coroutines, only the creation of the
coroutine was covered by the metric and none of the actual body of
`send_request`.

`Gauge.track_inprogress()` returns a regular, non-async function
wrapping `send_request`, which is the source of the next bug.
The `opentracing.trace` decorator would normally handle async functions
correctly, but since the wrapped `send_request` is a non-async function,
the decorator ends up suffering from the same issue as
`Gauge.track_inprogress()`: the opentracing span only measures the
creation of the coroutine and none of the actual function body.

Using `Gauge.track_inprogress()` as a context manager instead of a
decorator resolves both bugs.
Diffstat (limited to 'changelog.d')
-rw-r--r--changelog.d/10996.misc1
1 files changed, 1 insertions, 0 deletions
diff --git a/changelog.d/10996.misc b/changelog.d/10996.misc
new file mode 100644
index 0000000000..c830d7ec2c
--- /dev/null
+++ b/changelog.d/10996.misc
@@ -0,0 +1 @@
+Fix a bug introduced in Synapse 1.21.0 that causes opentracing and Prometheus metrics for replication requests to be measured incorrectly.