@adalo/metrics 0.1.62 → 0.1.63
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/redisUtils.d.ts +13 -11
- package/lib/redisUtils.d.ts.map +1 -1
- package/lib/redisUtils.js +10 -8
- package/lib/redisUtils.js.map +1 -1
- package/package.json +1 -1
- package/src/redisUtils.js +10 -8
package/lib/redisUtils.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Creates a configured setClientName function.
|
|
2
|
+
* Creates a configured setClientName function for node-redis v3.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} [defaultAppName='undefined-app'] - Fallback app name if METRICS_APP_NAME is not set.
|
|
5
|
-
* @returns {(client:
|
|
5
|
+
* @returns {(client: any, name: string) => void}
|
|
6
6
|
*/
|
|
7
|
-
export function createSetClientNameForRedisV3(defaultAppName?: string | undefined): (client:
|
|
7
|
+
export function createSetClientNameForRedisV3(defaultAppName?: string | undefined): (client: any, name: string) => void;
|
|
8
8
|
/**
|
|
9
|
-
* Creates a function to set Redis client name for node-redis v4
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
9
|
+
* Creates a function to set Redis client name for node-redis v4.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} [defaultAppName='undefined-app']
|
|
12
|
+
* @returns {(client: any, name: string) => void}
|
|
12
13
|
*/
|
|
13
|
-
export function createSetClientNameForRedisV4(defaultAppName?: string): (client:
|
|
14
|
+
export function createSetClientNameForRedisV4(defaultAppName?: string | undefined): (client: any, name: string) => void;
|
|
14
15
|
/**
|
|
15
|
-
* Creates a function to set Redis client name for ioredis
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
16
|
+
* Creates a function to set Redis client name for ioredis.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} [defaultAppName='undefined-app']
|
|
19
|
+
* @returns {(client: any, name: string) => void}
|
|
18
20
|
*/
|
|
19
|
-
export function createSetClientNameForIoredis(defaultAppName?: string): (client:
|
|
21
|
+
export function createSetClientNameForIoredis(defaultAppName?: string | undefined): (client: any, name: string) => void;
|
|
20
22
|
//# sourceMappingURL=redisUtils.d.ts.map
|
package/lib/redisUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redisUtils.d.ts","sourceRoot":"","sources":["../src/redisUtils.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,6FAFsB,
|
|
1
|
+
{"version":3,"file":"redisUtils.d.ts","sourceRoot":"","sources":["../src/redisUtils.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,6FAFsB,GAAG,QAAQ,MAAM,KAAK,IAAI,CAuB/C;AA4BD;;;;;GAKG;AACH,6FAFsB,GAAG,QAAQ,MAAM,KAAK,IAAI,CAsB/C;AApDD;;;;;GAKG;AACH,6FAFsB,GAAG,QAAQ,MAAM,KAAK,IAAI,CAoB/C"}
|
package/lib/redisUtils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Creates a configured setClientName function.
|
|
4
|
+
* Creates a configured setClientName function for node-redis v3.
|
|
5
5
|
*
|
|
6
6
|
* @param {string} [defaultAppName='undefined-app'] - Fallback app name if METRICS_APP_NAME is not set.
|
|
7
|
-
* @returns {(client:
|
|
7
|
+
* @returns {(client: any, name: string) => void}
|
|
8
8
|
*/
|
|
9
9
|
const createSetClientNameForRedisV3 = (defaultAppName = 'undefined-app') => {
|
|
10
10
|
return (client, name) => {
|
|
@@ -25,9 +25,10 @@ const createSetClientNameForRedisV3 = (defaultAppName = 'undefined-app') => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Creates a function to set Redis client name for ioredis
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
28
|
+
* Creates a function to set Redis client name for ioredis.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} [defaultAppName='undefined-app']
|
|
31
|
+
* @returns {(client: any, name: string) => void}
|
|
31
32
|
*/
|
|
32
33
|
const createSetClientNameForIoredis = (defaultAppName = 'undefined-app') => {
|
|
33
34
|
return (client, name) => {
|
|
@@ -46,9 +47,10 @@ const createSetClientNameForIoredis = (defaultAppName = 'undefined-app') => {
|
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
|
-
* Creates a function to set Redis client name for node-redis v4
|
|
50
|
-
*
|
|
51
|
-
* @
|
|
50
|
+
* Creates a function to set Redis client name for node-redis v4.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} [defaultAppName='undefined-app']
|
|
53
|
+
* @returns {(client: any, name: string) => void}
|
|
52
54
|
*/
|
|
53
55
|
const createSetClientNameForRedisV4 = (defaultAppName = 'undefined-app') => {
|
|
54
56
|
return (client, name) => {
|
package/lib/redisUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redisUtils.js","names":["createSetClientNameForRedisV3","defaultAppName","client","name","appName","process","env","METRICS_APP_NAME","dyno","BUILD_DYNO_PROCESS_TYPE","NODE_ENV","on","send_command","err","console","error","log","pid","createSetClientNameForIoredis","once","call","then","catch","createSetClientNameForRedisV4","sendCommand","module","exports"],"sources":["../src/redisUtils.js"],"sourcesContent":["/**\n * Creates a configured setClientName function.\n *\n * @param {string} [defaultAppName='undefined-app'] - Fallback app name if METRICS_APP_NAME is not set.\n * @returns {(client:
|
|
1
|
+
{"version":3,"file":"redisUtils.js","names":["createSetClientNameForRedisV3","defaultAppName","client","name","appName","process","env","METRICS_APP_NAME","dyno","BUILD_DYNO_PROCESS_TYPE","NODE_ENV","on","send_command","err","console","error","log","pid","createSetClientNameForIoredis","once","call","then","catch","createSetClientNameForRedisV4","sendCommand","module","exports"],"sources":["../src/redisUtils.js"],"sourcesContent":["/**\n * Creates a configured setClientName function for node-redis v3.\n *\n * @param {string} [defaultAppName='undefined-app'] - Fallback app name if METRICS_APP_NAME is not set.\n * @returns {(client: any, name: string) => void}\n */\nconst createSetClientNameForRedisV3 = (defaultAppName = 'undefined-app') => {\n return (client, name) => {\n const appName = process.env.METRICS_APP_NAME || defaultAppName\n const dyno = process.env.BUILD_DYNO_PROCESS_TYPE || 'undefined-dyno'\n\n if (process.env.NODE_ENV !== 'test') {\n client.on('connect', () => {\n client.send_command(\n 'CLIENT',\n ['SETNAME', `${appName}:${dyno}:${name}`],\n err => {\n if (err) {\n console.error(`Failed to set client name for ${name}:`, err)\n } else {\n console.log(`Connected to Redis for pid:${process.pid} (${name})`)\n }\n }\n )\n })\n }\n }\n}\n\n/**\n * Creates a function to set Redis client name for ioredis.\n *\n * @param {string} [defaultAppName='undefined-app']\n * @returns {(client: any, name: string) => void}\n */\nconst createSetClientNameForIoredis = (defaultAppName = 'undefined-app') => {\n return (client, name) => {\n const appName = process.env.METRICS_APP_NAME || defaultAppName\n const dyno = process.env.BUILD_DYNO_PROCESS_TYPE || 'undefined-dyno'\n\n if (process.env.NODE_ENV !== 'test') {\n client.once('connect', () => {\n client\n .call('CLIENT', ['SETNAME', `${appName}:${dyno}:${name}`])\n .then(() => {\n console.log(`Connected to Redis for pid:${process.pid} (${name})`)\n })\n .catch(err => {\n console.error(`Failed to set client name for ${name}:`, err)\n })\n })\n }\n }\n}\n\n/**\n * Creates a function to set Redis client name for node-redis v4.\n *\n * @param {string} [defaultAppName='undefined-app']\n * @returns {(client: any, name: string) => void}\n */\nconst createSetClientNameForRedisV4 = (defaultAppName = 'undefined-app') => {\n return (client, name) => {\n const appName = process.env.METRICS_APP_NAME || defaultAppName\n const dyno = process.env.BUILD_DYNO_PROCESS_TYPE || 'undefined-dyno'\n\n if (process.env.NODE_ENV !== 'test') {\n client.on('ready', async () => {\n try {\n await client.sendCommand([\n 'CLIENT',\n 'SETNAME',\n `${appName}:${dyno}:${name}`,\n ])\n console.log(`Connected to Redis for pid:${process.pid} (${name})`)\n } catch (err) {\n console.error(`Failed to set client name for ${name}:`, err)\n }\n })\n }\n }\n}\n\nmodule.exports = {\n createSetClientNameForRedisV3,\n createSetClientNameForRedisV4,\n createSetClientNameForIoredis,\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,6BAA6B,GAAGA,CAACC,cAAc,GAAG,eAAe,KAAK;EAC1E,OAAO,CAACC,MAAM,EAAEC,IAAI,KAAK;IACvB,MAAMC,OAAO,GAAGC,OAAO,CAACC,GAAG,CAACC,gBAAgB,IAAIN,cAAc;IAC9D,MAAMO,IAAI,GAAGH,OAAO,CAACC,GAAG,CAACG,uBAAuB,IAAI,gBAAgB;IAEpE,IAAIJ,OAAO,CAACC,GAAG,CAACI,QAAQ,KAAK,MAAM,EAAE;MACnCR,MAAM,CAACS,EAAE,CAAC,SAAS,EAAE,MAAM;QACzBT,MAAM,CAACU,YAAY,CACjB,QAAQ,EACR,CAAC,SAAS,EAAE,GAAGR,OAAO,IAAII,IAAI,IAAIL,IAAI,EAAE,CAAC,EACzCU,GAAG,IAAI;UACL,IAAIA,GAAG,EAAE;YACPC,OAAO,CAACC,KAAK,CAAC,iCAAiCZ,IAAI,GAAG,EAAEU,GAAG,CAAC;UAC9D,CAAC,MAAM;YACLC,OAAO,CAACE,GAAG,CAAC,8BAA8BX,OAAO,CAACY,GAAG,KAAKd,IAAI,GAAG,CAAC;UACpE;QACF,CACF,CAAC;MACH,CAAC,CAAC;IACJ;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMe,6BAA6B,GAAGA,CAACjB,cAAc,GAAG,eAAe,KAAK;EAC1E,OAAO,CAACC,MAAM,EAAEC,IAAI,KAAK;IACvB,MAAMC,OAAO,GAAGC,OAAO,CAACC,GAAG,CAACC,gBAAgB,IAAIN,cAAc;IAC9D,MAAMO,IAAI,GAAGH,OAAO,CAACC,GAAG,CAACG,uBAAuB,IAAI,gBAAgB;IAEpE,IAAIJ,OAAO,CAACC,GAAG,CAACI,QAAQ,KAAK,MAAM,EAAE;MACnCR,M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CAAC;AAEDY,MAAM,CAACC,OAAO,GAAG;EACf1B,6BAA6B;EAC7BuB,6BAA6B;EAC7BL;AACF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
package/src/redisUtils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Creates a configured setClientName function.
|
|
2
|
+
* Creates a configured setClientName function for node-redis v3.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} [defaultAppName='undefined-app'] - Fallback app name if METRICS_APP_NAME is not set.
|
|
5
|
-
* @returns {(client:
|
|
5
|
+
* @returns {(client: any, name: string) => void}
|
|
6
6
|
*/
|
|
7
7
|
const createSetClientNameForRedisV3 = (defaultAppName = 'undefined-app') => {
|
|
8
8
|
return (client, name) => {
|
|
@@ -28,9 +28,10 @@ const createSetClientNameForRedisV3 = (defaultAppName = 'undefined-app') => {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Creates a function to set Redis client name for ioredis
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
31
|
+
* Creates a function to set Redis client name for ioredis.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} [defaultAppName='undefined-app']
|
|
34
|
+
* @returns {(client: any, name: string) => void}
|
|
34
35
|
*/
|
|
35
36
|
const createSetClientNameForIoredis = (defaultAppName = 'undefined-app') => {
|
|
36
37
|
return (client, name) => {
|
|
@@ -53,9 +54,10 @@ const createSetClientNameForIoredis = (defaultAppName = 'undefined-app') => {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
|
-
* Creates a function to set Redis client name for node-redis v4
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
57
|
+
* Creates a function to set Redis client name for node-redis v4.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} [defaultAppName='undefined-app']
|
|
60
|
+
* @returns {(client: any, name: string) => void}
|
|
59
61
|
*/
|
|
60
62
|
const createSetClientNameForRedisV4 = (defaultAppName = 'undefined-app') => {
|
|
61
63
|
return (client, name) => {
|