1 | /// <reference types="node" />
|
2 | import type { ClientRequest, IncomingMessage, RequestOptions, ServerResponse } from 'node:http';
|
3 | import type { HttpInstrumentationConfig } from '@opentelemetry/instrumentation-http';
|
4 | import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
|
5 | import type { Span } from '@sentry/core';
|
6 | import type { HTTPModuleRequestIncomingMessage } from '../../transports/http-module';
|
7 | interface HttpOptions {
|
8 | /**
|
9 | * Whether breadcrumbs should be recorded for outgoing requests.
|
10 | * Defaults to true
|
11 | */
|
12 | breadcrumbs?: boolean;
|
13 | /**
|
14 | * If set to false, do not emit any spans.
|
15 | * This will ensure that the default HttpInstrumentation from OpenTelemetry is not setup,
|
16 | * only the Sentry-specific instrumentation for request isolation is applied.
|
17 | */
|
18 | spans?: boolean;
|
19 | /**
|
20 | * 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.
|
21 | * Read more about Release Health: https://docs.sentry.io/product/releases/health/
|
22 | *
|
23 | * Defaults to `true`.
|
24 | *
|
25 | * Note: If `autoSessionTracking` is set to `false` in `Sentry.init()` or the Client owning this integration, this option will be ignored.
|
26 | */
|
27 | trackIncomingRequestsAsSessions?: boolean;
|
28 | /**
|
29 | * Do not capture spans or breadcrumbs for outgoing HTTP requests to URLs where the given callback returns `true`.
|
30 | * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.
|
31 | *
|
32 | * The `url` param contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.
|
33 | * For example: `'https://someService.com/users/details?id=123'`
|
34 | *
|
35 | * The `request` param contains the original {@type RequestOptions} object used to make the outgoing request.
|
36 | * You can use it to filter on additional properties like method, headers, etc.
|
37 | */
|
38 | ignoreOutgoingRequests?: (url: string, request: RequestOptions) => boolean;
|
39 | /**
|
40 | * Do not capture spans for incoming HTTP requests to URLs where the given callback returns `true`.
|
41 | * Spans will be non recording if tracing is disabled.
|
42 | *
|
43 | * The `urlPath` param consists of the URL path and query string (if any) of the incoming request.
|
44 | * For example: `'/users/details?id=123'`
|
45 | *
|
46 | * The `request` param contains the original {@type IncomingMessage} object of the incoming request.
|
47 | * You can use it to filter on additional properties like method, headers, etc.
|
48 | */
|
49 | ignoreIncomingRequests?: (urlPath: string, request: IncomingMessage) => boolean;
|
50 | /**
|
51 | * If true, do not generate spans for incoming requests at all.
|
52 | * This is used by Remix to avoid generating spans for incoming requests, as it generates its own spans.
|
53 | */
|
54 | disableIncomingRequestSpans?: boolean;
|
55 | /**
|
56 | * Additional instrumentation options that are passed to the underlying HttpInstrumentation.
|
57 | */
|
58 | instrumentation?: {
|
59 | requestHook?: (span: Span, req: ClientRequest | HTTPModuleRequestIncomingMessage) => void;
|
60 | responseHook?: (span: Span, response: HTTPModuleRequestIncomingMessage | ServerResponse) => void;
|
61 | applyCustomAttributesOnSpan?: (span: Span, request: ClientRequest | HTTPModuleRequestIncomingMessage, response: HTTPModuleRequestIncomingMessage | ServerResponse) => void;
|
62 | /**
|
63 | * You can pass any configuration through to the underlying instrumentation.
|
64 | * Note that there are no semver guarantees for this!
|
65 | */
|
66 | _experimentalConfig?: ConstructorParameters<typeof HttpInstrumentation>[0];
|
67 | };
|
68 | }
|
69 | export declare const instrumentSentryHttp: ((options?: {
|
70 | breadcrumbs?: HttpOptions['breadcrumbs'];
|
71 | ignoreOutgoingRequests?: HttpOptions['ignoreOutgoingRequests'];
|
72 | } | undefined) => void) & {
|
73 | id: string;
|
74 | };
|
75 | export declare const instrumentOtelHttp: ((options?: HttpInstrumentationConfig | undefined) => void) & {
|
76 | id: string;
|
77 | };
|
78 | /**
|
79 | * The http integration instruments Node's internal http and https modules.
|
80 | * It creates breadcrumbs and spans for outgoing HTTP requests which will be attached to the currently active span.
|
81 | */
|
82 | export declare const httpIntegration: (options?: HttpOptions | undefined) => import("@sentry/core").Integration;
|
83 | export {};
|
84 | //# sourceMappingURL=index.d.ts.map |
\ | No newline at end of file |