This reverts commit 560c7b874aef5922199e36a7f31466af323f489f.
The ot.uuid variable should have the 'sess' scope because it is created when an OpenTracing filter is attached to a stream. After that, the stream processing is started and on that occasion the contexts for the variables that have the range 'txn' and 'req' are initialized. This means that we cannot use variables with the specified scopes before that point. -- Miroslav Zagorac Senior Developer
>From 8f777edd98512666a40ffc8abd2d00c187fe577b Mon Sep 17 00:00:00 2001 From: Miroslav Zagorac <mzago...@haproxy.com> Date: Wed, 23 Feb 2022 10:28:10 +0100 Subject: [PATCH 01/16] Revert "MINOR: opentracing: change the scope of the variable 'ot.uuid' from 'sess' to 'txn'" This reverts commit 560c7b874aef5922199e36a7f31466af323f489f. The ot.uuid variable should have the 'sess' scope because it is created when an OpenTracing filter is attached to a stream. After that, the stream processing is started and on that occasion the contexts for the variables that have the range 'txn' and 'req' are initialized. This means that we cannot use variables with the specified scopes before that point. --- 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 a6cb21eea..273c7f928 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 'txn.ot.uuid'. */ + /* Initializing and setting the variable 'sess.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 6d41b7289..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 FLT_OT_VAR_UUID "txn", "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/src/scope.c b/addons/ot/src/scope.c index 6492c2774..80b0bc21b 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 'txn.ot.uuid' is registered here, + * 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) diff --git a/addons/ot/test/be/ot.cfg b/addons/ot/test/be/ot.cfg index 12cf0a17a..edd3f76ca 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(txn.ot.uuid) + baggage "haproxy_id" var(sess.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 a16fc9ea6..21b15dd61 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(txn.ot.uuid) + baggage "haproxy_id" var(sess.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 a753f77b9..a06a4e00f 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(txn.ot.uuid) + baggage "haproxy_id" var(sess.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 6f384e883..11de82876 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(txn.ot.uuid) + baggage "haproxy_id" var(sess.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 654c2feaf..ae7413b95 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(txn.ot.uuid) + baggage "haproxy_id" var(sess.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.2