@opentelemetry/instrumentation-http 0.222.0 → 0.300.0-development.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +0 -2
  2. package/dist/_virtual/_rolldown/runtime.mjs +5 -0
  3. package/dist/http.cjs +425 -0
  4. package/dist/http.cjs.map +1 -0
  5. package/dist/http.d.cts +61 -0
  6. package/dist/http.d.cts.map +1 -0
  7. package/dist/http.d.mts +61 -0
  8. package/dist/http.d.mts.map +1 -0
  9. package/dist/http.mjs +425 -0
  10. package/dist/http.mjs.map +1 -0
  11. package/dist/index.cjs +3 -0
  12. package/dist/index.d.cts +3 -0
  13. package/dist/index.d.mts +3 -0
  14. package/dist/index.mjs +2 -0
  15. package/dist/internal-types.cjs +32 -0
  16. package/dist/internal-types.cjs.map +1 -0
  17. package/dist/internal-types.mjs +29 -0
  18. package/dist/internal-types.mjs.map +1 -0
  19. package/dist/semconv.cjs +18 -0
  20. package/dist/semconv.cjs.map +1 -0
  21. package/dist/semconv.mjs +17 -0
  22. package/dist/semconv.mjs.map +1 -0
  23. package/dist/types.d.cts +112 -0
  24. package/dist/types.d.cts.map +1 -0
  25. package/dist/types.d.mts +112 -0
  26. package/dist/types.d.mts.map +1 -0
  27. package/dist/utils.cjs +486 -0
  28. package/dist/utils.cjs.map +1 -0
  29. package/dist/utils.mjs +471 -0
  30. package/dist/utils.mjs.map +1 -0
  31. package/dist/version.cjs +6 -0
  32. package/dist/version.cjs.map +1 -0
  33. package/dist/version.mjs +6 -0
  34. package/dist/version.mjs.map +1 -0
  35. package/package.json +31 -21
  36. package/build/src/http.d.ts +0 -61
  37. package/build/src/http.js +0 -562
  38. package/build/src/http.js.map +0 -1
  39. package/build/src/index.d.ts +0 -3
  40. package/build/src/index.js +0 -10
  41. package/build/src/index.js.map +0 -1
  42. package/build/src/internal-types.d.ts +0 -42
  43. package/build/src/internal-types.js +0 -32
  44. package/build/src/internal-types.js.map +0 -1
  45. package/build/src/semconv.d.ts +0 -17
  46. package/build/src/semconv.js +0 -29
  47. package/build/src/semconv.js.map +0 -1
  48. package/build/src/types.d.ts +0 -115
  49. package/build/src/types.js +0 -3
  50. package/build/src/types.js.map +0 -1
  51. package/build/src/utils.d.ts +0 -105
  52. package/build/src/utils.js +0 -655
  53. package/build/src/utils.js.map +0 -1
  54. package/build/src/version.d.ts +0 -2
  55. package/build/src/version.js +0 -10
  56. package/build/src/version.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,4CAS4B;AAE5B,8CAO6B;AAI7B,2BAA2B;AAE3B,uCAAoC;AACpC,oEAIwC;AACxC,mCAAsC;AACtC,8EAW6C;AAC7C,mCAaiB;AAEjB,qDAAmE;AAEnE;;GAEG;AACH,MAAa,mBAAoB,SAAQ,qCAA8C;IACrF,oCAAoC;IACnB,aAAa,GAAkB,IAAI,OAAO,EAAQ,CAAC;IAC5D,cAAc,CAAC;IACf,YAAY,GAAY,KAAK,CAAC;IAC9B,aAAa,GAAY,KAAK,CAAC;IAIvC,YAAY,SAAoC,EAAE;QAChD,KAAK,CAAC,qCAAqC,EAAE,iBAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;IACpD,CAAC;IAEkB,wBAAwB;QACzC,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAC5D,0DAAmC,EACnC;YACE,WAAW,EAAE,mCAAmC;YAChD,IAAI,EAAE,GAAG;YACT,SAAS,EAAE,eAAS,CAAC,MAAM;YAC3B,MAAM,EAAE;gBACN,wBAAwB,EAAE;oBACxB,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,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AAC,EAClD,GAAG,EAAE,GAAE,CAAC,EACR,IAAI,CACL,CAAC;IACJ,CAAC;IAEO,kBAAkB,CACxB,OAAmD,EACnD,QAA8B;QAE9B,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAClC,OAAO,IAAA,wCAAsB,EAC3B,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EACvB,GAAG,EAAE,GAAE,CAAC,EACR,IAAI,CACL,CAAC;SACH;IACH,CAAC;IAEO,oBAAoB;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAEhC,OAAO;YACL,MAAM,EAAE;gBACN,qBAAqB,EAAE,IAAA,qBAAa,EAClC,SAAS,EACT,MAAM,CAAC,uBAAuB,EAAE,MAAM,EAAE,cAAc,IAAI,EAAE,CAC7D;gBACD,sBAAsB,EAAE,IAAA,qBAAa,EACnC,UAAU,EACV,MAAM,CAAC,uBAAuB,EAAE,MAAM,EAAE,eAAe,IAAI,EAAE,CAC9D;aACF;YACD,MAAM,EAAE;gBACN,qBAAqB,EAAE,IAAA,qBAAa,EAClC,SAAS,EACT,MAAM,CAAC,uBAAuB,EAAE,MAAM,EAAE,cAAc,IAAI,EAAE,CAC7D;gBACD,sBAAsB,EAAE,IAAA,qBAAa,EACnC,UAAU,EACV,MAAM,CAAC,uBAAuB,EAAE,MAAM,EAAE,eAAe,IAAI,EAAE,CAC9D;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAr4BD,kDAq4BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n HrTime,\n Span,\n SpanOptions,\n SpanStatus,\n Histogram,\n Attributes,\n} from '@opentelemetry/api';\nimport {\n context,\n INVALID_SPAN_CONTEXT,\n propagation,\n ROOT_CONTEXT,\n SpanKind,\n SpanStatusCode,\n trace,\n ValueType,\n} from '@opentelemetry/api';\nimport type { RPCMetadata } from '@opentelemetry/core';\nimport {\n hrTime,\n hrTimeDuration,\n hrTimeToMilliseconds,\n suppressTracing,\n RPCType,\n setRPCMetadata,\n} from '@opentelemetry/core';\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport type { Socket } from 'net';\nimport * as url from 'url';\nimport type { HttpInstrumentationConfig } from './types';\nimport { VERSION } from './version';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport { errorMonitor } from 'events';\nimport {\n ATTR_ERROR_TYPE,\n ATTR_HTTP_REQUEST_METHOD,\n ATTR_HTTP_RESPONSE_STATUS_CODE,\n ATTR_NETWORK_PROTOCOL_VERSION,\n ATTR_HTTP_ROUTE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n ATTR_URL_SCHEME,\n METRIC_HTTP_CLIENT_REQUEST_DURATION,\n METRIC_HTTP_SERVER_REQUEST_DURATION,\n} from '@opentelemetry/semantic-conventions';\nimport {\n extractHostnameAndPort,\n getIncomingRequestAttributes,\n getIncomingRequestAttributesOnResponse,\n getIncomingStableRequestMetricAttributesOnResponse,\n getOutgoingRequestAttributes,\n getOutgoingRequestAttributesOnResponse,\n getOutgoingStableRequestMetricAttributesOnResponse,\n getRequestInfo,\n headerCapture,\n isValidOptionsType,\n parseResponseStatus,\n setSpanWithError,\n} from './utils';\nimport type { Err, Func, Http, HttpRequestArgs, Https } from './internal-types';\nimport { DEFAULT_QUERY_STRINGS_TO_REDACT } from './internal-types';\n\n/**\n * `node:http` and `node:https` instrumentation for OpenTelemetry\n */\nexport class HttpInstrumentation extends InstrumentationBase<HttpInstrumentationConfig> {\n /** keep track on spans not ended */\n private readonly _spanNotEnded: WeakSet<Span> = new WeakSet<Span>();\n private _headerCapture;\n private _httpPatched: boolean = false;\n private _httpsPatched: boolean = false;\n declare private _httpServerDurationHistogram: Histogram;\n declare private _httpClientDurationHistogram: Histogram;\n\n constructor(config: HttpInstrumentationConfig = {}) {\n super('@opentelemetry/instrumentation-http', VERSION, config);\n this._headerCapture = this._createHeaderCapture();\n }\n\n protected override _updateMetricInstruments() {\n this._httpServerDurationHistogram = this.meter.createHistogram(\n METRIC_HTTP_SERVER_REQUEST_DURATION,\n {\n description: 'Duration of HTTP server requests.',\n unit: 's',\n valueType: ValueType.DOUBLE,\n advice: {\n explicitBucketBoundaries: [\n 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5,\n 7.5, 10,\n ],\n },\n }\n );\n this._httpClientDurationHistogram = this.meter.createHistogram(\n METRIC_HTTP_CLIENT_REQUEST_DURATION,\n {\n description: 'Duration of HTTP client requests.',\n unit: 's',\n valueType: ValueType.DOUBLE,\n advice: {\n explicitBucketBoundaries: [\n 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5,\n 7.5, 10,\n ],\n },\n }\n );\n }\n\n private _recordServerDuration(durationMs: number, attributes: Attributes) {\n // stable histogram is counted in S\n this._httpServerDurationHistogram.record(durationMs / 1000, attributes);\n }\n\n private _recordClientDuration(durationMs: number, attributes: Attributes) {\n // stable histogram is counted in S\n this._httpClientDurationHistogram.record(durationMs / 1000, attributes);\n }\n\n override setConfig(config: HttpInstrumentationConfig = {}): void {\n super.setConfig(config);\n this._headerCapture = this._createHeaderCapture();\n }\n\n init(): [\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleDefinition,\n ] {\n return [this._getHttpsInstrumentation(), this._getHttpInstrumentation()];\n }\n\n private _getHttpInstrumentation() {\n return new InstrumentationNodeModuleDefinition(\n 'http',\n ['*'],\n (moduleExports: Http): Http => {\n // Guard against double-instrumentation, if loaded by both `require`\n // and `import`.\n if (this._httpPatched) {\n return moduleExports;\n }\n this._httpPatched = true;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const isESM = (moduleExports as any)[Symbol.toStringTag] === 'Module';\n\n if (!this.getConfig().disableOutgoingRequestInstrumentation) {\n const patchedRequest = this._wrap(\n moduleExports,\n 'request',\n this._getPatchOutgoingRequestFunction('http')\n ) as unknown as Func<http.ClientRequest>;\n const patchedGet = this._wrap(\n moduleExports,\n 'get',\n this._getPatchOutgoingGetFunction(patchedRequest)\n );\n if (isESM) {\n // To handle `import http from 'http'`, which returns the default\n // export, we need to set `module.default.*`.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (moduleExports as any).default.request = patchedRequest;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (moduleExports as any).default.get = patchedGet;\n }\n }\n if (!this.getConfig().disableIncomingRequestInstrumentation) {\n this._wrap(\n moduleExports.Server.prototype,\n 'emit',\n this._getPatchIncomingRequestFunction('http')\n );\n }\n return moduleExports;\n },\n (moduleExports: Http) => {\n this._httpPatched = false;\n if (moduleExports === undefined) return;\n\n if (!this.getConfig().disableOutgoingRequestInstrumentation) {\n this._unwrap(moduleExports, 'request');\n this._unwrap(moduleExports, 'get');\n }\n if (!this.getConfig().disableIncomingRequestInstrumentation) {\n this._unwrap(moduleExports.Server.prototype, 'emit');\n }\n }\n );\n }\n\n private _getHttpsInstrumentation() {\n return new InstrumentationNodeModuleDefinition(\n 'https',\n ['*'],\n (moduleExports: Https): Https => {\n // Guard against double-instrumentation, if loaded by both `require`\n // and `import`.\n if (this._httpsPatched) {\n return moduleExports;\n }\n this._httpsPatched = true;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const isESM = (moduleExports as any)[Symbol.toStringTag] === 'Module';\n\n if (!this.getConfig().disableOutgoingRequestInstrumentation) {\n const patchedRequest = this._wrap(\n moduleExports,\n 'request',\n this._getPatchHttpsOutgoingRequestFunction('https')\n ) as unknown as Func<http.ClientRequest>;\n const patchedGet = this._wrap(\n moduleExports,\n 'get',\n this._getPatchHttpsOutgoingGetFunction(patchedRequest)\n );\n if (isESM) {\n // To handle `import https from 'https'`, which returns the default\n // export, we need to set `module.default.*`.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (moduleExports as any).default.request = patchedRequest;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (moduleExports as any).default.get = patchedGet;\n }\n }\n if (!this.getConfig().disableIncomingRequestInstrumentation) {\n this._wrap(\n moduleExports.Server.prototype,\n 'emit',\n this._getPatchIncomingRequestFunction('https')\n );\n }\n return moduleExports;\n },\n (moduleExports: Https) => {\n this._httpsPatched = false;\n if (moduleExports === undefined) return;\n\n if (!this.getConfig().disableOutgoingRequestInstrumentation) {\n this._unwrap(moduleExports, 'request');\n this._unwrap(moduleExports, 'get');\n }\n if (!this.getConfig().disableIncomingRequestInstrumentation) {\n this._unwrap(moduleExports.Server.prototype, 'emit');\n }\n }\n );\n }\n\n /**\n * Creates spans for incoming requests, restoring spans' context if applied.\n */\n private _getPatchIncomingRequestFunction(component: 'http' | 'https') {\n return (\n original: (event: string, ...args: unknown[]) => boolean\n ): ((this: unknown, event: string, ...args: unknown[]) => boolean) => {\n return this._incomingRequestFunction(component, original);\n };\n }\n\n /**\n * Creates spans for outgoing requests, sending spans' context for distributed\n * tracing.\n */\n private _getPatchOutgoingRequestFunction(component: 'http' | 'https') {\n return (original: Func<http.ClientRequest>): Func<http.ClientRequest> => {\n return this._outgoingRequestFunction(component, original);\n };\n }\n\n private _getPatchOutgoingGetFunction(\n clientRequest: (\n options: http.RequestOptions | string | url.URL,\n ...args: HttpRequestArgs\n ) => http.ClientRequest\n ) {\n return (_original: Func<http.ClientRequest>): Func<http.ClientRequest> => {\n // Re-implement http.get. This needs to be done (instead of using\n // getPatchOutgoingRequestFunction to patch it) because we need to\n // set the trace context header before the returned http.ClientRequest is\n // ended. The Node.js docs state that the only differences between\n // request and get are that (1) get defaults to the HTTP GET method and\n // (2) the returned request object is ended immediately. The former is\n // already true (at least in supported Node versions up to v10), so we\n // simply follow the latter. Ref:\n // https://nodejs.org/dist/latest/docs/api/http.html#http_http_get_options_callback\n // https://github.com/googleapis/cloud-trace-nodejs/blob/master/src/instrumentations/instrumentation-http.ts#L198\n return function outgoingGetRequest<\n T extends http.RequestOptions | string | url.URL,\n >(options: T, ...args: HttpRequestArgs): http.ClientRequest {\n const req = clientRequest(options, ...args);\n req.end();\n return req;\n };\n };\n }\n\n /** Patches HTTPS outgoing requests */\n private _getPatchHttpsOutgoingRequestFunction(component: 'http' | 'https') {\n return (original: Func<http.ClientRequest>): Func<http.ClientRequest> => {\n const instrumentation = this;\n return function httpsOutgoingRequest(\n options: https.RequestOptions | string | URL,\n ...args: HttpRequestArgs\n ): http.ClientRequest {\n // Makes sure options will have default HTTPS parameters\n if (\n component === 'https' &&\n typeof options === 'object' &&\n options?.constructor?.name !== 'URL'\n ) {\n options = Object.assign({}, options);\n instrumentation._setDefaultOptions(options);\n }\n return instrumentation._getPatchOutgoingRequestFunction(component)(\n original\n )(options, ...args);\n };\n };\n }\n\n private _setDefaultOptions(options: https.RequestOptions) {\n options.protocol = options.protocol || 'https:';\n options.port = options.port || 443;\n }\n\n /** Patches HTTPS outgoing get requests */\n private _getPatchHttpsOutgoingGetFunction(\n clientRequest: (\n options: http.RequestOptions | string | URL,\n ...args: HttpRequestArgs\n ) => http.ClientRequest\n ) {\n return (original: Func<http.ClientRequest>): Func<http.ClientRequest> => {\n const instrumentation = this;\n return function httpsOutgoingRequest(\n options: https.RequestOptions | string | URL,\n ...args: HttpRequestArgs\n ): http.ClientRequest {\n return instrumentation._getPatchOutgoingGetFunction(clientRequest)(\n original\n )(options, ...args);\n };\n };\n }\n\n /**\n * Attach event listeners to a client request to end span and add span attributes.\n *\n * @param request The original request object.\n * @param span representing the current operation\n * @param startTime representing the start time of the request to calculate duration in Metric\n * @param metricAttributes metric attributes for the request duration metric\n */\n private _traceClientRequest(\n request: http.ClientRequest,\n span: Span,\n startTime: HrTime,\n metricAttributes: Attributes\n ): http.ClientRequest {\n if (this.getConfig().requestHook) {\n this._callRequestHook(span, request);\n }\n\n /**\n * Determines if the request has errored or the response has ended/errored.\n */\n let responseFinished = false;\n\n /*\n * User 'response' event listeners can be added before our listener,\n * force our listener to be the first, so response emitter is bound\n * before any user listeners are added to it.\n */\n request.prependListener(\n 'response',\n (response: http.IncomingMessage & { aborted?: boolean }) => {\n this._diag.debug('outgoingRequest on response()');\n if (request.listenerCount('response') <= 1) {\n response.resume();\n }\n const responseAttributes =\n getOutgoingRequestAttributesOnResponse(response);\n span.setAttributes(responseAttributes);\n metricAttributes = Object.assign(\n metricAttributes,\n getOutgoingStableRequestMetricAttributesOnResponse(responseAttributes)\n );\n\n if (this.getConfig().responseHook) {\n this._callResponseHook(span, response);\n }\n\n span.setAttributes(\n this._headerCapture.client.captureRequestHeaders(header =>\n request.getHeader(header)\n )\n );\n span.setAttributes(\n this._headerCapture.client.captureResponseHeaders(\n header => response.headers[header]\n )\n );\n\n context.bind(context.active(), response);\n\n const endHandler = () => {\n this._diag.debug('outgoingRequest on end()');\n if (responseFinished) {\n return;\n }\n responseFinished = true;\n let status: SpanStatus;\n\n if (response.aborted && !response.complete) {\n status = { code: SpanStatusCode.ERROR };\n } else {\n // behaves same for new and old semconv\n status = {\n code: parseResponseStatus(SpanKind.CLIENT, response.statusCode),\n };\n }\n\n span.setStatus(status);\n\n if (this.getConfig().applyCustomAttributesOnSpan) {\n safeExecuteInTheMiddle(\n () =>\n this.getConfig().applyCustomAttributesOnSpan!(\n span,\n request,\n response\n ),\n () => {},\n true\n );\n }\n\n this._closeHttpSpan(\n span,\n SpanKind.CLIENT,\n startTime,\n metricAttributes\n );\n };\n\n response.on('end', endHandler);\n response.on(errorMonitor, (error: Err) => {\n this._diag.debug('outgoingRequest on error()', error);\n if (responseFinished) {\n return;\n }\n responseFinished = true;\n this._onOutgoingRequestError(\n span,\n metricAttributes,\n startTime,\n error\n );\n });\n }\n );\n request.on('close', () => {\n this._diag.debug('outgoingRequest on request close()');\n if (request.aborted || responseFinished) {\n return;\n }\n responseFinished = true;\n this._closeHttpSpan(span, SpanKind.CLIENT, startTime, metricAttributes);\n });\n request.on(errorMonitor, (error: Err) => {\n this._diag.debug('outgoingRequest on request error()', error);\n if (responseFinished) {\n return;\n }\n responseFinished = true;\n this._onOutgoingRequestError(span, metricAttributes, startTime, error);\n });\n\n this._diag.debug('http.ClientRequest return request');\n return request;\n }\n\n private _incomingRequestFunction(\n component: 'http' | 'https',\n original: (event: string, ...args: unknown[]) => boolean\n ) {\n const instrumentation = this;\n return function incomingRequest(\n this: unknown,\n event: string,\n ...args: unknown[]\n ): boolean {\n // Only traces request events\n if (event !== 'request') {\n return original.apply(this, [event, ...args]);\n }\n\n const request = args[0] as http.IncomingMessage;\n const response = args[1] as http.ServerResponse & { socket: Socket };\n const method = request.method || 'GET';\n\n instrumentation._diag.debug(\n `${component} instrumentation incomingRequest`\n );\n\n if (\n safeExecuteInTheMiddle(\n () =>\n instrumentation.getConfig().ignoreIncomingRequestHook?.(request),\n (e: unknown) => {\n if (e != null) {\n instrumentation._diag.error(\n 'caught ignoreIncomingRequestHook error: ',\n e\n );\n }\n },\n true\n )\n ) {\n return context.with(suppressTracing(context.active()), () => {\n context.bind(context.active(), request);\n context.bind(context.active(), response);\n return original.apply(this, [event, ...args]);\n });\n }\n\n const headers = request.headers;\n\n const spanAttributes = getIncomingRequestAttributes(\n request,\n {\n component: component,\n hookAttributes: instrumentation._callStartSpanHook(\n request,\n instrumentation.getConfig().startIncomingSpanHook\n ),\n enableSyntheticSourceDetection:\n instrumentation.getConfig().enableSyntheticSourceDetection || false,\n redactedQueryParams:\n instrumentation.getConfig().redactedQueryParamsServer ??\n Array.from(DEFAULT_QUERY_STRINGS_TO_REDACT),\n },\n instrumentation._diag\n );\n\n Object.assign(\n spanAttributes,\n instrumentation._headerCapture.server.captureRequestHeaders(\n header => request.headers[header]\n )\n );\n\n const spanOptions: SpanOptions = {\n kind: SpanKind.SERVER,\n attributes: spanAttributes,\n };\n\n const startTime = hrTime();\n\n // request method and url.scheme are both required span attributes\n const metricAttributes: Attributes = {\n [ATTR_HTTP_REQUEST_METHOD]: spanAttributes[ATTR_HTTP_REQUEST_METHOD],\n [ATTR_URL_SCHEME]: spanAttributes[ATTR_URL_SCHEME],\n };\n\n // recommended if and only if one was sent, same as span recommendation\n if (spanAttributes[ATTR_NETWORK_PROTOCOL_VERSION]) {\n metricAttributes[ATTR_NETWORK_PROTOCOL_VERSION] =\n spanAttributes[ATTR_NETWORK_PROTOCOL_VERSION];\n }\n\n const ctx = propagation.extract(ROOT_CONTEXT, headers);\n const span = instrumentation._startHttpSpan(method, spanOptions, ctx);\n const rpcMetadata: RPCMetadata = {\n type: RPCType.HTTP,\n span,\n };\n\n return context.with(\n setRPCMetadata(trace.setSpan(ctx, span), rpcMetadata),\n () => {\n context.bind(context.active(), request);\n context.bind(context.active(), response);\n\n if (instrumentation.getConfig().requestHook) {\n instrumentation._callRequestHook(span, request);\n }\n if (instrumentation.getConfig().responseHook) {\n instrumentation._callResponseHook(span, response);\n }\n\n // After 'error', no further events other than 'close' should be emitted.\n let hasError = false;\n response.on('close', () => {\n if (hasError) {\n return;\n }\n instrumentation._onServerResponseFinish(\n request,\n response,\n span,\n metricAttributes,\n startTime\n );\n });\n response.on(errorMonitor, (err: Err) => {\n hasError = true;\n instrumentation._onServerResponseError(\n span,\n metricAttributes,\n startTime,\n err\n );\n });\n\n return safeExecuteInTheMiddle(\n () => original.apply(this, [event, ...args]),\n error => {\n if (error) {\n instrumentation._onServerResponseError(\n span,\n metricAttributes,\n startTime,\n error\n );\n throw error;\n }\n }\n );\n }\n );\n };\n }\n\n private _outgoingRequestFunction(\n component: 'http' | 'https',\n original: Func<http.ClientRequest>\n ): Func<http.ClientRequest> {\n const instrumentation = this;\n return function outgoingRequest(\n this: unknown,\n options: url.URL | http.RequestOptions | string,\n ...args: unknown[]\n ): http.ClientRequest {\n if (!isValidOptionsType(options)) {\n return original.apply(this, [options, ...args]);\n }\n const extraOptions =\n typeof args[0] === 'object' &&\n (typeof options === 'string' || options instanceof url.URL)\n ? (args.shift() as http.RequestOptions)\n : undefined;\n const { method, invalidUrl, optionsParsed } = getRequestInfo(\n instrumentation._diag,\n options,\n extraOptions\n );\n\n if (\n safeExecuteInTheMiddle(\n () =>\n instrumentation\n .getConfig()\n .ignoreOutgoingRequestHook?.(optionsParsed),\n (e: unknown) => {\n if (e != null) {\n instrumentation._diag.error(\n 'caught ignoreOutgoingRequestHook error: ',\n e\n );\n }\n },\n true\n )\n ) {\n return original.apply(this, [optionsParsed, ...args]);\n }\n\n const { hostname, port } = extractHostnameAndPort(optionsParsed);\n const attributes = getOutgoingRequestAttributes(\n optionsParsed,\n {\n component,\n port,\n hostname,\n hookAttributes: instrumentation._callStartSpanHook(\n optionsParsed,\n instrumentation.getConfig().startOutgoingSpanHook\n ),\n redactedQueryParams: instrumentation.getConfig().redactedQueryParams, // Added config for adding custom query strings\n },\n instrumentation.getConfig().enableSyntheticSourceDetection || false\n );\n\n const startTime = hrTime();\n\n // request method, server address, and server port are both required span attributes\n const metricAttributes: Attributes = {\n [ATTR_HTTP_REQUEST_METHOD]: attributes[ATTR_HTTP_REQUEST_METHOD],\n [ATTR_SERVER_ADDRESS]: attributes[ATTR_SERVER_ADDRESS],\n [ATTR_SERVER_PORT]: attributes[ATTR_SERVER_PORT],\n };\n\n // required if and only if one was sent, same as span requirement\n if (attributes[ATTR_HTTP_RESPONSE_STATUS_CODE]) {\n metricAttributes[ATTR_HTTP_RESPONSE_STATUS_CODE] =\n attributes[ATTR_HTTP_RESPONSE_STATUS_CODE];\n }\n\n // recommended if and only if one was sent, same as span recommendation\n if (attributes[ATTR_NETWORK_PROTOCOL_VERSION]) {\n metricAttributes[ATTR_NETWORK_PROTOCOL_VERSION] =\n attributes[ATTR_NETWORK_PROTOCOL_VERSION];\n }\n\n const spanOptions: SpanOptions = {\n kind: SpanKind.CLIENT,\n attributes,\n };\n const span = instrumentation._startHttpSpan(method, spanOptions);\n\n const parentContext = context.active();\n const requestContext = trace.setSpan(parentContext, span);\n\n if (!optionsParsed.headers) {\n optionsParsed.headers = {};\n } else {\n // Make a copy of the headers object to avoid mutating an object the\n // caller might have a reference to.\n optionsParsed.headers = Object.assign({}, optionsParsed.headers);\n }\n propagation.inject(requestContext, optionsParsed.headers);\n\n return context.with(requestContext, () => {\n /*\n * The response callback is registered before ClientRequest is bound,\n * thus it is needed to bind it before the function call.\n */\n const cb = args[args.length - 1];\n if (typeof cb === 'function') {\n args[args.length - 1] = context.bind(parentContext, cb);\n }\n\n const request: http.ClientRequest = safeExecuteInTheMiddle(\n () => {\n if (invalidUrl) {\n // we know that the url is invalid, there's no point in injecting context as it will fail validation.\n // Passing in what the user provided will give the user an error that matches what they'd see without\n // the instrumentation.\n return original.apply(this, [options, ...args]);\n } else {\n return original.apply(this, [optionsParsed, ...args]);\n }\n },\n error => {\n if (error) {\n instrumentation._onOutgoingRequestError(\n span,\n metricAttributes,\n startTime,\n error\n );\n throw error;\n }\n }\n );\n\n instrumentation._diag.debug(\n `${component} instrumentation outgoingRequest`\n );\n context.bind(parentContext, request);\n return instrumentation._traceClientRequest(\n request,\n span,\n startTime,\n metricAttributes\n );\n });\n };\n }\n\n private _onServerResponseFinish(\n request: http.IncomingMessage,\n response: http.ServerResponse,\n span: Span,\n metricAttributes: Attributes,\n startTime: HrTime\n ) {\n const attributes = getIncomingRequestAttributesOnResponse(response);\n metricAttributes = Object.assign(\n metricAttributes,\n getIncomingStableRequestMetricAttributesOnResponse(attributes)\n );\n\n span.setAttributes(\n this._headerCapture.server.captureResponseHeaders(header =>\n response.getHeader(header)\n )\n );\n\n span.setAttributes(attributes).setStatus({\n code: parseResponseStatus(SpanKind.SERVER, response.statusCode),\n });\n\n const route = attributes[ATTR_HTTP_ROUTE];\n if (route) {\n span.updateName(`${request.method || 'GET'} ${route}`);\n }\n\n if (this.getConfig().applyCustomAttributesOnSpan) {\n safeExecuteInTheMiddle(\n () =>\n this.getConfig().applyCustomAttributesOnSpan!(\n span,\n request,\n response\n ),\n () => {},\n true\n );\n }\n\n this._closeHttpSpan(span, SpanKind.SERVER, startTime, metricAttributes);\n }\n\n private _onOutgoingRequestError(\n span: Span,\n metricAttributes: Attributes,\n startTime: HrTime,\n error: Err\n ) {\n setSpanWithError(span, error);\n metricAttributes[ATTR_ERROR_TYPE] = error.name;\n\n this._closeHttpSpan(span, SpanKind.CLIENT, startTime, metricAttributes);\n }\n\n private _onServerResponseError(\n span: Span,\n metricAttributes: Attributes,\n startTime: HrTime,\n error: Err\n ) {\n setSpanWithError(span, error);\n metricAttributes[ATTR_ERROR_TYPE] = error.name;\n\n this._closeHttpSpan(span, SpanKind.SERVER, startTime, metricAttributes);\n }\n\n private _startHttpSpan(\n name: string,\n options: SpanOptions,\n ctx = context.active()\n ) {\n /*\n * If a parent is required but not present, we use a `NoopSpan` to still\n * propagate context without recording it.\n */\n const requireParent =\n options.kind === SpanKind.CLIENT\n ? this.getConfig().requireParentforOutgoingSpans\n : this.getConfig().requireParentforIncomingSpans;\n\n let span: Span;\n const currentSpan = trace.getSpan(ctx);\n\n if (\n requireParent === true &&\n (!currentSpan || !trace.isSpanContextValid(currentSpan.spanContext()))\n ) {\n span = trace.wrapSpanContext(INVALID_SPAN_CONTEXT);\n } else if (requireParent === true && currentSpan?.spanContext().isRemote) {\n span = currentSpan;\n } else {\n span = this.tracer.startSpan(name, options, ctx);\n }\n this._spanNotEnded.add(span);\n return span;\n }\n\n private _closeHttpSpan(\n span: Span,\n spanKind: SpanKind,\n startTime: HrTime,\n metricAttributes: Attributes\n ) {\n if (!this._spanNotEnded.has(span)) {\n return;\n }\n\n span.end();\n this._spanNotEnded.delete(span);\n\n // Record metrics\n const duration = hrTimeToMilliseconds(hrTimeDuration(startTime, hrTime()));\n if (spanKind === SpanKind.SERVER) {\n this._recordServerDuration(duration, metricAttributes);\n } else if (spanKind === SpanKind.CLIENT) {\n this._recordClientDuration(duration, metricAttributes);\n }\n }\n\n private _callResponseHook(\n span: Span,\n response: http.IncomingMessage | http.ServerResponse\n ) {\n safeExecuteInTheMiddle(\n () => this.getConfig().responseHook!(span, response),\n () => {},\n true\n );\n }\n\n private _callRequestHook(\n span: Span,\n request: http.ClientRequest | http.IncomingMessage\n ) {\n safeExecuteInTheMiddle(\n () => this.getConfig().requestHook!(span, request),\n () => {},\n true\n );\n }\n\n private _callStartSpanHook(\n request: http.IncomingMessage | http.RequestOptions,\n hookFunc: Function | undefined\n ) {\n if (typeof hookFunc === 'function') {\n return safeExecuteInTheMiddle(\n () => hookFunc(request),\n () => {},\n true\n );\n }\n }\n\n private _createHeaderCapture() {\n const config = this.getConfig();\n\n return {\n client: {\n captureRequestHeaders: headerCapture(\n 'request',\n config.headersToSpanAttributes?.client?.requestHeaders ?? []\n ),\n captureResponseHeaders: headerCapture(\n 'response',\n config.headersToSpanAttributes?.client?.responseHeaders ?? []\n ),\n },\n server: {\n captureRequestHeaders: headerCapture(\n 'request',\n config.headersToSpanAttributes?.server?.requestHeaders ?? []\n ),\n captureResponseHeaders: headerCapture(\n 'response',\n config.headersToSpanAttributes?.server?.responseHeaders ?? []\n ),\n },\n };\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- export { HttpInstrumentation } from './http';
2
- export type { HttpCustomAttributeFunction, HttpInstrumentationConfig, HttpRequestCustomAttributeFunction, HttpResponseCustomAttributeFunction, IgnoreIncomingRequestFunction, IgnoreOutgoingRequestFunction, StartIncomingSpanCustomAttributeFunction, StartOutgoingSpanCustomAttributeFunction, } from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.HttpInstrumentation = void 0;
8
- var http_1 = require("./http");
9
- Object.defineProperty(exports, "HttpInstrumentation", { enumerable: true, get: function () { return http_1.HttpInstrumentation; } });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { HttpInstrumentation } from './http';\nexport type {\n HttpCustomAttributeFunction,\n HttpInstrumentationConfig,\n HttpRequestCustomAttributeFunction,\n HttpResponseCustomAttributeFunction,\n IgnoreIncomingRequestFunction,\n IgnoreOutgoingRequestFunction,\n StartIncomingSpanCustomAttributeFunction,\n StartOutgoingSpanCustomAttributeFunction,\n} from './types';\n"]}
@@ -1,42 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- import type * as http from 'http';
5
- import type * as https from 'https';
6
- import type { get, IncomingMessage, request } from 'http';
7
- import type * as url from 'url';
8
- export type IgnoreMatcher = string | RegExp | ((url: string) => boolean);
9
- export type HttpCallback = (res: IncomingMessage) => void;
10
- export type RequestFunction = typeof request;
11
- export type GetFunction = typeof get;
12
- export type HttpCallbackOptional = HttpCallback | undefined;
13
- export type RequestSignature = [http.RequestOptions, HttpCallbackOptional] & HttpCallback;
14
- export type HttpRequestArgs = Array<HttpCallbackOptional | RequestSignature>;
15
- export type ParsedRequestOptions = (http.RequestOptions & Partial<url.UrlWithParsedQuery>) | http.RequestOptions;
16
- export type Http = typeof http;
17
- export type Https = typeof https;
18
- export type Func<T> = (...args: any[]) => T;
19
- export interface Err extends Error {
20
- errno?: number;
21
- code?: string;
22
- path?: string;
23
- syscall?: string;
24
- stack?: string;
25
- }
26
- /**
27
- * Names of possible synthetic test sources.
28
- */
29
- export declare const SYNTHETIC_TEST_NAMES: string[];
30
- /**
31
- * Names of possible synthetic bot sources.
32
- */
33
- export declare const SYNTHETIC_BOT_NAMES: string[];
34
- /**
35
- * REDACTED string used to replace sensitive information in URLs.
36
- */
37
- export declare const STR_REDACTED = "REDACTED";
38
- /**
39
- * List of URL query keys that are considered sensitive and whose value should be redacted.
40
- */
41
- export declare const DEFAULT_QUERY_STRINGS_TO_REDACT: readonly ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature", "X-Amz-Signature", "X-Amz-Credential", "X-Amz-Security-Token"];
42
- //# sourceMappingURL=internal-types.d.ts.map
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DEFAULT_QUERY_STRINGS_TO_REDACT = exports.STR_REDACTED = exports.SYNTHETIC_BOT_NAMES = exports.SYNTHETIC_TEST_NAMES = void 0;
8
- /**
9
- * Names of possible synthetic test sources.
10
- */
11
- exports.SYNTHETIC_TEST_NAMES = ['alwayson'];
12
- /**
13
- * Names of possible synthetic bot sources.
14
- */
15
- exports.SYNTHETIC_BOT_NAMES = ['googlebot', 'bingbot'];
16
- /**
17
- * REDACTED string used to replace sensitive information in URLs.
18
- */
19
- exports.STR_REDACTED = 'REDACTED';
20
- /**
21
- * List of URL query keys that are considered sensitive and whose value should be redacted.
22
- */
23
- exports.DEFAULT_QUERY_STRINGS_TO_REDACT = [
24
- 'sig',
25
- 'Signature',
26
- 'AWSAccessKeyId',
27
- 'X-Goog-Signature',
28
- 'X-Amz-Signature',
29
- 'X-Amz-Credential',
30
- 'X-Amz-Security-Token',
31
- ];
32
- //# sourceMappingURL=internal-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-types.js","sourceRoot":"","sources":["../../src/internal-types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoCH;;GAEG;AACU,QAAA,oBAAoB,GAAG,CAAC,UAAU,CAAC,CAAC;AAEjD;;GAEG;AACU,QAAA,mBAAmB,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAE5D;;GAEG;AACU,QAAA,YAAY,GAAG,UAAU,CAAC;AAEvC;;GAEG;AACU,QAAA,+BAA+B,GAAG;IAC7C,KAAK;IACL,WAAW;IACX,gBAAgB;IAChB,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;IAClB,sBAAsB;CACd,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport type { get, IncomingMessage, request } from 'http';\nimport type * as url from 'url';\n\nexport type IgnoreMatcher = string | RegExp | ((url: string) => boolean);\nexport type HttpCallback = (res: IncomingMessage) => void;\nexport type RequestFunction = typeof request;\nexport type GetFunction = typeof get;\n\nexport type HttpCallbackOptional = HttpCallback | undefined;\n\n// from node 10+\nexport type RequestSignature = [http.RequestOptions, HttpCallbackOptional] &\n HttpCallback;\n\nexport type HttpRequestArgs = Array<HttpCallbackOptional | RequestSignature>;\n\nexport type ParsedRequestOptions =\n | (http.RequestOptions & Partial<url.UrlWithParsedQuery>)\n | http.RequestOptions;\nexport type Http = typeof http;\nexport type Https = typeof https;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Func<T> = (...args: any[]) => T;\n\nexport interface Err extends Error {\n errno?: number;\n code?: string;\n path?: string;\n syscall?: string;\n stack?: string;\n}\n\n/**\n * Names of possible synthetic test sources.\n */\nexport const SYNTHETIC_TEST_NAMES = ['alwayson'];\n\n/**\n * Names of possible synthetic bot sources.\n */\nexport const SYNTHETIC_BOT_NAMES = ['googlebot', 'bingbot'];\n\n/**\n * REDACTED string used to replace sensitive information in URLs.\n */\nexport const STR_REDACTED = 'REDACTED';\n\n/**\n * List of URL query keys that are considered sensitive and whose value should be redacted.\n */\nexport const DEFAULT_QUERY_STRINGS_TO_REDACT = [\n 'sig',\n 'Signature',\n 'AWSAccessKeyId',\n 'X-Goog-Signature',\n 'X-Amz-Signature',\n 'X-Amz-Credential',\n 'X-Amz-Security-Token',\n] as const;\n"]}
@@ -1,17 +0,0 @@
1
- /**
2
- * Specifies the category of synthetic traffic, such as tests or bots.
3
- *
4
- * @note This attribute **MAY** be derived from the contents of the `user_agent.original` attribute. Components that populate the attribute are responsible for determining what they consider to be synthetic bot or test traffic. This attribute can either be set for self-identification purposes, or on telemetry detected to be generated as a result of a synthetic request. This attribute is useful for distinguishing between genuine client traffic and synthetic traffic generated by bots or tests.
5
- *
6
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
7
- */
8
- export declare const ATTR_USER_AGENT_SYNTHETIC_TYPE: "user_agent.synthetic.type";
9
- /**
10
- * Enum value "bot" for attribute {@link ATTR_USER_AGENT_SYNTHETIC_TYPE}.
11
- */
12
- export declare const USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT: "bot";
13
- /**
14
- * Enum value "test" for attribute {@link ATTR_USER_AGENT_SYNTHETIC_TYPE}.
15
- */
16
- export declare const USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST: "test";
17
- //# sourceMappingURL=semconv.d.ts.map
@@ -1,29 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST = exports.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT = exports.ATTR_USER_AGENT_SYNTHETIC_TYPE = void 0;
8
- /*
9
- * This file contains a copy of unstable semantic convention definitions
10
- * used by this package.
11
- * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
12
- */
13
- /**
14
- * Specifies the category of synthetic traffic, such as tests or bots.
15
- *
16
- * @note This attribute **MAY** be derived from the contents of the `user_agent.original` attribute. Components that populate the attribute are responsible for determining what they consider to be synthetic bot or test traffic. This attribute can either be set for self-identification purposes, or on telemetry detected to be generated as a result of a synthetic request. This attribute is useful for distinguishing between genuine client traffic and synthetic traffic generated by bots or tests.
17
- *
18
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
19
- */
20
- exports.ATTR_USER_AGENT_SYNTHETIC_TYPE = 'user_agent.synthetic.type';
21
- /**
22
- * Enum value "bot" for attribute {@link ATTR_USER_AGENT_SYNTHETIC_TYPE}.
23
- */
24
- exports.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT = 'bot';
25
- /**
26
- * Enum value "test" for attribute {@link ATTR_USER_AGENT_SYNTHETIC_TYPE}.
27
- */
28
- exports.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST = 'test';
29
- //# sourceMappingURL=semconv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AACU,QAAA,8BAA8B,GACzC,2BAAoC,CAAC;AAEvC;;GAEG;AACU,QAAA,mCAAmC,GAAG,KAAc,CAAC;AAElE;;GAEG;AACU,QAAA,oCAAoC,GAAG,MAAe,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * Specifies the category of synthetic traffic, such as tests or bots.\n *\n * @note This attribute **MAY** be derived from the contents of the `user_agent.original` attribute. Components that populate the attribute are responsible for determining what they consider to be synthetic bot or test traffic. This attribute can either be set for self-identification purposes, or on telemetry detected to be generated as a result of a synthetic request. This attribute is useful for distinguishing between genuine client traffic and synthetic traffic generated by bots or tests.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_USER_AGENT_SYNTHETIC_TYPE =\n 'user_agent.synthetic.type' as const;\n\n/**\n * Enum value \"bot\" for attribute {@link ATTR_USER_AGENT_SYNTHETIC_TYPE}.\n */\nexport const USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT = 'bot' as const;\n\n/**\n * Enum value \"test\" for attribute {@link ATTR_USER_AGENT_SYNTHETIC_TYPE}.\n */\nexport const USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST = 'test' as const;\n"]}
@@ -1,115 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Span, Attributes } from '@opentelemetry/api';
3
- import type { ClientRequest, IncomingMessage, ServerResponse, RequestOptions } from 'http';
4
- import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
5
- export interface HttpCustomAttributeFunction {
6
- (span: Span, request: ClientRequest | IncomingMessage, response: IncomingMessage | ServerResponse): void;
7
- }
8
- /**
9
- * Called with each incoming request. Return `true` to skip creating a server
10
- * span for that request.
11
- */
12
- export interface IgnoreIncomingRequestFunction {
13
- (request: IncomingMessage): boolean;
14
- }
15
- /**
16
- * Called with each outgoing request's parsed options. Return `true` to skip
17
- * creating a client span for that request.
18
- */
19
- export interface IgnoreOutgoingRequestFunction {
20
- (request: RequestOptions): boolean;
21
- }
22
- /**
23
- * Called with the active span and request before the request is handled.
24
- */
25
- export interface HttpRequestCustomAttributeFunction {
26
- (span: Span, request: ClientRequest | IncomingMessage): void;
27
- }
28
- /**
29
- * Called with the active span and response before the response is handled.
30
- */
31
- export interface HttpResponseCustomAttributeFunction {
32
- (span: Span, response: IncomingMessage | ServerResponse): void;
33
- }
34
- /**
35
- * Called before an incoming request span is started. Returned attributes are
36
- * added to the new server span.
37
- */
38
- export interface StartIncomingSpanCustomAttributeFunction {
39
- (request: IncomingMessage): Attributes;
40
- }
41
- /**
42
- * Called with an outgoing request's parsed options before the span is started.
43
- * Returned attributes are added to the new client span.
44
- */
45
- export interface StartOutgoingSpanCustomAttributeFunction {
46
- (request: RequestOptions): Attributes;
47
- }
48
- /**
49
- * Options available for the HTTP instrumentation (see [documentation](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http#http-instrumentation-options))
50
- */
51
- export interface HttpInstrumentationConfig extends InstrumentationConfig {
52
- /** Do not trace incoming requests for which this function returns `true`. */
53
- ignoreIncomingRequestHook?: IgnoreIncomingRequestFunction;
54
- /** Do not trace outgoing requests for which this function returns `true`. */
55
- ignoreOutgoingRequestHook?: IgnoreOutgoingRequestFunction;
56
- /** If set to true, incoming requests will not be instrumented at all. */
57
- disableIncomingRequestInstrumentation?: boolean;
58
- /** If set to true, outgoing requests will not be instrumented at all. */
59
- disableOutgoingRequestInstrumentation?: boolean;
60
- /** Function for adding custom attributes after response is handled */
61
- applyCustomAttributesOnSpan?: HttpCustomAttributeFunction;
62
- /** Function for adding custom attributes before request is handled */
63
- requestHook?: HttpRequestCustomAttributeFunction;
64
- /** Function for adding custom attributes before response is handled */
65
- responseHook?: HttpResponseCustomAttributeFunction;
66
- /** Function for adding custom attributes before a span is started in incomingRequest */
67
- startIncomingSpanHook?: StartIncomingSpanCustomAttributeFunction;
68
- /** Function for adding custom attributes before a span is started in outgoingRequest */
69
- startOutgoingSpanHook?: StartOutgoingSpanCustomAttributeFunction;
70
- /**
71
- * The primary server name of the matched virtual host.
72
- * @deprecated No longer used. Stable HTTP semantic conventions do not include
73
- * the `http.server_name` attribute; this option has no effect.
74
- */
75
- serverName?: string;
76
- /** Require parent to create span for outgoing requests */
77
- requireParentforOutgoingSpans?: boolean;
78
- /** Require parent to create span for incoming requests */
79
- requireParentforIncomingSpans?: boolean;
80
- /** Map the following HTTP headers to span attributes. */
81
- headersToSpanAttributes?: {
82
- client?: {
83
- requestHeaders?: string[];
84
- responseHeaders?: string[];
85
- };
86
- server?: {
87
- requestHeaders?: string[];
88
- responseHeaders?: string[];
89
- };
90
- };
91
- /**
92
- * Enable automatic population of synthetic source type based on the user-agent header
93
- * @experimental
94
- **/
95
- enableSyntheticSourceDetection?: boolean;
96
- /**
97
- * [Optional] Query parameters to redact on outgoing (client) spans.
98
- * Use this to specify custom query strings that contain sensitive information.
99
- * These will replace/overwrite the default query strings that are to be redacted.
100
- * When omitted, defaults to a built-in list of known sensitive parameter
101
- * names; see the package README for the current list.
102
- * Set to an empty array to disable client-side query parameter redaction entirely.
103
- * @experimental
104
- */
105
- redactedQueryParams?: string[];
106
- /**
107
- * [Optional] Query parameters to redact on incoming (server) spans.
108
- * When omitted, defaults to a built-in list of known sensitive parameter
109
- * names; see the package README for the current list.
110
- * Set to an empty array to disable server-side query parameter redaction entirely.
111
- * @experimental
112
- */
113
- redactedQueryParamsServer?: string[];
114
- }
115
- //# sourceMappingURL=types.d.ts.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { Span, Attributes } from '@opentelemetry/api';\nimport type {\n ClientRequest,\n IncomingMessage,\n ServerResponse,\n RequestOptions,\n} from 'http';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\n\nexport interface HttpCustomAttributeFunction {\n (\n span: Span,\n request: ClientRequest | IncomingMessage,\n response: IncomingMessage | ServerResponse\n ): void;\n}\n\n/**\n * Called with each incoming request. Return `true` to skip creating a server\n * span for that request.\n */\nexport interface IgnoreIncomingRequestFunction {\n (request: IncomingMessage): boolean;\n}\n\n/**\n * Called with each outgoing request's parsed options. Return `true` to skip\n * creating a client span for that request.\n */\nexport interface IgnoreOutgoingRequestFunction {\n (request: RequestOptions): boolean;\n}\n\n/**\n * Called with the active span and request before the request is handled.\n */\nexport interface HttpRequestCustomAttributeFunction {\n (span: Span, request: ClientRequest | IncomingMessage): void;\n}\n\n/**\n * Called with the active span and response before the response is handled.\n */\nexport interface HttpResponseCustomAttributeFunction {\n (span: Span, response: IncomingMessage | ServerResponse): void;\n}\n\n/**\n * Called before an incoming request span is started. Returned attributes are\n * added to the new server span.\n */\nexport interface StartIncomingSpanCustomAttributeFunction {\n (request: IncomingMessage): Attributes;\n}\n\n/**\n * Called with an outgoing request's parsed options before the span is started.\n * Returned attributes are added to the new client span.\n */\nexport interface StartOutgoingSpanCustomAttributeFunction {\n (request: RequestOptions): Attributes;\n}\n\n/**\n * Options available for the HTTP instrumentation (see [documentation](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http#http-instrumentation-options))\n */\nexport interface HttpInstrumentationConfig extends InstrumentationConfig {\n /** Do not trace incoming requests for which this function returns `true`. */\n ignoreIncomingRequestHook?: IgnoreIncomingRequestFunction;\n /** Do not trace outgoing requests for which this function returns `true`. */\n ignoreOutgoingRequestHook?: IgnoreOutgoingRequestFunction;\n /** If set to true, incoming requests will not be instrumented at all. */\n disableIncomingRequestInstrumentation?: boolean;\n /** If set to true, outgoing requests will not be instrumented at all. */\n disableOutgoingRequestInstrumentation?: boolean;\n /** Function for adding custom attributes after response is handled */\n applyCustomAttributesOnSpan?: HttpCustomAttributeFunction;\n /** Function for adding custom attributes before request is handled */\n requestHook?: HttpRequestCustomAttributeFunction;\n /** Function for adding custom attributes before response is handled */\n responseHook?: HttpResponseCustomAttributeFunction;\n /** Function for adding custom attributes before a span is started in incomingRequest */\n startIncomingSpanHook?: StartIncomingSpanCustomAttributeFunction;\n /** Function for adding custom attributes before a span is started in outgoingRequest */\n startOutgoingSpanHook?: StartOutgoingSpanCustomAttributeFunction;\n /**\n * The primary server name of the matched virtual host.\n * @deprecated No longer used. Stable HTTP semantic conventions do not include\n * the `http.server_name` attribute; this option has no effect.\n */\n serverName?: string;\n /** Require parent to create span for outgoing requests */\n requireParentforOutgoingSpans?: boolean;\n /** Require parent to create span for incoming requests */\n requireParentforIncomingSpans?: boolean;\n /** Map the following HTTP headers to span attributes. */\n headersToSpanAttributes?: {\n client?: { requestHeaders?: string[]; responseHeaders?: string[] };\n server?: { requestHeaders?: string[]; responseHeaders?: string[] };\n };\n /**\n * Enable automatic population of synthetic source type based on the user-agent header\n * @experimental\n **/\n enableSyntheticSourceDetection?: boolean;\n /**\n * [Optional] Query parameters to redact on outgoing (client) spans.\n * Use this to specify custom query strings that contain sensitive information.\n * These will replace/overwrite the default query strings that are to be redacted.\n * When omitted, defaults to a built-in list of known sensitive parameter\n * names; see the package README for the current list.\n * Set to an empty array to disable client-side query parameter redaction entirely.\n * @experimental\n */\n redactedQueryParams?: string[];\n /**\n * [Optional] Query parameters to redact on incoming (server) spans.\n * When omitted, defaults to a built-in list of known sensitive parameter\n * names; see the package README for the current list.\n * Set to an empty array to disable server-side query parameter redaction entirely.\n * @experimental\n */\n redactedQueryParamsServer?: string[];\n}\n"]}
@@ -1,105 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Attributes, Span, DiagLogger } from '@opentelemetry/api';
3
- import { SpanStatusCode, SpanKind } from '@opentelemetry/api';
4
- import type { IncomingHttpHeaders, IncomingMessage, OutgoingHttpHeaders, RequestOptions, ServerResponse } from 'http';
5
- import * as url from 'url';
6
- import type { Err, IgnoreMatcher, ParsedRequestOptions } from './internal-types';
7
- /**
8
- * Redacts sensitive query parameters from a query string (without leading '?').
9
- * Returns the input unchanged if it cannot be parsed.
10
- */
11
- export declare const redactQueryString: (searchParams: URLSearchParams, paramsToRedact: string[]) => string;
12
- /**
13
- * Get an absolute url
14
- */
15
- export declare const getAbsoluteUrl: (requestUrl: ParsedRequestOptions | null, headers: IncomingHttpHeaders | OutgoingHttpHeaders, fallbackProtocol?: string, redactedQueryParams?: string[]) => string;
16
- /**
17
- * Parse status code from HTTP response. [More details](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-http.md#status)
18
- */
19
- export declare const parseResponseStatus: (kind: SpanKind, statusCode?: number) => SpanStatusCode;
20
- /**
21
- * Check whether the given obj match pattern
22
- * @param constant e.g URL of request
23
- * @param pattern Match pattern
24
- */
25
- export declare const satisfiesPattern: (constant: string, pattern: IgnoreMatcher) => boolean;
26
- /**
27
- * Sets the span with the error passed in params
28
- * @param {Span} span the span that need to be set
29
- * @param {Error} error error that will be set to span
30
- */
31
- export declare const setSpanWithError: (span: Span, error: Err) => void;
32
- export declare const isCompressed: (headers: OutgoingHttpHeaders | IncomingHttpHeaders) => boolean;
33
- /**
34
- * Makes sure options is an url object
35
- * return an object with default value and parsed options
36
- * @param logger component logger
37
- * @param options original options for the request
38
- * @param [extraOptions] additional options for the request
39
- */
40
- export declare const getRequestInfo: (logger: DiagLogger, options: url.URL | RequestOptions | string, extraOptions?: RequestOptions) => {
41
- origin: string;
42
- pathname: string;
43
- method: string;
44
- invalidUrl: boolean;
45
- optionsParsed: RequestOptions;
46
- };
47
- /**
48
- * Makes sure options is of type string or object
49
- * @param options for the request
50
- */
51
- export declare const isValidOptionsType: (options: unknown) => boolean;
52
- export declare const extractHostnameAndPort: (requestOptions: Pick<ParsedRequestOptions, 'hostname' | 'host' | 'port' | 'protocol'>) => {
53
- hostname: string;
54
- port: number | string;
55
- };
56
- /**
57
- * Returns outgoing request attributes scoped to the options passed to the request
58
- * @param {ParsedRequestOptions} requestOptions the same options used to make the request
59
- * @param {{ component: string, hostname: string, hookAttributes?: Attributes }} options used to pass data needed to create attributes
60
- */
61
- export declare const getOutgoingRequestAttributes: (requestOptions: ParsedRequestOptions, options: {
62
- component: string;
63
- hostname: string;
64
- port: string | number;
65
- hookAttributes?: Attributes;
66
- redactedQueryParams?: string[];
67
- }, enableSyntheticSourceDetection: boolean) => Attributes;
68
- /**
69
- * Returns outgoing request attributes scoped to the response data
70
- * @param {IncomingMessage} response the response object
71
- */
72
- export declare const getOutgoingRequestAttributesOnResponse: (response: IncomingMessage) => Attributes;
73
- /**
74
- * Returns outgoing request Metric attributes scoped to the response data
75
- * @param {Attributes} spanAttributes the span attributes
76
- */
77
- export declare const getOutgoingStableRequestMetricAttributesOnResponse: (spanAttributes: Attributes) => Attributes;
78
- /**
79
- * Get server.address and port according to http semconv 1.27
80
- * https://github.com/open-telemetry/semantic-conventions/blob/bf0a2c1134f206f034408b201dbec37960ed60ec/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes
81
- */
82
- export declare function getRemoteClientAddress(request: IncomingMessage): string | null;
83
- /**
84
- * Returns incoming request attributes scoped to the request data
85
- * @param {IncomingMessage} request the request object
86
- * @param {{ component: string, hookAttributes?: Attributes, enableSyntheticSourceDetection: boolean }} options used to pass data needed to create attributes
87
- */
88
- export declare const getIncomingRequestAttributes: (request: IncomingMessage, options: {
89
- component: 'http' | 'https';
90
- hookAttributes?: Attributes;
91
- enableSyntheticSourceDetection: boolean;
92
- redactedQueryParams?: string[];
93
- }, logger: DiagLogger) => Attributes;
94
- /**
95
- * Returns incoming request attributes scoped to the response data
96
- * @param {(ServerResponse & { socket: Socket; })} response the response object
97
- */
98
- export declare const getIncomingRequestAttributesOnResponse: (response: ServerResponse) => Attributes;
99
- /**
100
- * Returns incoming stable request Metric attributes scoped to the request data
101
- * @param {Attributes} spanAttributes the span attributes
102
- */
103
- export declare const getIncomingStableRequestMetricAttributesOnResponse: (spanAttributes: Attributes) => Attributes;
104
- export declare function headerCapture(type: 'request' | 'response', headers: string[]): (getHeader: (key: string) => undefined | string | string[] | number) => Attributes;
105
- //# sourceMappingURL=utils.d.ts.map