]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
Revert "BUG/MINOR: opentracing: initialization after establishing daemon mode"
authorMiroslav Zagorac <mzagorac@haproxy.com>
Wed, 9 Jun 2021 23:19:13 +0000 (01:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 10 Jun 2021 04:45:39 +0000 (06:45 +0200)
This reverts commit f2263435d71964d1aa3eb80df6464500696c0515.

This commit is unnecessary because although it solves the problem of using
the OpenTracing filter in daemon mode, it does not solve the same problem
if chroot is used.

The following commit related to the OpenTracing filter solves both problems
efficiently.

addons/ot/src/filter.c

index d5fc2c72f0bbf57290d65bf3432857116f61222a..6699d46137b99f6084bc7779f26e86d24b67886d 100644 (file)
@@ -156,15 +156,29 @@ static void flt_ot_return_void(const struct filter *f, char **err)
 static int flt_ot_init(struct proxy *p, struct flt_conf *fconf)
 {
        struct flt_ot_conf *conf = FLT_OT_DEREF(fconf, conf, NULL);
-       int                 retval = FLT_OT_RET_OK;
+       char               *err = NULL;
+       int                 retval = FLT_OT_RET_ERROR;
 
        FLT_OT_FUNC("%p, %p", p, fconf);
 
        if (conf == NULL)
-               FLT_OT_RETURN(FLT_OT_RET_ERROR);
+               FLT_OT_RETURN(retval);
 
        flt_ot_cli_init();
 
+       /*
+        * Initialize the OpenTracing library.
+        * Enable HTX streams filtering.
+        */
+       retval = ot_init(&(conf->tracer->tracer), conf->tracer->config, conf->tracer->plugin, &err);
+       if (retval != FLT_OT_RET_ERROR)
+               fconf->flags |= FLT_CFG_FL_HTX;
+       else if (err != NULL) {
+               FLT_OT_ALERT("%s", err);
+
+               FLT_OT_ERR_FREE(err);
+       }
+
        FLT_OT_RETURN(retval);
 }
 
@@ -412,6 +426,8 @@ static int flt_ot_check(struct proxy *p, struct flt_conf *fconf)
 }
 
 
+#ifdef DEBUG_OT
+
 /***
  * NAME
  *   flt_ot_init_per_thread -
@@ -430,38 +446,14 @@ static int flt_ot_check(struct proxy *p, struct flt_conf *fconf)
  */
 static int flt_ot_init_per_thread(struct proxy *p, struct flt_conf *fconf)
 {
-       struct flt_ot_conf *conf = FLT_OT_DEREF(fconf, conf, NULL);
-       char               *err = NULL;
-       int                 retval = FLT_OT_RET_ERROR;
+       int retval = FLT_OT_RET_OK;
 
        FLT_OT_FUNC("%p, %p", p, fconf);
 
-       if (conf == NULL)
-               FLT_OT_RETURN(retval);
-
-       /*
-        * Initialize the OpenTracing library.
-        * Enable HTX streams filtering.
-        */
-       if (conf->tracer->tracer == NULL) {
-               retval = ot_init(&(conf->tracer->tracer), conf->tracer->config, conf->tracer->plugin, &err);
-               if (retval != FLT_OT_RET_ERROR)
-                       fconf->flags |= FLT_CFG_FL_HTX;
-               else if (err != NULL) {
-                       FLT_OT_ALERT("%s", err);
-
-                       FLT_OT_ERR_FREE(err);
-               }
-       } else {
-               retval = FLT_OT_RET_OK;
-       }
-
        FLT_OT_RETURN(retval);
 }
 
 
-#ifdef DEBUG_OT
-
 /***
  * NAME
  *   flt_ot_deinit_per_thread -
@@ -1120,7 +1112,7 @@ struct flt_ops flt_ot_ops = {
        .init                  = flt_ot_init,
        .deinit                = flt_ot_deinit,
        .check                 = flt_ot_check,
-       .init_per_thread       = flt_ot_init_per_thread,
+       .init_per_thread       = FLT_OT_DBG_IFDEF(flt_ot_init_per_thread, NULL),
        .deinit_per_thread     = FLT_OT_DBG_IFDEF(flt_ot_deinit_per_thread, NULL),
 
        /* Stream callbacks. */