{"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\nexport interface IgnoreIncomingRequestFunction {\n  (request: IncomingMessage): boolean;\n}\n\nexport interface IgnoreOutgoingRequestFunction {\n  (request: RequestOptions): boolean;\n}\n\nexport interface HttpRequestCustomAttributeFunction {\n  (span: Span, request: ClientRequest | IncomingMessage): void;\n}\n\nexport interface HttpResponseCustomAttributeFunction {\n  (span: Span, response: IncomingMessage | ServerResponse): void;\n}\n\nexport interface StartIncomingSpanCustomAttributeFunction {\n  (request: IncomingMessage): Attributes;\n}\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  /** Not trace all incoming requests that matched with custom function */\n  ignoreIncomingRequestHook?: IgnoreIncomingRequestFunction;\n  /** Not trace all outgoing requests that matched with custom function */\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  /** The primary server name of the matched virtual host. */\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] Additional query parameters to redact.\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   * @example default strings ['sig','Signature','AWSAccessKeyId','X-Goog-Signature']\n   * @experimental\n   */\n  redactedQueryParams?: string[];\n}\n"]}