mblabs-roccato-backend-commons 1.0.60 → 1.0.61
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
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;
|
|
@@ -11,6 +11,13 @@ class AmazonCloudwatchService {
|
|
|
11
11
|
},
|
|
12
12
|
region: credentials.region,
|
|
13
13
|
});
|
|
14
|
+
const CloudwatchUnitMap = {
|
|
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: CloudwatchUnitMap[data.metric.unit] || 'None',
|
|
25
32
|
},
|
|
26
33
|
],
|
|
27
34
|
});
|
package/package.json
CHANGED
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;
|
|
@@ -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 CloudwatchUnitMap: 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: CloudwatchUnitMap[data.metric.unit] || 'None',
|
|
27
35
|
},
|
|
28
36
|
],
|
|
29
37
|
});
|