@tramvai/module-http-proxy-agent 6.79.2 → 6.79.4
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.
- package/lib/server.es.js +15 -14
- package/lib/server.js +19 -14
- package/package.json +6 -6
package/lib/server.es.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
+
import diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
3
|
import { Module, provide, optional, commandLineListTokens } from '@tramvai/core';
|
|
3
4
|
import { LOGGER_TOKEN } from '@tramvai/tokens-common';
|
|
4
5
|
import { METRICS_MODULE_TOKEN } from '@tramvai/tokens-metrics';
|
|
@@ -17,22 +18,22 @@ HttpProxyAgentModule = __decorate([
|
|
|
17
18
|
provide({
|
|
18
19
|
provide: HTTP_CLIENT_AGENT,
|
|
19
20
|
useFactory: ({ options, interceptors, loggerFactory, metrics }) => {
|
|
20
|
-
loggerFactory('http-proxy-agent');
|
|
21
|
+
const logger = loggerFactory('http-proxy-agent');
|
|
21
22
|
const proxyEnv = getHttpsProxy();
|
|
22
23
|
const noProxyEnv = getNoProxy();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
const metricsConnectionCounter = metrics.counter({
|
|
25
|
+
name: 'http_proxy_undici_connect_total',
|
|
26
|
+
help: 'Number of proxy connects with Undici',
|
|
27
|
+
labelNames: ['host'],
|
|
28
|
+
});
|
|
29
|
+
// https://github.com/nodejs/undici/pull/4659
|
|
30
|
+
diagnosticsChannel.channel('undici:proxy:connected').subscribe(({ connectParams }) => {
|
|
31
|
+
logger.debug({
|
|
32
|
+
event: 'proxy undici connection',
|
|
33
|
+
connection: connectParams,
|
|
34
|
+
});
|
|
35
|
+
metricsConnectionCounter.inc({ host: new URL(connectParams.origin).host });
|
|
36
|
+
});
|
|
36
37
|
const agent = new EnvHttpProxyAgent({
|
|
37
38
|
httpProxy: proxyEnv,
|
|
38
39
|
httpsProxy: proxyEnv,
|
package/lib/server.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
+
var diagnosticsChannel = require('node:diagnostics_channel');
|
|
6
7
|
var core = require('@tramvai/core');
|
|
7
8
|
var tokensCommon = require('@tramvai/tokens-common');
|
|
8
9
|
var tokensMetrics = require('@tramvai/tokens-metrics');
|
|
@@ -11,6 +12,10 @@ var undici = require('undici');
|
|
|
11
12
|
var env = require('./utils/env.js');
|
|
12
13
|
var addProxyToHttpsAgent = require('./add-proxy-to-https-agent/add-proxy-to-https-agent.js');
|
|
13
14
|
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var diagnosticsChannel__default = /*#__PURE__*/_interopDefaultLegacy(diagnosticsChannel);
|
|
18
|
+
|
|
14
19
|
exports.HttpProxyAgentModule = class HttpProxyAgentModule {
|
|
15
20
|
};
|
|
16
21
|
exports.HttpProxyAgentModule = tslib.__decorate([
|
|
@@ -21,22 +26,22 @@ exports.HttpProxyAgentModule = tslib.__decorate([
|
|
|
21
26
|
core.provide({
|
|
22
27
|
provide: tokensHttpClient.HTTP_CLIENT_AGENT,
|
|
23
28
|
useFactory: ({ options, interceptors, loggerFactory, metrics }) => {
|
|
24
|
-
loggerFactory('http-proxy-agent');
|
|
29
|
+
const logger = loggerFactory('http-proxy-agent');
|
|
25
30
|
const proxyEnv = env.getHttpsProxy();
|
|
26
31
|
const noProxyEnv = env.getNoProxy();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
const metricsConnectionCounter = metrics.counter({
|
|
33
|
+
name: 'http_proxy_undici_connect_total',
|
|
34
|
+
help: 'Number of proxy connects with Undici',
|
|
35
|
+
labelNames: ['host'],
|
|
36
|
+
});
|
|
37
|
+
// https://github.com/nodejs/undici/pull/4659
|
|
38
|
+
diagnosticsChannel__default["default"].channel('undici:proxy:connected').subscribe(({ connectParams }) => {
|
|
39
|
+
logger.debug({
|
|
40
|
+
event: 'proxy undici connection',
|
|
41
|
+
connection: connectParams,
|
|
42
|
+
});
|
|
43
|
+
metricsConnectionCounter.inc({ host: new URL(connectParams.origin).host });
|
|
44
|
+
});
|
|
40
45
|
const agent = new undici.EnvHttpProxyAgent({
|
|
41
46
|
httpProxy: proxyEnv,
|
|
42
47
|
httpsProxy: proxyEnv,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-http-proxy-agent",
|
|
3
|
-
"version": "6.79.
|
|
3
|
+
"version": "6.79.4",
|
|
4
4
|
"description": "Enable support for http_proxy, https_proxy and no_proxy env variables",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"registry": "https://registry.npmjs.org/"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"undici": "^7.
|
|
26
|
+
"undici": "^7.18.2"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@tramvai/tokens-common": "6.79.
|
|
30
|
-
"@tramvai/tokens-http-client": "6.79.
|
|
31
|
-
"@tramvai/tokens-metrics": "6.79.
|
|
29
|
+
"@tramvai/tokens-common": "6.79.4",
|
|
30
|
+
"@tramvai/tokens-http-client": "6.79.4",
|
|
31
|
+
"@tramvai/tokens-metrics": "6.79.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@tinkoff/dippy": "0.12.7",
|
|
35
|
-
"@tramvai/core": "6.79.
|
|
35
|
+
"@tramvai/core": "6.79.4",
|
|
36
36
|
"tslib": "^2.4.0",
|
|
37
37
|
"undici": "*"
|
|
38
38
|
}
|