gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: add latency logging


From: gnunet
Subject: [taler-exchange] branch master updated: add latency logging
Date: Thu, 09 Dec 2021 13:29:15 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new ce28d3b8 add latency logging
ce28d3b8 is described below

commit ce28d3b8e4aa513336030468cd08e9cb66718273
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Dec 9 13:29:07 2021 +0100

    add latency logging
---
 src/exchange/taler-exchange-httpd.c | 18 ++++++++++++++++++
 src/exchange/taler-exchange-httpd.h |  5 +++++
 2 files changed, 23 insertions(+)

diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index 58e9b572..0ba608ff 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;
diff --git a/src/exchange/taler-exchange-httpd.h 
b/src/exchange/taler-exchange-httpd.h
index 07f6b023..cad74d2e 100644
--- a/src/exchange/taler-exchange-httpd.h
+++ b/src/exchange/taler-exchange-httpd.h
@@ -218,6 +218,11 @@ struct TEH_RequestContext
    */
   struct GNUNET_AsyncScopeId async_scope_id;
 
+  /**
+   * When was this request started?
+   */
+  struct GNUNET_TIME_Absolute start_time;
+
   /**
    * Opaque parsing context.
    */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]