mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-27 15:12:11 +00:00
MINOR: opentracing: transfer of context names without prefix
In order to enable the assignment of a context name, and yet exclude the use of that name (prefix in this case) when extracting the context from the HTTP header, a special character '-' has been added, which can be specified at the beginning of the prefix. So let's say if we look at examples of the fe-be configuration, we can transfer the context via an HTTP header without a prefix like this: fe/ot.cfg: .. span "HAProxy session" inject "" use-headers event on-backend-http-request Such a context can be read in another process using a name that has a special '-' sign at the beginning: be/ot.cfg: ot-scope frontend_http_request extract "-ot-ctx" use-headers span "HAProxy session" child-of "-ot-ctx" root .. This means that the context name will be '-ot-ctx' but it will not be used when extracting data from HTTP headers. Of course, if the context does not have a prefix set, all HTTP headers will be inserted into the OpenTracing library as context. All of the above will only work correctly if that library can figure out what is relevant to the context and what is not.
This commit is contained in:
parent
4b3eb0a940
commit
a8bdf2b655
@ -38,6 +38,7 @@
|
||||
#define FLT_OT_PARSE_SPAN_REF_CHILD "child-of"
|
||||
#define FLT_OT_PARSE_SPAN_REF_FOLLOWS "follows-from"
|
||||
#define FLT_OT_PARSE_CTX_AUTONAME "-"
|
||||
#define FLT_OT_PARSE_CTX_IGNORE_NAME '-'
|
||||
#define FLT_OT_PARSE_CTX_USE_HEADERS "use-headers"
|
||||
#define FLT_OT_PARSE_CTX_USE_VARS "use-vars"
|
||||
#define FLT_OT_PARSE_OPTION_HARDERR "hard-errors"
|
||||
|
@ -99,6 +99,19 @@ struct otc_text_map *flt_ot_http_headers_get(struct channel *chn, const char *pr
|
||||
if (chn == NULL)
|
||||
FLT_OT_RETURN(retptr);
|
||||
|
||||
/*
|
||||
* The keyword 'inject' allows you to define the name of the OpenTracing
|
||||
* context without using a prefix. In that case all HTTP headers are
|
||||
* transferred because it is not possible to separate them from the
|
||||
* OpenTracing context (this separation is usually done via a prefix).
|
||||
*
|
||||
* When using the 'extract' keyword, the context name must be specified.
|
||||
* To allow all HTTP headers to be extracted, the first character of
|
||||
* that name must be set to FLT_OT_PARSE_CTX_IGNORE_NAME.
|
||||
*/
|
||||
if (FLT_OT_STR_ISVALID(prefix) && (*prefix == FLT_OT_PARSE_CTX_IGNORE_NAME))
|
||||
prefix_len = 0;
|
||||
|
||||
htx = htxbuf(&(chn->buf));
|
||||
|
||||
for (pos = htx_get_first(htx); pos != -1; pos = htx_get_next(htx, pos)) {
|
||||
|
Loading…
Reference in New Issue
Block a user