MINOR: opentracing: transfer of context names without prefix
authorMiroslav Zagorac <mzagorac@haproxy.com>
Wed, 14 Apr 2021 09:47:28 +0000 (11:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 15 Apr 2021 06:40:08 +0000 (08:40 +0200)
commita8bdf2b655d99bc11c8bfc1f09c0a69b6f6dc662
tree0abb397d0c69827d900f6f95f634102f7ae43579
parent4b3eb0a9408bacb0703bb6081c11ffa3d3a0d45e
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.
addons/ot/include/parser.h
addons/ot/src/http.c