BUG/MEDIUM: opentracing: initialization before establishing daemon and/or chroot mode

This patch solves the problem reported in github issue #1204, where the
OpenTracing filter cannot communicate with the selected tracer if HAProxy
is run in daemon mode.

This commit also solves github issue #1274, where the problem manifests
itself when using the 'chroot' keyword in the HAProxy configuration.

This is solved so that the initialization of the OpenTracing plugin is
split into two operations, first the plugin (dynamic library) is loaded
before switching the HAProxy to daemon mode (or chroot) and then the
tracer thread is started.

This means that nothing is retrieved from the file system in runtime.

After applying this commit, opentracing C wrapper version 1.1.0 should be
used because the earlier version does not have separated initialization
functions.

This resolves GitHub issues #1204 and #1274.

(cherry picked from commit 9425ed488f4d31db07f0c9b1e8b2f0fb65b18c7b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/addons/ot/src/opentracing.c b/addons/ot/src/opentracing.c
index 58936d1..b79ba29 100644
--- a/addons/ot/src/opentracing.c
+++ b/addons/ot/src/opentracing.c
@@ -138,7 +138,6 @@
  *
  * ARGUMENTS
  *   tracer -
- *   config -
  *   plugin -
  *   err    -
  *
@@ -148,12 +147,12 @@
  * RETURN VALUE
  *   -
  */
-int ot_init(struct otc_tracer **tracer, const char *config, const char *plugin, char **err)
+int ot_init(struct otc_tracer **tracer, const char *plugin, char **err)
 {
 	char cwd[PATH_MAX], path[PATH_MAX], errbuf[BUFSIZ] = "";
 	int  rc, retval = -1;
 
-	FLT_OT_FUNC("%p:%p \"%s\", \"%s\", %p:%p", FLT_OT_DPTR_ARGS(tracer), config, plugin, FLT_OT_DPTR_ARGS(err));
+	FLT_OT_FUNC("%p:%p, \"%s\", %p:%p", FLT_OT_DPTR_ARGS(tracer), plugin, FLT_OT_DPTR_ARGS(err));
 
 	flt_ot_pools_info();
 #ifdef USE_POOL_OT_SPAN_CONTEXT
@@ -172,7 +171,7 @@
 		FLT_OT_RETURN(retval);
 	}
 
-	*tracer = otc_tracer_init(path, config, NULL, errbuf, sizeof(errbuf));
+	*tracer = otc_tracer_load(path, errbuf, sizeof(errbuf));
 	if (*tracer == NULL) {
 		FLT_OT_ERR("%s", (*errbuf == '\0') ? "failed to initialize tracing library" : errbuf);
 	} else {
@@ -187,6 +186,39 @@
 
 /***
  * NAME
+ *   ot_start -
+ *
+ * ARGUMENTS
+ *   tracer -
+ *   cfgbuf -
+ *   err    -
+ *
+ * DESCRIPTION
+ *   -
+ *
+ * RETURN VALUE
+ *   This function does not return a value.
+ */
+int ot_start(struct otc_tracer *tracer, const char *cfgbuf, char **err)
+{
+	char errbuf[BUFSIZ] = "";
+	int  retval = -1;
+
+	FLT_OT_FUNC("%p, %p, %p:%p", tracer, cfgbuf, FLT_OT_DPTR_ARGS(err));
+
+	if (cfgbuf == NULL)
+		FLT_OT_RETURN(retval);
+
+	retval = otc_tracer_start(NULL, cfgbuf, errbuf, sizeof(errbuf));
+	if (retval == -1)
+		FLT_OT_ERR("%s", (*errbuf == '\0') ? "failed to start tracer" : errbuf);
+
+	FLT_OT_RETURN(retval);
+}
+
+
+/***
+ * NAME
  *   ot_close -
  *
  * ARGUMENTS