Skip to content

Commit 46a579d

Browse files
committed
fixup! fixup! fixup! fixup! feat(http): portable node:http client instrumentation (#20393)
1 parent bec30eb commit 46a579d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { SanitizedRequestData } from '@sentry/core';
2+
import type { ClientRequest, RequestOptions } from 'http';
3+
4+
/** Convert an outgoing request to request options. */
5+
export function getRequestOptions(request: ClientRequest): RequestOptions {
6+
return {
7+
method: request.method,
8+
protocol: request.protocol,
9+
host: request.host,
10+
hostname: request.host,
11+
path: request.path,
12+
headers: request.getHeaders(),
13+
};
14+
}
15+
16+
/**
17+
*
18+
*/
19+
export function getClientRequestUrl(request: ClientRequest): string {
20+
const hostname = request.getHeader('host') || request.host;
21+
const protocol = request.protocol;
22+
const path = request.path;
23+
24+
return `${protocol}//${hostname}${path}`;
25+
}

0 commit comments

Comments
 (0)