🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

ot-got

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ot-got

Convenience wrapper for got to add opentracing spans to requests

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

ot-got Build Status Coverage Status install size

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.

Screenshot

Example trace with Jaeger

Install

$ npm install --save ot-got

or

$ yarn add ot-got

Usage

This package can be used like you would use normal got with the exception of if you want to trace the requests, you must add a config, like so:

const otGot = require('ot-got');

otGot('https://your-microservice.io', {
  tracingOptions: {
    parentSpan: span,
    injectHeaders: true
  }
}).then(res => {
	// response
});

API

Same as got (including the stream API and aliases), but with some additional options below.

tracingOptions

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: boolean Default: false

Wether you want the client do close the parent span or not

injectHeaders

Type: boolean Default: false

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.

License

MIT © Sindre Sorhus © Fredrik Pettersen

Keywords

http

FAQs

Package last updated on 23 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts