summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-09 13:29:07 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-09 13:29:07 +0100
commitce28d3b8e4aa513336030468cd08e9cb66718273 (patch)
tree2be268a5558b7c46ff346efdb1f93a1351b6cbe0 /src/exchange/taler-exchange-httpd.c
parentdcb73693dd69767828b975dc603e6b0dd2d5408d (diff)
downloadexchange-ce28d3b8e4aa513336030468cd08e9cb66718273.tar.gz
exchange-ce28d3b8e4aa513336030468cd08e9cb66718273.tar.bz2
exchange-ce28d3b8e4aa513336030468cd08e9cb66718273.zip
add latency logging
Diffstat (limited to 'src/exchange/taler-exchange-httpd.c')
-rw-r--r--src/exchange/taler-exchange-httpd.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index 58e9b572a..0ba608ff4 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -58,6 +58,11 @@
*/
#define UNIX_BACKLOG 50
+/**
+ * Above what request latency do we start to log?
+ */
+#define WARN_LATENCY GNUNET_TIME_relative_multiply ( \
+ GNUNET_TIME_UNIT_MILLISECONDS, 500)
/**
* Are clients allowed to request /keys for times other than the
@@ -383,6 +388,18 @@ handle_mhd_completion_callback (void *cls,
/* Sanity-check that we didn't leave any transactions hanging */
GNUNET_break (GNUNET_OK ==
TEH_plugin->preflight (TEH_plugin->cls));
+ {
+ struct GNUNET_TIME_Relative latency;
+
+ latency = GNUNET_TIME_absolute_get_duration (rc->start_time);
+ if (latency.rel_value_us >
+ WARN_LATENCY.rel_value_us)
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Request for `%s' took %s\n",
+ rc->url,
+ GNUNET_STRINGS_relative_time_to_string (latency,
+ GNUNET_YES));
+ }
GNUNET_free (rc);
*con_cls = NULL;
GNUNET_async_scope_restore (&old_scope);
@@ -987,6 +1004,7 @@ handle_mhd_request (void *cls,
/* We're in a new async scope! */
rc = *con_cls = GNUNET_new (struct TEH_RequestContext);
+ rc->start_time = GNUNET_TIME_absolute_get ();
GNUNET_async_scope_fresh (&rc->async_scope_id);
TEH_check_invariants ();
rc->url = url;