mblabs-roccato-backend-commons 1.0.60 → 1.0.62
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/dist/interfaces/aws.d.ts +1 -1
- package/dist/interfaces/gcp.d.ts +3 -3
- package/dist/services/aws/cloudwatch.js +8 -1
- package/dist/services/gcp/monitor.js +20 -3
- package/package.json +2 -3
- package/src/interfaces/aws.ts +1 -7
- package/src/interfaces/gcp.ts +3 -3
- package/src/services/aws/cloudwatch.ts +10 -2
- package/src/services/gcp/monitor.ts +26 -3
- package/yarn.lock +23 -28
package/dist/interfaces/aws.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare namespace AmazonCloudwatch {
|
|
|
36
36
|
value: string;
|
|
37
37
|
}[];
|
|
38
38
|
value: number;
|
|
39
|
-
unit: '
|
|
39
|
+
unit: 'Time' | 'Count' | 'Percent' | 'Bytes' | 'None';
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
credentials: Credentials;
|
package/dist/interfaces/gcp.d.ts
CHANGED
|
@@ -59,11 +59,11 @@ export declare namespace GoogleMonitor {
|
|
|
59
59
|
metric: {
|
|
60
60
|
title: string;
|
|
61
61
|
value: number;
|
|
62
|
-
typeof: '
|
|
63
|
-
measure: '
|
|
62
|
+
typeof: 'Boolean' | 'String' | 'Int' | 'Double' | 'Decimal';
|
|
63
|
+
measure: 'Gauge' | 'Delta' | 'Cumulative';
|
|
64
64
|
labels: {
|
|
65
65
|
key: string;
|
|
66
|
-
typeof: '
|
|
66
|
+
typeof: 'Boolean' | 'String' | 'Int';
|
|
67
67
|
description: string;
|
|
68
68
|
}[];
|
|
69
69
|
};
|
|
@@ -11,6 +11,13 @@ class AmazonCloudwatchService {
|
|
|
11
11
|
},
|
|
12
12
|
region: credentials.region,
|
|
13
13
|
});
|
|
14
|
+
const UnitMap = {
|
|
15
|
+
Time: 'Milliseconds',
|
|
16
|
+
Count: 'Count',
|
|
17
|
+
Percent: 'Percent',
|
|
18
|
+
Bytes: 'Bytes',
|
|
19
|
+
None: 'None',
|
|
20
|
+
};
|
|
14
21
|
await client.putMetricData({
|
|
15
22
|
Namespace: data.namespace,
|
|
16
23
|
MetricData: [
|
|
@@ -21,7 +28,7 @@ class AmazonCloudwatchService {
|
|
|
21
28
|
Value: dimension.value,
|
|
22
29
|
})),
|
|
23
30
|
Value: data.metric.value,
|
|
24
|
-
Unit: data.metric.unit,
|
|
31
|
+
Unit: UnitMap[data.metric.unit] || 'None',
|
|
25
32
|
},
|
|
26
33
|
],
|
|
27
34
|
});
|
|
@@ -7,17 +7,34 @@ class GoogleMonitorService {
|
|
|
7
7
|
apiKey: credentials.apiKey,
|
|
8
8
|
projectId: credentials.project,
|
|
9
9
|
});
|
|
10
|
+
const MetricKindMap = {
|
|
11
|
+
Gauge: 'GAUGE',
|
|
12
|
+
Delta: 'DELTA',
|
|
13
|
+
Cumulative: 'CUMULATIVE',
|
|
14
|
+
};
|
|
15
|
+
const ValueTypeMap = {
|
|
16
|
+
Boolean: 'BOOL',
|
|
17
|
+
String: 'STRING',
|
|
18
|
+
Int: 'INT64',
|
|
19
|
+
Double: 'DOUBLE',
|
|
20
|
+
Decimal: 'MONEY',
|
|
21
|
+
};
|
|
22
|
+
const LabelValueTypeMap = {
|
|
23
|
+
Boolean: 'BOOL',
|
|
24
|
+
String: 'STRING',
|
|
25
|
+
Int: 'INT64',
|
|
26
|
+
};
|
|
10
27
|
await client.createMetricDescriptor({
|
|
11
28
|
name: client.projectPath(credentials.project),
|
|
12
29
|
metricDescriptor: {
|
|
13
30
|
name: data.metric.title,
|
|
14
31
|
type: data.namespace,
|
|
15
|
-
metricKind: data.metric.measure,
|
|
16
|
-
valueType: data.metric.typeof,
|
|
32
|
+
metricKind: MetricKindMap[data.metric.measure] || 'METRIC_KIND_UNSPECIFIED',
|
|
33
|
+
valueType: ValueTypeMap[data.metric.typeof] || 'VALUE_TYPE_UNSPECIFIED',
|
|
17
34
|
unit: data.metric.value.toString(),
|
|
18
35
|
labels: data.metric.labels.map((label) => ({
|
|
19
36
|
key: label.key,
|
|
20
|
-
valueType: label.typeof,
|
|
37
|
+
valueType: LabelValueTypeMap[label.typeof],
|
|
21
38
|
description: label.description,
|
|
22
39
|
})),
|
|
23
40
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mblabs-roccato-backend-commons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.62",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
"@azure/communication-sms": "^1.2.0-beta.3",
|
|
53
53
|
"@azure/identity": "^4.9.1",
|
|
54
54
|
"@azure/keyvault-secrets": "^4.9.0",
|
|
55
|
-
"@azure/monitor-
|
|
56
|
-
"@azure/monitor-query-metrics": "^1.0.0",
|
|
55
|
+
"@azure/monitor-ingestion": "^1.2.0",
|
|
57
56
|
"@azure/msal-node": "^3.8.0",
|
|
58
57
|
"@azure/storage-blob": "^12.27.0",
|
|
59
58
|
"@google-cloud/monitoring": "^5.3.0",
|
package/src/interfaces/aws.ts
CHANGED
|
@@ -40,13 +40,7 @@ export namespace AmazonCloudwatch {
|
|
|
40
40
|
value: string
|
|
41
41
|
}[];
|
|
42
42
|
value: number;
|
|
43
|
-
unit:
|
|
44
|
-
'Count' |
|
|
45
|
-
'Percent' |
|
|
46
|
-
'Seconds' |
|
|
47
|
-
'Microseconds' |
|
|
48
|
-
'Milliseconds' |
|
|
49
|
-
'None';
|
|
43
|
+
unit: 'Time' | 'Count' | 'Percent' | 'Bytes' | 'None';
|
|
50
44
|
};
|
|
51
45
|
};
|
|
52
46
|
credentials: Credentials;
|
package/src/interfaces/gcp.ts
CHANGED
|
@@ -65,11 +65,11 @@ export namespace GoogleMonitor {
|
|
|
65
65
|
metric: {
|
|
66
66
|
title: string;
|
|
67
67
|
value: number;
|
|
68
|
-
typeof: '
|
|
69
|
-
measure: '
|
|
68
|
+
typeof: 'Boolean' | 'String' | 'Int' | 'Double' | 'Decimal',
|
|
69
|
+
measure: 'Gauge' | 'Delta' | 'Cumulative',
|
|
70
70
|
labels: {
|
|
71
71
|
key: string;
|
|
72
|
-
typeof: '
|
|
72
|
+
typeof: 'Boolean' | 'String' | 'Int';
|
|
73
73
|
description: string;
|
|
74
74
|
}[];
|
|
75
75
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CloudWatch } from '@aws-sdk/client-cloudwatch';
|
|
2
|
-
import { CloudWatchLogs } from '@aws-sdk/client-cloudwatch-logs';
|
|
2
|
+
import { CloudWatchLogs, StandardUnit } from '@aws-sdk/client-cloudwatch-logs';
|
|
3
3
|
|
|
4
4
|
import { AmazonCloudwatch, IAmazonCloudwatchService } from '../../interfaces';
|
|
5
5
|
|
|
@@ -13,6 +13,14 @@ class AmazonCloudwatchService implements IAmazonCloudwatchService {
|
|
|
13
13
|
region: credentials.region,
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
const UnitMap: Record<'Time' | 'Count' | 'Percent' | 'Bytes' | 'None', StandardUnit> = {
|
|
17
|
+
Time: 'Milliseconds',
|
|
18
|
+
Count: 'Count',
|
|
19
|
+
Percent: 'Percent',
|
|
20
|
+
Bytes: 'Bytes',
|
|
21
|
+
None: 'None',
|
|
22
|
+
};
|
|
23
|
+
|
|
16
24
|
await client.putMetricData({
|
|
17
25
|
Namespace: data.namespace,
|
|
18
26
|
MetricData: [
|
|
@@ -23,7 +31,7 @@ class AmazonCloudwatchService implements IAmazonCloudwatchService {
|
|
|
23
31
|
Value: dimension.value,
|
|
24
32
|
})),
|
|
25
33
|
Value: data.metric.value,
|
|
26
|
-
Unit: data.metric.unit,
|
|
34
|
+
Unit: UnitMap[data.metric.unit] || 'None',
|
|
27
35
|
},
|
|
28
36
|
],
|
|
29
37
|
});
|
|
@@ -12,17 +12,40 @@ class GoogleMonitorService implements IGoogleMonitorService {
|
|
|
12
12
|
projectId: credentials.project,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
+
const MetricKindMap: Record<'Gauge' | 'Delta' | 'Cumulative', 'GAUGE' | 'DELTA' | 'CUMULATIVE'> = {
|
|
16
|
+
Gauge: 'GAUGE',
|
|
17
|
+
Delta: 'DELTA',
|
|
18
|
+
Cumulative: 'CUMULATIVE',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ValueTypeMap: Record<
|
|
22
|
+
'Boolean' | 'String' | 'Int' | 'Double' | 'Decimal',
|
|
23
|
+
'BOOL' | 'INT64' | 'DOUBLE' | 'STRING' | 'DISTRIBUTION' | 'MONEY'
|
|
24
|
+
> = {
|
|
25
|
+
Boolean: 'BOOL',
|
|
26
|
+
String: 'STRING',
|
|
27
|
+
Int: 'INT64',
|
|
28
|
+
Double: 'DOUBLE',
|
|
29
|
+
Decimal: 'MONEY',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const LabelValueTypeMap: Record<'Boolean' | 'String' | 'Int', 'BOOL' | 'INT64' | 'STRING'> = {
|
|
33
|
+
Boolean: 'BOOL',
|
|
34
|
+
String: 'STRING',
|
|
35
|
+
Int: 'INT64',
|
|
36
|
+
};
|
|
37
|
+
|
|
15
38
|
await client.createMetricDescriptor({
|
|
16
39
|
name: client.projectPath(credentials.project),
|
|
17
40
|
metricDescriptor: {
|
|
18
41
|
name: data.metric.title,
|
|
19
42
|
type: data.namespace,
|
|
20
|
-
metricKind: data.metric.measure,
|
|
21
|
-
valueType: data.metric.typeof,
|
|
43
|
+
metricKind: MetricKindMap[data.metric.measure] || 'METRIC_KIND_UNSPECIFIED',
|
|
44
|
+
valueType: ValueTypeMap[data.metric.typeof] || 'VALUE_TYPE_UNSPECIFIED',
|
|
22
45
|
unit: data.metric.value.toString(),
|
|
23
46
|
labels: data.metric.labels.map((label) => ({
|
|
24
47
|
key: label.key,
|
|
25
|
-
valueType: label.typeof,
|
|
48
|
+
valueType: LabelValueTypeMap[label.typeof],
|
|
26
49
|
description: label.description,
|
|
27
50
|
})),
|
|
28
51
|
},
|
package/yarn.lock
CHANGED
|
@@ -1257,7 +1257,7 @@
|
|
|
1257
1257
|
resolved "https://registry.yarnpkg.com/@aws/lambda-invoke-store/-/lambda-invoke-store-0.0.1.tgz#92d792a7dda250dfcb902e13228f37a81be57c8f"
|
|
1258
1258
|
integrity sha512-ORHRQ2tmvnBXc8t/X9Z8IcSbBA4xTLKuN873FopzklHMeqBst7YG0d+AX97inkvDX+NChYtSr+qGfcqGFaI8Zw==
|
|
1259
1259
|
|
|
1260
|
-
"@azure-rest/core-client@^2.
|
|
1260
|
+
"@azure-rest/core-client@^2.4.0":
|
|
1261
1261
|
version "2.5.1"
|
|
1262
1262
|
resolved "https://registry.yarnpkg.com/@azure-rest/core-client/-/core-client-2.5.1.tgz#4c1346d6698d7a40252869799958928ac98babe8"
|
|
1263
1263
|
integrity sha512-EHaOXW0RYDKS5CFffnixdyRPak5ytiCtU7uXDcP/uiY+A6jFRwNGzzJBiznkCzvi5EYpY+YWinieqHb0oY916A==
|
|
@@ -1377,7 +1377,7 @@
|
|
|
1377
1377
|
"@azure/logger" "^1.0.0"
|
|
1378
1378
|
tslib "^2.6.2"
|
|
1379
1379
|
|
|
1380
|
-
"@azure/core-paging@^1.1.1"
|
|
1380
|
+
"@azure/core-paging@^1.1.1":
|
|
1381
1381
|
version "1.6.2"
|
|
1382
1382
|
resolved "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.6.2.tgz#40d3860dc2df7f291d66350b2cfd9171526433e7"
|
|
1383
1383
|
integrity sha512-YKWi9YuCU04B55h25cnOYZHxXYtEvQEbKST5vqRga7hWY9ydd3FZHdeQF8pyh+acWZvppw13M/LMGx0LABUVMA==
|
|
@@ -1533,6 +1533,22 @@
|
|
|
1533
1533
|
"@typespec/ts-http-runtime" "^0.3.0"
|
|
1534
1534
|
tslib "^2.6.2"
|
|
1535
1535
|
|
|
1536
|
+
"@azure/monitor-ingestion@^1.2.0":
|
|
1537
|
+
version "1.2.0"
|
|
1538
|
+
resolved "https://registry.yarnpkg.com/@azure/monitor-ingestion/-/monitor-ingestion-1.2.0.tgz#7bd4e0e4987530395ff9a18d501b33b930e3cee9"
|
|
1539
|
+
integrity sha512-e03DQeZCVsUoCLxTF6AMAs3YSQTv2/X4685dp1+p84ctArCWNckVbzOgPKGcWn+A5oUit9rtEyujH1iIL5SIdQ==
|
|
1540
|
+
dependencies:
|
|
1541
|
+
"@azure-rest/core-client" "^2.4.0"
|
|
1542
|
+
"@azure/abort-controller" "^2.1.2"
|
|
1543
|
+
"@azure/core-auth" "^1.9.0"
|
|
1544
|
+
"@azure/core-client" "^1.9.2"
|
|
1545
|
+
"@azure/core-rest-pipeline" "^1.19.0"
|
|
1546
|
+
"@azure/core-tracing" "^1.2.0"
|
|
1547
|
+
"@azure/core-util" "^1.11.0"
|
|
1548
|
+
"@azure/logger" "^1.1.4"
|
|
1549
|
+
pako "^2.1.0"
|
|
1550
|
+
tslib "^2.8.1"
|
|
1551
|
+
|
|
1536
1552
|
"@azure/monitor-opentelemetry-exporter@1.0.0-beta.31", "@azure/monitor-opentelemetry-exporter@^1.0.0-beta.31":
|
|
1537
1553
|
version "1.0.0-beta.31"
|
|
1538
1554
|
resolved "https://registry.npmjs.org/@azure/monitor-opentelemetry-exporter/-/monitor-opentelemetry-exporter-1.0.0-beta.31.tgz#5a560c0ac35aa7b09c6898c89ec514d2fc9fe4c1"
|
|
@@ -1586,32 +1602,6 @@
|
|
|
1586
1602
|
"@opentelemetry/winston-transport" "^0.10.1"
|
|
1587
1603
|
tslib "^2.8.1"
|
|
1588
1604
|
|
|
1589
|
-
"@azure/monitor-query-metrics@^1.0.0":
|
|
1590
|
-
version "1.0.0"
|
|
1591
|
-
resolved "https://registry.yarnpkg.com/@azure/monitor-query-metrics/-/monitor-query-metrics-1.0.0.tgz#6c942fd797787ba636e5d806a3d00a1f096866b6"
|
|
1592
|
-
integrity sha512-/VzDAVKsQnMnDHmk+y+AdoOJpG/DGGUghsDR3QgiwIW/94rBLLyw/QhjbzeBO3qbJhj+akCVK7j0vW5kNFppUA==
|
|
1593
|
-
dependencies:
|
|
1594
|
-
"@azure-rest/core-client" "^2.5.0"
|
|
1595
|
-
"@azure/core-auth" "^1.9.0"
|
|
1596
|
-
"@azure/core-rest-pipeline" "^1.19.0"
|
|
1597
|
-
"@azure/core-tracing" "^1.2.0"
|
|
1598
|
-
"@azure/logger" "^1.1.4"
|
|
1599
|
-
tslib "^2.8.1"
|
|
1600
|
-
|
|
1601
|
-
"@azure/monitor-query@^1.3.3":
|
|
1602
|
-
version "1.3.3"
|
|
1603
|
-
resolved "https://registry.yarnpkg.com/@azure/monitor-query/-/monitor-query-1.3.3.tgz#d9a3b4b77f1d6d6807fec539cf9b32a0c203d4eb"
|
|
1604
|
-
integrity sha512-wm91Wengw8SGmPbuPrB+Q+ydK7m9yyytoj03Z9/LZT3wQpAm1RizSFonjP7eyL4g4Xwhkp92okylIrmh2lD99A==
|
|
1605
|
-
dependencies:
|
|
1606
|
-
"@azure/core-auth" "^1.9.0"
|
|
1607
|
-
"@azure/core-client" "^1.9.2"
|
|
1608
|
-
"@azure/core-paging" "^1.6.2"
|
|
1609
|
-
"@azure/core-rest-pipeline" "^1.19.0"
|
|
1610
|
-
"@azure/core-tracing" "^1.2.0"
|
|
1611
|
-
"@azure/core-util" "^1.11.0"
|
|
1612
|
-
"@azure/logger" "^1.1.4"
|
|
1613
|
-
tslib "^2.8.1"
|
|
1614
|
-
|
|
1615
1605
|
"@azure/msal-browser@^4.2.0":
|
|
1616
1606
|
version "4.13.0"
|
|
1617
1607
|
resolved "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.13.0.tgz#a8777fab55544433581b52dd7f86e3de1532dde6"
|
|
@@ -6992,6 +6982,11 @@ package-json-from-dist@^1.0.0:
|
|
|
6992
6982
|
resolved "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505"
|
|
6993
6983
|
integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==
|
|
6994
6984
|
|
|
6985
|
+
pako@^2.1.0:
|
|
6986
|
+
version "2.1.0"
|
|
6987
|
+
resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86"
|
|
6988
|
+
integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==
|
|
6989
|
+
|
|
6995
6990
|
parent-module@^1.0.0:
|
|
6996
6991
|
version "1.0.1"
|
|
6997
6992
|
resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
|