kocolosk commented on a change in pull request #440: RFC-011 : Opentracing support URL: https://github.com/apache/couchdb-documentation/pull/440#discussion_r324860051
########## File path: rfcs/011-opentracing.md ########## @@ -0,0 +1,233 @@ +--- +name: Opentracing support +about: Adopt industry standard distributed tracing solution +title: 'Opentracing support' +labels: rfc, discussion +assignees: '' + +--- + +Adopt an industry standard vendor-neutral APIs and instrumentation for distributed tracing. + +# Introduction + +Collecting profiling data is very tricky at the moment. +Developers have to run generic profiling tools which are not aware of CouchDB specifics. +This makes it hard to do the performance optimization work. We need a tool which would +allow us to get profiling data from specific points in the codebase. +This means code instrumentation. + +## Abstract + +There is an https://opentracing.io/ project, which is a vendor-neutral APIs and instrumentation +for distributed tracing. In Erlang it is implemented by one of the following libraries: + - [otters](https://github.com/project-fifo/otters) extended and more performant version of `otter` + - [opentracing-erlang](https://github.com/opentracing-contrib/opentracing-erlang) `otter` version donated to opentracing project. + - [original otter](https://github.com/Bluehouse-Technology/otter) + - [passage](https://github.com/sile/jaeger_passage) + +The opentracing philosophy is founded on three pillars: +- Low overhead: the tracing system should have a negligible performance impact on running services. +- Application-level transparency: programmers should not need to be aware of the tracing system +- Scalability + +The main addition is to include one of the above mentioned libraries and add instrumentation points into the codebase. +In initial implementation, there would be a new span started on every HTTP request. +The following HTTP headers would be used to link tracing span with application specific traces. +- X-B3-ParentSpanId +- X-B3-TraceId +- b3 + +More information about the use of these headers can be found [here](https://github.com/openzipkin/b3-propagation). +Open tracing [specification](https://github.com/opentracing/specification/blob/master/specification.md) +has a number of [conventions](https://github.com/opentracing/specification/blob/master/semantic_conventions.md) +which would be good to follow. + +In a nutshell the idea is: +- Take the reference to Parent span from one of the supported header and pass it to `span_start` call. +- Construct action name to use in `span_start` call. +- Call `span_start` from `httpd:handle_request_int/1`. +- Pass span in `#httpd{}` record +- Pass `trace_id` and `parend_span_id` through the stack (extend records if needed) Review comment: `parent` not `parend` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services