Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
126 lines
6.7 KiB
Plaintext
126 lines
6.7 KiB
Plaintext
import type { ClientRequest, IncomingMessage, RequestOptions, ServerResponse } from 'node:http';
|
|
import type { HttpInstrumentationConfig } from '@opentelemetry/instrumentation-http';
|
|
import type { Span } from '@sentry/core';
|
|
import type { HTTPModuleRequestIncomingMessage, SentryHttpInstrumentationOptions } from '@sentry/node-core';
|
|
import type { NodeClientOptions } from '../types';
|
|
interface HttpOptions {
|
|
/**
|
|
* Whether breadcrumbs should be recorded for outgoing requests.
|
|
* Defaults to true
|
|
*/
|
|
breadcrumbs?: boolean;
|
|
/**
|
|
* If set to false, do not emit any spans.
|
|
* This will ensure that the default HttpInstrumentation from OpenTelemetry is not setup,
|
|
* only the Sentry-specific instrumentation for request isolation is applied.
|
|
*
|
|
* If `skipOpenTelemetrySetup: true` is configured, this defaults to `false`, otherwise it defaults to `true`.
|
|
*/
|
|
spans?: boolean;
|
|
/**
|
|
* Whether the integration should create [Sessions](https://docs.sentry.io/product/releases/health/#sessions) for incoming requests to track the health and crash-free rate of your releases in Sentry.
|
|
* Read more about Release Health: https://docs.sentry.io/product/releases/health/
|
|
*
|
|
* Defaults to `true`.
|
|
*/
|
|
trackIncomingRequestsAsSessions?: boolean;
|
|
/**
|
|
* Number of milliseconds until sessions tracked with `trackIncomingRequestsAsSessions` will be flushed as a session aggregate.
|
|
*
|
|
* Defaults to `60000` (60s).
|
|
*/
|
|
sessionFlushingDelayMS?: number;
|
|
/**
|
|
* Do not capture spans or breadcrumbs for outgoing HTTP requests to URLs where the given callback returns `true`.
|
|
* This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.
|
|
*
|
|
* The `url` param contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.
|
|
* For example: `'https://someService.com/users/details?id=123'`
|
|
*
|
|
* The `request` param contains the original {@type RequestOptions} object used to make the outgoing request.
|
|
* You can use it to filter on additional properties like method, headers, etc.
|
|
*/
|
|
ignoreOutgoingRequests?: (url: string, request: RequestOptions) => boolean;
|
|
/**
|
|
* Do not capture spans for incoming HTTP requests to URLs where the given callback returns `true`.
|
|
* Spans will be non recording if tracing is disabled.
|
|
*
|
|
* The `urlPath` param consists of the URL path and query string (if any) of the incoming request.
|
|
* For example: `'/users/details?id=123'`
|
|
*
|
|
* The `request` param contains the original {@type IncomingMessage} object of the incoming request.
|
|
* You can use it to filter on additional properties like method, headers, etc.
|
|
*/
|
|
ignoreIncomingRequests?: (urlPath: string, request: IncomingMessage) => boolean;
|
|
/**
|
|
* A hook that can be used to mutate the span for incoming requests.
|
|
* This is triggered after the span is created, but before it is recorded.
|
|
*/
|
|
incomingRequestSpanHook?: (span: Span, request: IncomingMessage, response: ServerResponse) => void;
|
|
/**
|
|
* Whether to automatically ignore common static asset requests like favicon.ico, robots.txt, etc.
|
|
* This helps reduce noise in your transactions.
|
|
*
|
|
* @default `true`
|
|
*/
|
|
ignoreStaticAssets?: boolean;
|
|
/**
|
|
* Do not capture spans for incoming HTTP requests with the given status codes.
|
|
* By default, spans with some 3xx and 4xx status codes are ignored (see @default).
|
|
* Expects an array of status codes or a range of status codes, e.g. [[300,399], 404] would ignore 3xx and 404 status codes.
|
|
*
|
|
* @default `[[401, 404], [301, 303], [305, 399]]`
|
|
*/
|
|
dropSpansForIncomingRequestStatusCodes?: (number | [number, number])[];
|
|
/**
|
|
* Do not capture the request body for incoming HTTP requests to URLs where the given callback returns `true`.
|
|
* This can be useful for long running requests where the body is not needed and we want to avoid capturing it.
|
|
*
|
|
* @param url Contains the entire URL, including query string (if any), protocol, host, etc. of the incoming request.
|
|
* @param request Contains the {@type RequestOptions} object used to make the incoming request.
|
|
*/
|
|
ignoreIncomingRequestBody?: (url: string, request: RequestOptions) => boolean;
|
|
/**
|
|
* Controls the maximum size of incoming HTTP request bodies attached to events.
|
|
*
|
|
* Available options:
|
|
* - 'none': No request bodies will be attached
|
|
* - 'small': Request bodies up to 1,000 bytes will be attached
|
|
* - 'medium': Request bodies up to 10,000 bytes will be attached (default)
|
|
* - 'always': Request bodies will always be attached
|
|
*
|
|
* Note that even with 'always' setting, bodies exceeding 1MB will never be attached
|
|
* for performance and security reasons.
|
|
*
|
|
* @default 'medium'
|
|
*/
|
|
maxIncomingRequestBodySize?: 'none' | 'small' | 'medium' | 'always';
|
|
/**
|
|
* If true, do not generate spans for incoming requests at all.
|
|
* This is used by Remix to avoid generating spans for incoming requests, as it generates its own spans.
|
|
*/
|
|
disableIncomingRequestSpans?: boolean;
|
|
/**
|
|
* Additional instrumentation options that are passed to the underlying HttpInstrumentation.
|
|
*/
|
|
instrumentation?: {
|
|
requestHook?: (span: Span, req: ClientRequest | HTTPModuleRequestIncomingMessage) => void;
|
|
responseHook?: (span: Span, response: HTTPModuleRequestIncomingMessage | ServerResponse) => void;
|
|
applyCustomAttributesOnSpan?: (span: Span, request: ClientRequest | HTTPModuleRequestIncomingMessage, response: HTTPModuleRequestIncomingMessage | ServerResponse) => void;
|
|
};
|
|
}
|
|
export declare const instrumentSentryHttp: ((options?: SentryHttpInstrumentationOptions | undefined) => import("@opentelemetry/instrumentation").Instrumentation<import("@opentelemetry/instrumentation").InstrumentationConfig>) & {
|
|
id: string;
|
|
};
|
|
export declare const instrumentOtelHttp: ((options?: HttpInstrumentationConfig | undefined) => import("@opentelemetry/instrumentation").Instrumentation<import("@opentelemetry/instrumentation").InstrumentationConfig>) & {
|
|
id: string;
|
|
};
|
|
/** Exported only for tests. */
|
|
export declare function _shouldUseOtelHttpInstrumentation(options: HttpOptions, clientOptions?: Partial<NodeClientOptions>): boolean;
|
|
/**
|
|
* The http integration instruments Node's internal http and https modules.
|
|
* It creates breadcrumbs and spans for outgoing HTTP requests which will be attached to the currently active span.
|
|
*/
|
|
export declare const httpIntegration: (options?: HttpOptions | undefined) => import("@sentry/core").Integration;
|
|
export {};
|
|
//# sourceMappingURL=http.d.ts.map |