@opentelemetry/instrumentation-http
Advanced tools
Comparing version 0.27.0 to 0.28.0
@@ -51,11 +51,11 @@ "use strict"; | ||
this._diag.debug(`Applying patch for http@${this._version}`); | ||
if (instrumentation_1.isWrapped(moduleExports.request)) { | ||
if ((0, instrumentation_1.isWrapped)(moduleExports.request)) { | ||
this._unwrap(moduleExports, 'request'); | ||
} | ||
this._wrap(moduleExports, 'request', this._getPatchOutgoingRequestFunction('http')); | ||
if (instrumentation_1.isWrapped(moduleExports.get)) { | ||
if ((0, instrumentation_1.isWrapped)(moduleExports.get)) { | ||
this._unwrap(moduleExports, 'get'); | ||
} | ||
this._wrap(moduleExports, 'get', this._getPatchOutgoingGetFunction(moduleExports.request)); | ||
if (instrumentation_1.isWrapped(moduleExports.Server.prototype.emit)) { | ||
if ((0, instrumentation_1.isWrapped)(moduleExports.Server.prototype.emit)) { | ||
this._unwrap(moduleExports.Server.prototype, 'emit'); | ||
@@ -77,11 +77,11 @@ } | ||
this._diag.debug(`Applying patch for https@${this._version}`); | ||
if (instrumentation_1.isWrapped(moduleExports.request)) { | ||
if ((0, instrumentation_1.isWrapped)(moduleExports.request)) { | ||
this._unwrap(moduleExports, 'request'); | ||
} | ||
this._wrap(moduleExports, 'request', this._getPatchHttpsOutgoingRequestFunction('https')); | ||
if (instrumentation_1.isWrapped(moduleExports.get)) { | ||
if ((0, instrumentation_1.isWrapped)(moduleExports.get)) { | ||
this._unwrap(moduleExports, 'get'); | ||
} | ||
this._wrap(moduleExports, 'get', this._getPatchHttpsOutgoingGetFunction(moduleExports.request)); | ||
if (instrumentation_1.isWrapped(moduleExports.Server.prototype.emit)) { | ||
if ((0, instrumentation_1.isWrapped)(moduleExports.Server.prototype.emit)) { | ||
this._unwrap(moduleExports.Server.prototype, 'emit'); | ||
@@ -203,7 +203,7 @@ } | ||
else { | ||
status = utils.parseResponseStatus(response.statusCode); | ||
status = { code: utils.parseResponseStatus(api_1.SpanKind.CLIENT, response.statusCode) }; | ||
} | ||
span.setStatus(status); | ||
if (this._getConfig().applyCustomAttributesOnSpan) { | ||
instrumentation_1.safeExecuteInTheMiddle(() => this._getConfig().applyCustomAttributesOnSpan(span, request, response), () => { }, true); | ||
(0, instrumentation_1.safeExecuteInTheMiddle)(() => this._getConfig().applyCustomAttributesOnSpan(span, request, response), () => { }, true); | ||
} | ||
@@ -214,3 +214,5 @@ this._closeHttpSpan(span); | ||
this._diag.debug('outgoingRequest on error()', error); | ||
utils.setSpanWithError(span, error, response); | ||
utils.setSpanWithError(span, error); | ||
const code = utils.parseResponseStatus(api_1.SpanKind.CLIENT, response.statusCode); | ||
span.setStatus({ code, message: error.message }); | ||
this._closeHttpSpan(span); | ||
@@ -227,3 +229,3 @@ }); | ||
this._diag.debug('outgoingRequest on request error()', error); | ||
utils.setSpanWithError(span, error, request); | ||
utils.setSpanWithError(span, error); | ||
this._closeHttpSpan(span); | ||
@@ -248,4 +250,9 @@ }); | ||
instrumentation._diag.debug(`${component} instrumentation incomingRequest`); | ||
if (utils.isIgnored(pathname, instrumentation._getConfig().ignoreIncomingPaths, (e) => instrumentation._diag.error('caught ignoreIncomingPaths error: ', e))) { | ||
return api_1.context.with(core_1.suppressTracing(api_1.context.active()), () => { | ||
if (utils.isIgnored(pathname, instrumentation._getConfig().ignoreIncomingPaths, (e) => instrumentation._diag.error('caught ignoreIncomingPaths error: ', e)) || | ||
(0, instrumentation_1.safeExecuteInTheMiddle)(() => { var _a, _b; return (_b = (_a = instrumentation._getConfig()).ignoreIncomingRequestHook) === null || _b === void 0 ? void 0 : _b.call(_a, request); }, (e) => { | ||
if (e != null) { | ||
instrumentation._diag.error('caught ignoreIncomingRequestHook error: ', e); | ||
} | ||
}, true)) { | ||
return api_1.context.with((0, core_1.suppressTracing)(api_1.context.active()), () => { | ||
api_1.context.bind(api_1.context.active(), request); | ||
@@ -271,3 +278,3 @@ api_1.context.bind(api_1.context.active(), response); | ||
}; | ||
return api_1.context.with(core_2.setRPCMetadata(api_1.trace.setSpan(ctx, span), rpcMetadata), () => { | ||
return api_1.context.with((0, core_2.setRPCMetadata)(api_1.trace.setSpan(ctx, span), rpcMetadata), () => { | ||
api_1.context.bind(api_1.context.active(), request); | ||
@@ -288,3 +295,3 @@ api_1.context.bind(api_1.context.active(), response); | ||
// Cannot pass args of type ResponseEndArgs, | ||
const returned = instrumentation_1.safeExecuteInTheMiddle(() => response.end.apply(this, arguments), error => { | ||
const returned = (0, instrumentation_1.safeExecuteInTheMiddle)(() => response.end.apply(this, arguments), error => { | ||
if (error) { | ||
@@ -300,5 +307,5 @@ utils.setSpanWithError(span, error); | ||
.setAttributes(attributes) | ||
.setStatus(utils.parseResponseStatus(response.statusCode)); | ||
.setStatus({ code: utils.parseResponseStatus(api_1.SpanKind.SERVER, response.statusCode) }); | ||
if (instrumentation._getConfig().applyCustomAttributesOnSpan) { | ||
instrumentation_1.safeExecuteInTheMiddle(() => instrumentation._getConfig().applyCustomAttributesOnSpan(span, request, response), () => { }, true); | ||
(0, instrumentation_1.safeExecuteInTheMiddle)(() => instrumentation._getConfig().applyCustomAttributesOnSpan(span, request, response), () => { }, true); | ||
} | ||
@@ -308,3 +315,3 @@ instrumentation._closeHttpSpan(span); | ||
}; | ||
return instrumentation_1.safeExecuteInTheMiddle(() => original.apply(this, [event, ...args]), error => { | ||
return (0, instrumentation_1.safeExecuteInTheMiddle)(() => original.apply(this, [event, ...args]), error => { | ||
if (error) { | ||
@@ -341,3 +348,8 @@ utils.setSpanWithError(span, error); | ||
} | ||
if (utils.isIgnored(origin + pathname, instrumentation._getConfig().ignoreOutgoingUrls, (e) => instrumentation._diag.error('caught ignoreOutgoingUrls error: ', e))) { | ||
if (utils.isIgnored(origin + pathname, instrumentation._getConfig().ignoreOutgoingUrls, (e) => instrumentation._diag.error('caught ignoreOutgoingUrls error: ', e)) || | ||
(0, instrumentation_1.safeExecuteInTheMiddle)(() => { var _a, _b; return (_b = (_a = instrumentation._getConfig()).ignoreOutgoingRequestHook) === null || _b === void 0 ? void 0 : _b.call(_a, optionsParsed); }, (e) => { | ||
if (e != null) { | ||
instrumentation._diag.error('caught ignoreOutgoingRequestHook error: ', e); | ||
} | ||
}, true)) { | ||
return original.apply(this, [optionsParsed, ...args]); | ||
@@ -374,3 +386,3 @@ } | ||
} | ||
const request = instrumentation_1.safeExecuteInTheMiddle(() => original.apply(this, [optionsParsed, ...args]), error => { | ||
const request = (0, instrumentation_1.safeExecuteInTheMiddle)(() => original.apply(this, [optionsParsed, ...args]), error => { | ||
if (error) { | ||
@@ -418,10 +430,10 @@ utils.setSpanWithError(span, error); | ||
_callResponseHook(span, response) { | ||
instrumentation_1.safeExecuteInTheMiddle(() => this._getConfig().responseHook(span, response), () => { }, true); | ||
(0, instrumentation_1.safeExecuteInTheMiddle)(() => this._getConfig().responseHook(span, response), () => { }, true); | ||
} | ||
_callRequestHook(span, request) { | ||
instrumentation_1.safeExecuteInTheMiddle(() => this._getConfig().requestHook(span, request), () => { }, true); | ||
(0, instrumentation_1.safeExecuteInTheMiddle)(() => this._getConfig().requestHook(span, request), () => { }, true); | ||
} | ||
_callStartSpanHook(request, hookFunc) { | ||
if (typeof hookFunc === 'function') { | ||
return instrumentation_1.safeExecuteInTheMiddle(() => hookFunc(request), () => { }, true); | ||
return (0, instrumentation_1.safeExecuteInTheMiddle)(() => hookFunc(request), () => { }, true); | ||
} | ||
@@ -428,0 +440,0 @@ } |
@@ -23,2 +23,8 @@ /// <reference types="node" /> | ||
} | ||
export interface IgnoreIncomingRequestFunction { | ||
(request: IncomingMessage): boolean; | ||
} | ||
export interface IgnoreOutgoingRequestFunction { | ||
(request: RequestOptions): boolean; | ||
} | ||
export interface HttpRequestCustomAttributeFunction { | ||
@@ -40,6 +46,16 @@ (span: Span, request: ClientRequest | IncomingMessage): void; | ||
export interface HttpInstrumentationConfig extends InstrumentationConfig { | ||
/** Not trace all incoming requests that match paths */ | ||
/** | ||
* Not trace all incoming requests that match paths | ||
* @deprecated use `ignoreIncomingRequestHook` instead | ||
*/ | ||
ignoreIncomingPaths?: IgnoreMatcher[]; | ||
/** Not trace all outgoing requests that match urls */ | ||
/** Not trace all incoming requests that matched with custom function */ | ||
ignoreIncomingRequestHook?: IgnoreIncomingRequestFunction; | ||
/** | ||
* Not trace all outgoing requests that match urls | ||
* @deprecated use `ignoreOutgoingRequestHook` instead | ||
*/ | ||
ignoreOutgoingUrls?: IgnoreMatcher[]; | ||
/** Not trace all outgoing requests that matched with custom function */ | ||
ignoreOutgoingRequestHook?: IgnoreOutgoingRequestFunction; | ||
/** Function for adding custom attributes after response is handled */ | ||
@@ -46,0 +62,0 @@ applyCustomAttributesOnSpan?: HttpCustomAttributeFunction; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="node" /> | ||
import { SpanAttributes, Span, SpanStatus } from '@opentelemetry/api'; | ||
import { ClientRequest, IncomingHttpHeaders, IncomingMessage, OutgoingHttpHeaders, RequestOptions, ServerResponse } from 'http'; | ||
import { SpanAttributes, SpanStatusCode, Span, SpanKind } from '@opentelemetry/api'; | ||
import { IncomingHttpHeaders, IncomingMessage, OutgoingHttpHeaders, RequestOptions, ServerResponse } from 'http'; | ||
import * as url from 'url'; | ||
@@ -13,9 +12,4 @@ import { Err, IgnoreMatcher, ParsedRequestOptions } from './types'; | ||
*/ | ||
export declare const parseResponseStatus: (statusCode: number | undefined) => Omit<SpanStatus, 'message'>; | ||
export declare const parseResponseStatus: (kind: SpanKind, statusCode?: number | undefined) => SpanStatusCode; | ||
/** | ||
* Returns whether the Expect header is on the given options object. | ||
* @param options Options for http.request. | ||
*/ | ||
export declare const hasExpectHeader: (options: RequestOptions) => boolean; | ||
/** | ||
* Check whether the given obj match pattern | ||
@@ -34,3 +28,3 @@ * @param constant e.g URL of request | ||
*/ | ||
export declare const isIgnored: (constant: string, list?: IgnoreMatcher[] | undefined, onException?: ((error: Error) => void) | undefined) => boolean; | ||
export declare const isIgnored: (constant: string, list?: IgnoreMatcher[] | undefined, onException?: ((error: unknown) => void) | undefined) => boolean; | ||
/** | ||
@@ -40,5 +34,4 @@ * Sets the span with the error passed in params | ||
* @param {Error} error error that will be set to span | ||
* @param {(IncomingMessage | ClientRequest)} [obj] used for enriching the status by checking the statusCode. | ||
*/ | ||
export declare const setSpanWithError: (span: Span, error: Err, obj?: IncomingMessage | ClientRequest | undefined) => void; | ||
export declare const setSpanWithError: (span: Span, error: Err) => void; | ||
/** | ||
@@ -45,0 +38,0 @@ * Adds attributes for request content-length and content-encoding HTTP headers |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.headerCapture = exports.getIncomingRequestAttributesOnResponse = exports.getIncomingRequestAttributes = exports.getOutgoingRequestAttributesOnResponse = exports.getAttributesFromHttpKind = exports.getOutgoingRequestAttributes = exports.isValidOptionsType = exports.getRequestInfo = exports.isCompressed = exports.setResponseContentLengthAttribute = exports.setRequestContentLengthAttribute = exports.setSpanWithError = exports.isIgnored = exports.satisfiesPattern = exports.hasExpectHeader = exports.parseResponseStatus = exports.getAbsoluteUrl = void 0; | ||
exports.headerCapture = exports.getIncomingRequestAttributesOnResponse = exports.getIncomingRequestAttributes = exports.getOutgoingRequestAttributesOnResponse = exports.getAttributesFromHttpKind = exports.getOutgoingRequestAttributes = exports.isValidOptionsType = exports.getRequestInfo = exports.isCompressed = exports.setResponseContentLengthAttribute = exports.setRequestContentLengthAttribute = exports.setSpanWithError = exports.isIgnored = exports.satisfiesPattern = exports.parseResponseStatus = exports.getAbsoluteUrl = void 0; | ||
/* | ||
@@ -47,27 +47,14 @@ * Copyright The OpenTelemetry Authors | ||
*/ | ||
const parseResponseStatus = (statusCode) => { | ||
if (statusCode === undefined) { | ||
return { code: api_1.SpanStatusCode.ERROR }; | ||
const parseResponseStatus = (kind, statusCode) => { | ||
const upperBound = kind === api_1.SpanKind.CLIENT ? 400 : 500; | ||
// 1xx, 2xx, 3xx are OK on client and server | ||
// 4xx is OK on server | ||
if (statusCode && statusCode >= 100 && statusCode < upperBound) { | ||
return api_1.SpanStatusCode.UNSET; | ||
} | ||
// 1xx, 2xx, 3xx are OK | ||
if (statusCode >= 100 && statusCode < 400) { | ||
return { code: api_1.SpanStatusCode.OK }; | ||
} | ||
// All other codes are error | ||
return { code: api_1.SpanStatusCode.ERROR }; | ||
return api_1.SpanStatusCode.ERROR; | ||
}; | ||
exports.parseResponseStatus = parseResponseStatus; | ||
/** | ||
* Returns whether the Expect header is on the given options object. | ||
* @param options Options for http.request. | ||
*/ | ||
const hasExpectHeader = (options) => { | ||
if (!options.headers) { | ||
return false; | ||
} | ||
const keys = Object.keys(options.headers); | ||
return !!keys.find(key => key.toLowerCase() === 'expect'); | ||
}; | ||
exports.hasExpectHeader = hasExpectHeader; | ||
/** | ||
* Check whether the given obj match pattern | ||
@@ -108,3 +95,3 @@ * @param constant e.g URL of request | ||
for (const pattern of list) { | ||
if (exports.satisfiesPattern(constant, pattern)) { | ||
if ((0, exports.satisfiesPattern)(constant, pattern)) { | ||
return true; | ||
@@ -126,5 +113,4 @@ } | ||
* @param {Error} error error that will be set to span | ||
* @param {(IncomingMessage | ClientRequest)} [obj] used for enriching the status by checking the statusCode. | ||
*/ | ||
const setSpanWithError = (span, error, obj) => { | ||
const setSpanWithError = (span, error) => { | ||
const message = error.message; | ||
@@ -135,18 +121,3 @@ span.setAttributes({ | ||
}); | ||
if (!obj) { | ||
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message }); | ||
return; | ||
} | ||
let status; | ||
if (obj.statusCode) { | ||
status = exports.parseResponseStatus(obj.statusCode); | ||
} | ||
else if (obj.aborted) { | ||
status = { code: api_1.SpanStatusCode.ERROR }; | ||
} | ||
else { | ||
status = { code: api_1.SpanStatusCode.ERROR }; | ||
} | ||
status.message = message; | ||
span.setStatus(status); | ||
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message }); | ||
}; | ||
@@ -163,3 +134,3 @@ exports.setSpanWithError = setSpanWithError; | ||
return; | ||
if (exports.isCompressed(request.headers)) { | ||
if ((0, exports.isCompressed)(request.headers)) { | ||
attributes[semantic_conventions_1.SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH] = length; | ||
@@ -181,3 +152,3 @@ } | ||
return; | ||
if (exports.isCompressed(response.headers)) { | ||
if ((0, exports.isCompressed)(response.headers)) { | ||
attributes[semantic_conventions_1.SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH] = length; | ||
@@ -211,2 +182,3 @@ } | ||
const getRequestInfo = (options, extraOptions) => { | ||
var _a; | ||
let pathname = '/'; | ||
@@ -251,8 +223,7 @@ let origin = ''; | ||
} | ||
if (exports.hasExpectHeader(optionsParsed)) { | ||
optionsParsed.headers = Object.assign({}, optionsParsed.headers); | ||
} | ||
else if (!optionsParsed.headers) { | ||
optionsParsed.headers = {}; | ||
} | ||
const headers = (_a = optionsParsed.headers) !== null && _a !== void 0 ? _a : {}; | ||
optionsParsed.headers = Object.keys(headers).reduce((normalizedHeader, key) => { | ||
normalizedHeader[key.toLowerCase()] = headers[key]; | ||
return normalizedHeader; | ||
}, {}); | ||
// some packages return method in lowercase.. | ||
@@ -263,3 +234,3 @@ // ensure upperCase for consistency | ||
: 'GET'; | ||
return { origin, pathname, method, optionsParsed }; | ||
return { origin, pathname, method, optionsParsed, }; | ||
}; | ||
@@ -294,3 +265,3 @@ exports.getRequestInfo = getRequestInfo; | ||
const attributes = { | ||
[semantic_conventions_1.SemanticAttributes.HTTP_URL]: exports.getAbsoluteUrl(requestOptions, headers, `${options.component}:`), | ||
[semantic_conventions_1.SemanticAttributes.HTTP_URL]: (0, exports.getAbsoluteUrl)(requestOptions, headers, `${options.component}:`), | ||
[semantic_conventions_1.SemanticAttributes.HTTP_METHOD]: method, | ||
@@ -337,3 +308,3 @@ [semantic_conventions_1.SemanticAttributes.HTTP_TARGET]: requestOptions.path || '/', | ||
}; | ||
exports.setResponseContentLengthAttribute(response, attributes); | ||
(0, exports.setResponseContentLengthAttribute)(response, attributes); | ||
if (statusCode) { | ||
@@ -343,3 +314,3 @@ attributes[semantic_conventions_1.SemanticAttributes.HTTP_STATUS_CODE] = statusCode; | ||
} | ||
const httpKindAttributes = exports.getAttributesFromHttpKind(httpVersion); | ||
const httpKindAttributes = (0, exports.getAttributesFromHttpKind)(httpVersion); | ||
return Object.assign(attributes, httpKindAttributes); | ||
@@ -366,3 +337,3 @@ }; | ||
const attributes = { | ||
[semantic_conventions_1.SemanticAttributes.HTTP_URL]: exports.getAbsoluteUrl(requestUrl, headers, `${options.component}:`), | ||
[semantic_conventions_1.SemanticAttributes.HTTP_URL]: (0, exports.getAbsoluteUrl)(requestUrl, headers, `${options.component}:`), | ||
[semantic_conventions_1.SemanticAttributes.HTTP_HOST]: host, | ||
@@ -384,4 +355,4 @@ [semantic_conventions_1.SemanticAttributes.NET_HOST_NAME]: hostname, | ||
} | ||
exports.setRequestContentLengthAttribute(request, attributes); | ||
const httpKindAttributes = exports.getAttributesFromHttpKind(httpVersion); | ||
(0, exports.setRequestContentLengthAttribute)(request, attributes); | ||
const httpKindAttributes = (0, exports.getAttributesFromHttpKind)(httpVersion); | ||
return Object.assign(attributes, httpKindAttributes, options.hookAttributes); | ||
@@ -400,3 +371,3 @@ }; | ||
const { localAddress, localPort, remoteAddress, remotePort } = socket; | ||
const rpcMetadata = core_1.getRPCMetadata(api_1.context.active()); | ||
const rpcMetadata = (0, core_1.getRPCMetadata)(api_1.context.active()); | ||
const attributes = { | ||
@@ -403,0 +374,0 @@ [semantic_conventions_1.SemanticAttributes.NET_HOST_IP]: localAddress, |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.27.0"; | ||
export declare const VERSION = "0.28.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.27.0'; | ||
exports.VERSION = '0.28.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-http", | ||
"version": "0.27.0", | ||
"version": "0.28.0", | ||
"description": "OpenTelemetry http/https automatic instrumentation package.", | ||
@@ -9,2 +9,3 @@ "main": "build/src/index.js", | ||
"scripts": { | ||
"prepublishOnly": "npm run compile", | ||
"compile": "tsc --build", | ||
@@ -16,7 +17,8 @@ "clean": "tsc --build --clean", | ||
"lint:fix": "eslint . --ext .ts --fix", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", | ||
"version": "node ../../../scripts/version-update.js", | ||
"watch": "tsc --build --watch", | ||
"precompile": "lerna run version --scope $(npm pkg get name) --include-filtered-dependencies", | ||
"prewatch": "node ../../../scripts/version-update.js" | ||
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", | ||
"prewatch": "node ../../../scripts/version-update.js", | ||
"peer-api-check": "node ../../../scripts/peer-api-check.js" | ||
}, | ||
@@ -34,3 +36,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=8.12.0" | ||
}, | ||
@@ -49,18 +51,18 @@ "files": [ | ||
"devDependencies": { | ||
"@opentelemetry/api": "^1.0.3", | ||
"@opentelemetry/context-async-hooks": "1.0.1", | ||
"@opentelemetry/sdk-trace-base": "1.0.1", | ||
"@opentelemetry/sdk-trace-node": "1.0.1", | ||
"@opentelemetry/api": "^1.0.0", | ||
"@opentelemetry/context-async-hooks": "1.2.0", | ||
"@opentelemetry/sdk-trace-base": "1.2.0", | ||
"@opentelemetry/sdk-trace-node": "1.2.0", | ||
"@types/got": "9.6.12", | ||
"@types/mocha": "8.2.3", | ||
"@types/node": "14.17.11", | ||
"@types/node": "14.17.33", | ||
"@types/request-promise-native": "1.0.18", | ||
"@types/semver": "7.3.8", | ||
"@types/sinon": "10.0.2", | ||
"@types/superagent": "4.1.12", | ||
"axios": "0.21.1", | ||
"@types/semver": "7.3.9", | ||
"@types/sinon": "10.0.6", | ||
"@types/superagent": "4.1.13", | ||
"axios": "0.24.0", | ||
"codecov": "3.8.3", | ||
"got": "9.6.0", | ||
"mocha": "7.2.0", | ||
"nock": "12.0.3", | ||
"nock": "13.0.11", | ||
"nyc": "15.1.0", | ||
@@ -73,3 +75,3 @@ "request": "2.88.2", | ||
"ts-mocha": "8.0.0", | ||
"typescript": "4.3.5" | ||
"typescript": "4.4.4" | ||
}, | ||
@@ -80,8 +82,8 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@opentelemetry/core": "1.0.1", | ||
"@opentelemetry/instrumentation": "0.27.0", | ||
"@opentelemetry/semantic-conventions": "1.0.1", | ||
"@opentelemetry/core": "1.2.0", | ||
"@opentelemetry/instrumentation": "0.28.0", | ||
"@opentelemetry/semantic-conventions": "1.2.0", | ||
"semver": "^7.3.5" | ||
}, | ||
"gitHead": "f5e227f0cb829df1ca2dc220a3e0e8ae0e607405" | ||
"gitHead": "a0a670a03fd35b0799bee8cc466f79e93b5b6dd2" | ||
} |
# OpenTelemetry HTTP and HTTPS Instrumentation for Node.js | ||
[![NPM Published Version][npm-img]][npm-url] | ||
[![dependencies][dependencies-image]][dependencies-url] | ||
[![devDependencies][devDependencies-image]][devDependencies-url] | ||
[![Apache License][license-image]][license-image] | ||
@@ -55,4 +53,4 @@ | ||
| [`startOutgoingSpanHook`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-http/src/types.ts#L99) | `StartOutgoingSpanCustomAttributeFunction` | Function for adding custom attributes before a span is started in outgoingRequest | | ||
| [`ignoreIncomingPaths`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-http/src/types.ts#L87) | `IgnoreMatcher[]` | Http instrumentation will not trace all incoming requests that match paths | | ||
| [`ignoreOutgoingUrls`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-http/src/types.ts#L89) | `IgnoreMatcher[]` | Http instrumentation will not trace all outgoing requests that match urls | | ||
| `ignoreIncomingRequestHook` | `IgnoreIncomingRequestFunction` | Http instrumentation will not trace all incoming requests that matched with custom function | | ||
| `ignoreOutgoingRequestHook` | `IgnoreOutgoingRequestFunction` | Http instrumentation will not trace all outgoing requests that matched with custom function | | ||
| [`serverName`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-http/src/types.ts#L101) | `string` | The primary server name of the matched virtual host. | | ||
@@ -63,2 +61,9 @@ | [`requireParentforOutgoingSpans`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-http/src/types.ts#L103) | Boolean | Require that is a parent span to create new span for outgoing requests. | | ||
The following options are deprecated: | ||
| Options | Type | Description | | ||
| ------- | ---- | ----------- | | ||
| `ignoreIncomingPaths` | `IgnoreMatcher[]` | Http instrumentation will not trace all incoming requests that match paths | | ||
| `ignoreOutgoingUrls` | `IgnoreMatcher[]` | Http instrumentation will not trace all outgoing requests that match urls | | ||
## Useful links | ||
@@ -77,7 +82,3 @@ | ||
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat | ||
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-instrumentation-http | ||
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-instrumentation-http | ||
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-instrumentation-http&type=dev | ||
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-instrumentation-http&type=dev | ||
[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-http | ||
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-http.svg |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152872
82
1174
+ Added@opentelemetry/api@1.1.0(transitive)
+ Added@opentelemetry/api-metrics@0.28.0(transitive)
+ Added@opentelemetry/core@1.2.0(transitive)
+ Added@opentelemetry/instrumentation@0.28.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.2.0(transitive)
- Removed@opentelemetry/api@1.0.4(transitive)
- Removed@opentelemetry/api-metrics@0.27.0(transitive)
- Removed@opentelemetry/core@1.0.1(transitive)
- Removed@opentelemetry/instrumentation@0.27.0(transitive)
- Removed@opentelemetry/semantic-conventions@1.0.1(transitive)
Updated@opentelemetry/core@1.2.0