Opentracing / zipkin headers support

This implements issue #287. It’s a very slim implementation that will imho fit most use-cases. Incoming headers are copied to the response. If there are no headers set, we’ll generate some and send them back. The X-B3-TraceId will be written to the logs (by default inside of the [%thread] marks).

This implementation makes it possible to correlate logged exceptions (in case this happens) with the corresponding request log, even when the thread handling the message is re-used shortly after.

It handles all headers mentioned in, as well as the uber-trace-id header that is used by Jaeger (see to get broader support.


metrics-gathering-level: metrics gathering for which level? OFF => no gathering, ROOT => gathering at root level, DATABASE => at db level, COLLECTION => at collection level WARNING: use requests-log-level level 2 only for development purposes, it logs user credentials (Authorization and Auth-Token headers).

Example restheart.yml fragment:

metrics-gathering-level: DATABASE
#  - x-b3-traceid      # vv Zipkin headers, see
#  - x-b3-spanid
#  - x-b3-parentspanid
#  - x-b3-sampled      # ^^
#  - uber-trace-id     # jaeger header, see
#  - traceparent       # vv headers, see
#  - tracestate        # ^^