Convenience wrapper for got to add opentracing spans to requests
npm install ot-got> Convenience wrapper for got to that adds opentracing spans to the request.
Copied then adapted for opentracing from gl-got
Assumes you already use opentracing-javascript in your project.
```
$ npm install --save ot-got
or
``
$ yarn add ot-got
with the exception of if you want to trace the requests, you must add a config, like so:`js
const otGot = require('ot-got');
otGot('https://your-microservice.io', {
tracingOptions: {
parentSpan: span,
injectHeaders: true
}
}).then(res => {
// response
});
`
Same as got (including the stream API and aliases), but with some additional options below.
Type: object
Shared config for all your tracing. See below for possible properties.
#### tracer
Type: Tracer
Default: globalTracer()
Can be set manually, but if not this will use the opentracing package globalTracer() function.
#### parentSpan
Type: Span
Passes in a span used as childOf ref to the span we create in ot-got for requests.
#### closeParentSpan
Type: booleanfalse
Default:
Wether you want the client do close the parent span or not
#### injectHeaders
Type: booleanfalse`
Default:
Wether you want the client to inject headers to the request or not. By doing this the service you are calling will be able to continue the trace.