Hello all,

I am sending 4 patches that revert to the opentracing filter function, with the possibility of using haproxy variables to transfer the opentracing context excluded.

Work with haproxy variables will be functional in the foreseeable future, when the necessary changes are made in the source of the opentracing filter.

For a more detailed explanation of the changes you can see the description of the attached patches.


Source build with OpenTracing filter support on github can be enabled.


Willy, thank you for your understanding and patience.

--
Zaga    <miros...@zagorac.name>

What can change the nature of a man?
>From 77fb9a98a82c72bd0696412e5d04425d2431a951 Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac <mzago...@haproxy.com>
Date: Wed, 8 Sep 2021 20:56:05 +0200
Subject: [PATCH 1/4] BUILD: opentracing: exclude the use of haproxy variables
 for the OpenTracing context

Due to a recent change in the handling of haproxy variables, their use for
OpenTracing context transfer has been excluded from the compilation process.

The use of variables can be re-enabled if the newly defined variable
OT_USE_VARS is set to 1 when calling the 'make' utility.  However,
this should not be used for now as the compilation will end in error.

This change prevents the use of haproxy variables to convey the OpenTracing
context.  This means that the 'use-vars' parameter cannot be used in the
OpenTracing filter configuration for 'inject' and 'extract' operations.

An example configuration that uses this feature is in the test/ctx
directory, while the script to run that test is test/run-ctx.sh.

Then, the 'sess.ot.uuid' variable is no longer set when initializing the
OpenTracing session.  This means that this variable can still be used in
the OpenTracing configuration, but its contents will be empty.
---
 Makefile                   |  1 +
 addons/ot/Makefile         |  8 +++++++-
 addons/ot/include/filter.h |  2 +-
 addons/ot/include/parser.h | 19 +++++++++++++++++--
 addons/ot/src/event.c      |  6 ++++++
 addons/ot/src/filter.c     |  2 ++
 addons/ot/src/parser.c     |  4 ++++
 addons/ot/src/scope.c      | 12 ++++++++++--
 8 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index d0a7862b6..38412275c 100644
--- a/Makefile
+++ b/Makefile
@@ -107,6 +107,7 @@
 #   OT_INC         : force the include path to libopentracing-c-wrapper
 #   OT_LIB         : force the lib path to libopentracing-c-wrapper
 #   OT_RUNPATH     : add RUNPATH for libopentracing-c-wrapper to haproxy executable
+#   OT_USE_VARS    : allows the use of variables for the OpenTracing context
 #   IGNOREGIT      : ignore GIT commit versions if set.
 #   VERSION        : force haproxy version reporting.
 #   SUBVERS        : add a sub-version (eg: platform, model, ...).
diff --git a/addons/ot/Makefile b/addons/ot/Makefile
index ef48ce49d..0cc8c6aad 100644
--- a/addons/ot/Makefile
+++ b/addons/ot/Makefile
@@ -3,6 +3,7 @@
 # OT_INC     : force the include path to libopentracing-c-wrapper
 # OT_LIB     : force the lib path to libopentracing-c-wrapper
 # OT_RUNPATH : add libopentracing-c-wrapper RUNPATH to haproxy executable
+# OT_USE_VARS : allows the use of variables for the OpenTracing context
 
 OT_DEFINE    =
 OT_CFLAGS    =
@@ -61,8 +62,13 @@ OPTIONS_OBJS += \
 	addons/ot/src/parser.o      \
 	addons/ot/src/pool.o        \
 	addons/ot/src/scope.o       \
-	addons/ot/src/util.o        \
+	addons/ot/src/util.o
+
+ifneq ($(OT_USE_VARS),)
+OT_DEFINE     = -DUSE_OT_VARS
+OPTIONS_OBJS += \
 	addons/ot/src/vars.o
+endif
 
 OPTIONS_CFLAGS  += $(OT_CFLAGS) -Iaddons/ot/include
 OPTIONS_LDFLAGS += $(OT_LDFLAGS)
diff --git a/addons/ot/include/filter.h b/addons/ot/include/filter.h
index 0b36354e5..c97a0cc59 100644
--- a/addons/ot/include/filter.h
+++ b/addons/ot/include/filter.h
@@ -22,7 +22,7 @@
 
 #define FLT_OT_FMT_NAME           "'" FLT_OT_OPT_NAME "' : "
 #define FLT_OT_FMT_TYPE           "'filter' : "
-#define FTL_OT_VAR_UUID           "sess", "ot", "uuid"
+#define FLT_OT_VAR_UUID           "sess", "ot", "uuid"
 #define FLT_OT_ALERT(f, ...)      ha_alert(FLT_OT_FMT_TYPE FLT_OT_FMT_NAME f "\n", ##__VA_ARGS__)
 
 #define FLT_OT_CONDITION_IF       "if"
diff --git a/addons/ot/include/parser.h b/addons/ot/include/parser.h
index 75a39cc0c..96939916d 100644
--- a/addons/ot/include/parser.h
+++ b/addons/ot/include/parser.h
@@ -65,14 +65,29 @@
 	FLT_OT_PARSE_GROUP_DEF(    ID, 0, 1, 2, 2, "ot-group", " <name>") \
 	FLT_OT_PARSE_GROUP_DEF(SCOPES, 0, 0, 2, 0, "scopes",   " <name> ...")
 
+#ifdef USE_OT_VARS
+#  define FLT_OT_PARSE_SCOPE_INJECT_HELP    " <name-prefix> [use-vars] [use-headers]"
+#  define FLT_OT_PARSE_SCOPE_EXTRACT_HELP   " <name-prefix> [use-vars | use-headers]"
+#else
+#  define FLT_OT_PARSE_SCOPE_INJECT_HELP    " <name-prefix> [use-headers]"
+#  define FLT_OT_PARSE_SCOPE_EXTRACT_HELP   " <name-prefix> [use-headers]"
+#endif
+
+/*
+ * In case the possibility of working with OpenTracing context via HAProxyu
+ * variables is not used, args_max member of the structure flt_ot_parse_data
+ * should be reduced for 'inject' keyword.  However, this is not critical
+ * because in this case the 'use-vars' argument cannot be entered anyway,
+ * so I will not complicate it here with additional definitions.
+ */
 #define FLT_OT_PARSE_SCOPE_DEFINES                                                                                    \
 	FLT_OT_PARSE_SCOPE_DEF(     ID, 0, 1, 2, 2, "ot-scope", " <name>")                                            \
 	FLT_OT_PARSE_SCOPE_DEF(   SPAN, 0, 0, 2, 5, "span",     " <name> [<reference>] [root]")                       \
 	FLT_OT_PARSE_SCOPE_DEF(    TAG, 1, 0, 3, 0, "tag",      " <name> <sample> ...")                               \
 	FLT_OT_PARSE_SCOPE_DEF(    LOG, 1, 0, 3, 0, "log",      " <name> <sample> ...")                               \
 	FLT_OT_PARSE_SCOPE_DEF(BAGGAGE, 1, 4, 3, 0, "baggage",  " <name> <sample> ...")                               \
-	FLT_OT_PARSE_SCOPE_DEF( INJECT, 1, 3, 2, 4, "inject",   " <name-prefix> [use-vars] [use-headers]")            \
-	FLT_OT_PARSE_SCOPE_DEF(EXTRACT, 0, 3, 2, 3, "extract",  " <name-prefix> [use-vars | use-headers]")            \
+	FLT_OT_PARSE_SCOPE_DEF( INJECT, 1, 3, 2, 4, "inject",   FLT_OT_PARSE_SCOPE_INJECT_HELP)                       \
+	FLT_OT_PARSE_SCOPE_DEF(EXTRACT, 0, 3, 2, 3, "extract",  FLT_OT_PARSE_SCOPE_EXTRACT_HELP)                      \
 	FLT_OT_PARSE_SCOPE_DEF( FINISH, 0, 0, 2, 0, "finish",   " <name> ...")                                        \
 	FLT_OT_PARSE_SCOPE_DEF(    ACL, 0, 1, 3, 0, "acl",      " <name> <criterion> [flags] [operator] <value> ...") \
 	FLT_OT_PARSE_SCOPE_DEF(  EVENT, 0, 0, 2, 0, "event",    " <name> [{ if | unless } <condition>]")
diff --git a/addons/ot/src/event.c b/addons/ot/src/event.c
index 90b582876..8cad07956 100644
--- a/addons/ot/src/event.c
+++ b/addons/ot/src/event.c
@@ -85,12 +85,14 @@ static int flt_ot_scope_run_span(struct stream *s, struct filter *f, struct chan
 
 			if (conf_span->ctx_flags & (FLT_OT_CTX_USE_VARS | FLT_OT_CTX_USE_HEADERS)) {
 				for (text_map = &(writer.text_map); i < text_map->count; i++) {
+#ifdef USE_OT_VARS
 					if (!(conf_span->ctx_flags & FLT_OT_CTX_USE_VARS))
 						/* Do nothing. */;
 					else if (flt_ot_var_register(FLT_OT_VARS_SCOPE, conf_span->ctx_id, text_map->key[i], err) == -1)
 						retval = FLT_OT_RET_ERROR;
 					else if (flt_ot_var_set(s, FLT_OT_VARS_SCOPE, conf_span->ctx_id, text_map->key[i], text_map->value[i], dir, err) == -1)
 						retval = FLT_OT_RET_ERROR;
+#endif
 
 					if (!(conf_span->ctx_flags & FLT_OT_CTX_USE_HEADERS))
 						/* Do nothing. */;
@@ -195,8 +197,10 @@ int flt_ot_scope_run(struct stream *s, struct filter *f, struct channel *chn, st
 		 */
 		if (conf_ctx->flags & FLT_OT_CTX_USE_HEADERS)
 			text_map = flt_ot_http_headers_get(chn, conf_ctx->id, conf_ctx->id_len, err);
+#ifdef USE_OT_VARS
 		else
 			text_map = flt_ot_vars_get(s, FLT_OT_VARS_SCOPE, conf_ctx->id, dir, err);
+#endif
 
 		if (text_map != NULL) {
 			if (flt_ot_scope_context_init(f->ctx, conf->tracer->tracer, conf_ctx->id, conf_ctx->id_len, text_map, dir, err) == NULL)
@@ -314,7 +318,9 @@ int flt_ot_event_run(struct stream *s, struct filter *f, struct channel *chn, in
 			retval = FLT_OT_RET_ERROR;
 	}
 
+#ifdef USE_OT_VARS
 	flt_ot_vars_dump(s);
+#endif
 	flt_ot_http_headers_dump(chn);
 
 	FLT_OT_DBG(3, "event = %d, chn = %p, s->req = %p, s->res = %p", event, chn, &(s->req), &(s->res));
diff --git a/addons/ot/src/filter.c b/addons/ot/src/filter.c
index 04c4a67f1..bd71186a6 100644
--- a/addons/ot/src/filter.c
+++ b/addons/ot/src/filter.c
@@ -560,7 +560,9 @@ static int flt_ot_attach(struct stream *s, struct filter *f)
 
 	FLT_OT_LOG(LOG_INFO, "%08x %08x", f->pre_analyzers, f->post_analyzers);
 
+#ifdef USE_OT_VARS
 	flt_ot_vars_dump(s);
+#endif
 	flt_ot_http_headers_dump(&(s->req));
 
 	FLT_OT_RETURN(FLT_OT_RET_OK);
diff --git a/addons/ot/src/parser.c b/addons/ot/src/parser.c
index e26ca18ee..ae09e027e 100644
--- a/addons/ot/src/parser.c
+++ b/addons/ot/src/parser.c
@@ -720,8 +720,10 @@ static int flt_ot_parse_cfg_scope_ctx(char **args, int cur_arg, char **err)
 
 	if (strcmp(args[cur_arg], FLT_OT_PARSE_CTX_USE_HEADERS) == 0)
 		flags = FLT_OT_CTX_USE_HEADERS;
+#ifdef USE_OT_VARS
 	else if (strcmp(args[cur_arg], FLT_OT_PARSE_CTX_USE_VARS) == 0)
 		flags = FLT_OT_CTX_USE_VARS;
+#endif
 	else
 		FLT_OT_PARSE_ERR(err, "'%s' : invalid context storage type", args[0]);
 
@@ -939,8 +941,10 @@ static int flt_ot_parse_cfg_scope(const char *file, int linenum, char **args, in
 			conf_ctx->flags = FLT_OT_CTX_USE_HEADERS;
 		else if (strcmp(args[2], FLT_OT_PARSE_CTX_USE_HEADERS) == 0)
 			conf_ctx->flags = FLT_OT_CTX_USE_HEADERS;
+#ifdef USE_OT_VARS
 		else if (strcmp(args[2], FLT_OT_PARSE_CTX_USE_VARS) == 0)
 			conf_ctx->flags = FLT_OT_CTX_USE_VARS;
+#endif
 		else
 			FLT_OT_PARSE_ERR(&err, "'%s' : invalid context storage type", args[2]);
 	}
diff --git a/addons/ot/src/scope.c b/addons/ot/src/scope.c
index 8d70a08d6..112f9d545 100644
--- a/addons/ot/src/scope.c
+++ b/addons/ot/src/scope.c
@@ -120,8 +120,14 @@ struct flt_ot_runtime_context *flt_ot_runtime_context_init(struct stream *s, str
 	               (uint16_t)(retptr->uuid.clock_seq | UINT16_C(0x8000)),
 	               (uint64_t)retptr->uuid.node);
 
-	if (flt_ot_var_register(FTL_OT_VAR_UUID, err) != -1)
-		(void)flt_ot_var_set(s, FTL_OT_VAR_UUID, retptr->uuid.s, SMP_OPT_DIR_REQ, err);
+#ifdef USE_OT_VARS
+	/*
+	 * The HAProxy variable 'sess.ot.uuid' is registered here,
+	 * after which its value is set to runtime context UUID.
+	 */
+	if (flt_ot_var_register(FLT_OT_VAR_UUID, err) != -1)
+		(void)flt_ot_var_set(s, FLT_OT_VAR_UUID, retptr->uuid.s, SMP_OPT_DIR_REQ, err);
+#endif
 
 	FLT_OT_DBG_RUNTIME_CONTEXT("session context: ", retptr);
 
@@ -610,7 +616,9 @@ void flt_ot_scope_free_unused(struct flt_ot_runtime_context *rt_ctx, struct chan
 				 * the context in question should be deleted.
 				 */
 				(void)flt_ot_http_headers_remove(chn, ctx->id, NULL);
+#ifdef USE_OT_VARS
 				(void)flt_ot_vars_unset(rt_ctx->stream, FLT_OT_VARS_SCOPE, ctx->id, ctx->smp_opt_dir, NULL);
+#endif
 
 				flt_ot_scope_context_free(&ctx);
 			}
-- 
2.30.1

>From 8b4472d8479821fd2e8b7e8a1905a57063636645 Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac <mzago...@haproxy.com>
Date: Thu, 9 Sep 2021 01:23:42 +0200
Subject: [PATCH 2/4] BUG/MINOR: opentracing: enable the use of http headers
 without a set value

In case we transfer some data that does not have a set value via the HTTP
header, adding that header in the text map was done incorrectly.

This simple patch allows the use of HTTP headers without a set value.
---
 addons/ot/src/http.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/addons/ot/src/http.c b/addons/ot/src/http.c
index 4a12ed854..1517e71e4 100644
--- a/addons/ot/src/http.c
+++ b/addons/ot/src/http.c
@@ -139,8 +139,14 @@ struct otc_text_map *flt_ot_http_headers_get(struct channel *chn, const char *pr
 				 *
 				 * Before adding, the prefix is removed from the
 				 * HTTP header name.
+				 *
+				 * In case the data of the HTTP header is not
+				 * specified, v.len will be equal to 0, and
+				 * the function otc_text_map_add() will not
+				 * interpret this well.  In this case, instead
+				 * of v.ptr, "" is used.
 				 */
-				if (otc_text_map_add(retptr, n.ptr + prefix_len, n.len - prefix_len, v.ptr, v.len, OTC_TEXT_MAP_DUP_KEY | OTC_TEXT_MAP_DUP_VALUE) == -1) {
+				if (otc_text_map_add(retptr, n.ptr + prefix_len, n.len - prefix_len, (v.len > 0) ? v.ptr : "", v.len, OTC_TEXT_MAP_DUP_KEY | OTC_TEXT_MAP_DUP_VALUE) == -1) {
 					FLT_OT_ERR("failed to add HTTP header data");
 
 					otc_text_map_destroy(&retptr, OTC_TEXT_MAP_FREE_KEY | OTC_TEXT_MAP_FREE_VALUE);
-- 
2.30.1

>From f56107653891bfa940302406ca8b5f7af5ad75cf Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac <mzago...@haproxy.com>
Date: Thu, 9 Sep 2021 10:31:12 +0200
Subject: [PATCH 3/4] CLEANUP: opentracing: use the haproxy function to
 generate uuid

To avoid duplicate source code, the original haproxy function is used to
generate the OpenTracing runtime context UUID.

Also, the structure flt_ot_runtime_context is simplified because the
detailed definition of UUID is removed from it (struct flt_ot_uuid),
ie the UUID is left only in the form of a string.
---
 addons/ot/include/scope.h | 25 +++++--------------------
 addons/ot/src/scope.c     | 13 ++++---------
 2 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/addons/ot/include/scope.h b/addons/ot/include/scope.h
index 7b3f26542..7a3a77614 100644
--- a/addons/ot/include/scope.h
+++ b/addons/ot/include/scope.h
@@ -40,10 +40,10 @@
 	FLT_OT_DBG(3, "%s%p:{ %p %d %p %p %d }", \
 	           (f), (a), (a)->tags, (a)->num_tags, (a)->baggage, (a)->log_fields, (a)->num_log_fields)
 
-#define FLT_OT_DBG_RUNTIME_CONTEXT(f,a)                                                                                    \
-	FLT_OT_DBG(3, "%s%p:{ %p %p { %016" PRIx64 " %016" PRIx64 " '%s' } %hhu %hhu 0x%02hhx 0x%08x %s %s }",             \
-	           (f), (a), (a)->stream, (a)->filter, (a)->uuid.u64[0], (a)->uuid.u64[1], (a)->uuid.s, (a)->flag_harderr, \
-	           (a)->flag_disabled, (a)->logging, (a)->analyzers, flt_ot_list_debug(&((a)->spans)),                     \
+#define FLT_OT_DBG_RUNTIME_CONTEXT(f,a)                                                                \
+	FLT_OT_DBG(3, "%s%p:{ %p %p '%s' %hhu %hhu 0x%02hhx 0x%08x %s %s }",                           \
+	           (f), (a), (a)->stream, (a)->filter, (a)->uuid, (a)->flag_harderr,                   \
+	           (a)->flag_disabled, (a)->logging, (a)->analyzers, flt_ot_list_debug(&((a)->spans)), \
 	           flt_ot_list_debug(&((a)->contexts)))
 
 #define FLT_OT_CONST_STR_HDR(a)      \
@@ -82,26 +82,11 @@ struct flt_ot_scope_context {
 	struct list              list;        /* Used to chain this structure. */
 };
 
-struct flt_ot_uuid {
-	union {
-		uint64_t u64[2];
-		uint8_t  u8[16];
-		struct {
-			uint32_t time_low;
-			uint16_t time_mid;
-			uint16_t time_hi_and_version;
-			uint16_t clock_seq;
-			uint64_t node : 48;
-		} __attribute__((packed));
-	};
-	char s[40];
-};
-
 /* The runtime filter context attached to a stream. */
 struct flt_ot_runtime_context {
 	struct stream      *stream;        /* The stream to which the filter is attached. */
 	struct filter      *filter;        /* The OpenTracing filter. */
-	struct flt_ot_uuid  uuid;          /* Randomly generated UUID. */
+	char                uuid[40];      /* Randomly generated UUID. */
 	bool                flag_harderr;  /* [0 1] */
 	bool                flag_disabled; /* [0 1] */
 	uint8_t             logging;       /* [0 1 3] */
diff --git a/addons/ot/src/scope.c b/addons/ot/src/scope.c
index 112f9d545..80b0bc21b 100644
--- a/addons/ot/src/scope.c
+++ b/addons/ot/src/scope.c
@@ -95,6 +95,7 @@ void flt_ot_pools_info(void)
 struct flt_ot_runtime_context *flt_ot_runtime_context_init(struct stream *s, struct filter *f, char **err)
 {
 	const struct flt_ot_conf      *conf = FLT_OT_CONF(f);
+	struct buffer                  uuid;
 	struct flt_ot_runtime_context *retptr = NULL;
 
 	FLT_OT_FUNC("%p, %p, %p:%p", s, f, FLT_OT_DPTR_ARGS(err));
@@ -105,20 +106,14 @@ struct flt_ot_runtime_context *flt_ot_runtime_context_init(struct stream *s, str
 
 	retptr->stream        = s;
 	retptr->filter        = f;
-	retptr->uuid.u64[0]   = ha_random64();
-	retptr->uuid.u64[1]   = ha_random64();
 	retptr->flag_harderr  = conf->tracer->flag_harderr;
 	retptr->flag_disabled = conf->tracer->flag_disabled;
 	retptr->logging       = conf->tracer->logging;
 	LIST_INIT(&(retptr->spans));
 	LIST_INIT(&(retptr->contexts));
 
-	(void)snprintf(retptr->uuid.s, sizeof(retptr->uuid.s), "%08x-%04hx-%04hx-%04hx-%012" PRIx64,
-	               retptr->uuid.time_low,
-	               retptr->uuid.time_mid,
-	               (uint16_t)((retptr->uuid.time_hi_and_version & UINT16_C(0xfff)) | UINT16_C(0x4000)),
-	               (uint16_t)(retptr->uuid.clock_seq | UINT16_C(0x8000)),
-	               (uint64_t)retptr->uuid.node);
+	uuid = b_make(retptr->uuid, sizeof(retptr->uuid), 0, 0);
+	ha_generate_uuid(&uuid);
 
 #ifdef USE_OT_VARS
 	/*
@@ -126,7 +121,7 @@ struct flt_ot_runtime_context *flt_ot_runtime_context_init(struct stream *s, str
 	 * after which its value is set to runtime context UUID.
 	 */
 	if (flt_ot_var_register(FLT_OT_VAR_UUID, err) != -1)
-		(void)flt_ot_var_set(s, FLT_OT_VAR_UUID, retptr->uuid.s, SMP_OPT_DIR_REQ, err);
+		(void)flt_ot_var_set(s, FLT_OT_VAR_UUID, retptr->uuid, SMP_OPT_DIR_REQ, err);
 #endif
 
 	FLT_OT_DBG_RUNTIME_CONTEXT("session context: ", retptr);
-- 
2.30.1

>From 4e7e6715a407ca7d55b58790433062a314ea2f75 Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac <mzago...@haproxy.com>
Date: Thu, 9 Sep 2021 14:19:25 +0200
Subject: [PATCH 4/4] MINOR: opentracing: change the scope of the variable
 'ot.uuid' from 'sess' to 'txn'

At the suggestion of Willy Tarreau, the scope of the 'ot.uuid' variable was
changed from 'sess' to 'txn', so it is now limited to the transaction only.
---
 addons/ot/README-func      | 2 +-
 addons/ot/include/filter.h | 2 +-
 addons/ot/src/scope.c      | 2 +-
 addons/ot/test/be/ot.cfg   | 2 +-
 addons/ot/test/cmp/ot.cfg  | 2 +-
 addons/ot/test/ctx/ot.cfg  | 2 +-
 addons/ot/test/fe/ot.cfg   | 2 +-
 addons/ot/test/sa/ot.cfg   | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/addons/ot/README-func b/addons/ot/README-func
index 273c7f928..a6cb21eea 100644
--- a/addons/ot/README-func
+++ b/addons/ot/README-func
@@ -144,7 +144,7 @@ context is created, and flags are set that define which analyzers are used.
       flt_ot_runtime_context_init(<err>) {
          flt_ot_pool_alloc() {
          }
-         /* Initializing and setting the variable 'sess.ot.uuid'. */
+         /* Initializing and setting the variable 'txn.ot.uuid'. */
          if (flt_ot_var_register(<err>) != -1) {
             flt_ot_var_set(<err>) {
             }
diff --git a/addons/ot/include/filter.h b/addons/ot/include/filter.h
index c97a0cc59..6d41b7289 100644
--- a/addons/ot/include/filter.h
+++ b/addons/ot/include/filter.h
@@ -22,7 +22,7 @@
 
 #define FLT_OT_FMT_NAME           "'" FLT_OT_OPT_NAME "' : "
 #define FLT_OT_FMT_TYPE           "'filter' : "
-#define FLT_OT_VAR_UUID           "sess", "ot", "uuid"
+#define FLT_OT_VAR_UUID           "txn", "ot", "uuid"
 #define FLT_OT_ALERT(f, ...)      ha_alert(FLT_OT_FMT_TYPE FLT_OT_FMT_NAME f "\n", ##__VA_ARGS__)
 
 #define FLT_OT_CONDITION_IF       "if"
diff --git a/addons/ot/src/scope.c b/addons/ot/src/scope.c
index 80b0bc21b..6492c2774 100644
--- a/addons/ot/src/scope.c
+++ b/addons/ot/src/scope.c
@@ -117,7 +117,7 @@ struct flt_ot_runtime_context *flt_ot_runtime_context_init(struct stream *s, str
 
 #ifdef USE_OT_VARS
 	/*
-	 * The HAProxy variable 'sess.ot.uuid' is registered here,
+	 * The HAProxy variable 'txn.ot.uuid' is registered here,
 	 * after which its value is set to runtime context UUID.
 	 */
 	if (flt_ot_var_register(FLT_OT_VAR_UUID, err) != -1)
diff --git a/addons/ot/test/be/ot.cfg b/addons/ot/test/be/ot.cfg
index edd3f76ca..12cf0a17a 100644
--- a/addons/ot/test/be/ot.cfg
+++ b/addons/ot/test/be/ot.cfg
@@ -20,7 +20,7 @@
     ot-scope frontend_http_request
         extract "ot-ctx" use-headers
         span "HAProxy session" child-of "ot-ctx" root
-            baggage "haproxy_id" var(sess.ot.uuid)
+            baggage "haproxy_id" var(txn.ot.uuid)
         span "Client session" child-of "HAProxy session"
         span "Frontend HTTP request" child-of "Client session"
             tag "http.method" method
diff --git a/addons/ot/test/cmp/ot.cfg b/addons/ot/test/cmp/ot.cfg
index 21b15dd61..a16fc9ea6 100644
--- a/addons/ot/test/cmp/ot.cfg
+++ b/addons/ot/test/cmp/ot.cfg
@@ -21,7 +21,7 @@
 
     ot-scope client_session_start
         span "HAProxy session" root
-            baggage "haproxy_id" var(sess.ot.uuid)
+            baggage "haproxy_id" var(txn.ot.uuid)
         span "Client session" child-of "HAProxy session"
         event on-client-session-start
 
diff --git a/addons/ot/test/ctx/ot.cfg b/addons/ot/test/ctx/ot.cfg
index a06a4e00f..a753f77b9 100644
--- a/addons/ot/test/ctx/ot.cfg
+++ b/addons/ot/test/ctx/ot.cfg
@@ -57,7 +57,7 @@
     ot-scope client_session_start_1
         span "HAProxy session" root
             inject "ot_ctx_1" use-headers use-vars
-            baggage "haproxy_id" var(sess.ot.uuid)
+            baggage "haproxy_id" var(txn.ot.uuid)
         event on-client-session-start
 
     ot-scope client_session_start_2
diff --git a/addons/ot/test/fe/ot.cfg b/addons/ot/test/fe/ot.cfg
index 11de82876..6f384e883 100644
--- a/addons/ot/test/fe/ot.cfg
+++ b/addons/ot/test/fe/ot.cfg
@@ -22,7 +22,7 @@
 
     ot-scope client_session_start
         span "HAProxy session" root
-            baggage "haproxy_id" var(sess.ot.uuid)
+            baggage "haproxy_id" var(txn.ot.uuid)
         span "Client session" child-of "HAProxy session"
         event on-client-session-start
 
diff --git a/addons/ot/test/sa/ot.cfg b/addons/ot/test/sa/ot.cfg
index ae7413b95..654c2feaf 100644
--- a/addons/ot/test/sa/ot.cfg
+++ b/addons/ot/test/sa/ot.cfg
@@ -55,7 +55,7 @@
 
     ot-scope client_session_start
         span "HAProxy session" root
-            baggage "haproxy_id" var(sess.ot.uuid)
+            baggage "haproxy_id" var(txn.ot.uuid)
         span "Client session" child-of "HAProxy session"
         acl acl-test-src-ip src 127.0.0.1
         event on-client-session-start if acl-test-src-ip
-- 
2.30.1

Reply via email to