@8ms/helpers 2.3.40 → 2.3.41
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.
|
@@ -41,8 +41,8 @@ declare class AwsCloudWatchLogNamespace extends BaseNamespace {
|
|
|
41
41
|
* Checks whether a CloudWatch Log Stream exists within a given Log Group.
|
|
42
42
|
*/
|
|
43
43
|
logStreamExists: (logGroupName: string, logStreamName: string) => Promise<boolean>;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
logEvent: (logGroupName: string, logStreamName: string, logEvent: LogEvent) => Promise<_aws_sdk_client_cloudwatch_logs0.PutLogEventsCommandOutput>;
|
|
45
|
+
logEvents: (logGroupName: string, logStreamName: string, logEvents: LogEvent[]) => Promise<_aws_sdk_client_cloudwatch_logs0.PutLogEventsCommandOutput>;
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/aws/cloudWatchLog/server/awsCloudWatchLog.d.ts
|
|
@@ -58,10 +58,10 @@ var AwsCloudWatchLogNamespace = class extends BaseNamespace {
|
|
|
58
58
|
if (!response?.logStreams || 0 === response.logStreams.length) return false;
|
|
59
59
|
return true;
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
return await this.
|
|
61
|
+
logEvent = async (logGroupName, logStreamName, logEvent) => {
|
|
62
|
+
return await this.logEvents(logGroupName, logStreamName, [logEvent]);
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
logEvents = async (logGroupName, logStreamName, logEvents) => {
|
|
65
65
|
await this.ensureInit();
|
|
66
66
|
const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
67
67
|
return await this.client.send(new PutLogEventsCommand({
|
|
@@ -26,7 +26,7 @@ declare class AwsCloudWatchMetricNamespace extends BaseNamespace {
|
|
|
26
26
|
* The namespace is created automatically.
|
|
27
27
|
* Dimensions should contain additional info (but top level).
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
logMetric: (namespace: string, metricData: LogMetric | LogMetric[]) => Promise<_aws_sdk_client_cloudwatch0.PutMetricDataCommandOutput>;
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/aws/cloudWatchMetric/server/awsCloudWatchMetric.d.ts
|
|
@@ -2,6 +2,7 @@ import { getArray } from "../../../array/index.mjs";
|
|
|
2
2
|
import { BaseNamespace } from "../../../_class/index.mjs";
|
|
3
3
|
import { getLuxonDate } from "../../../date/index.mjs";
|
|
4
4
|
import { t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
|
|
5
|
+
import { StandardUnit } from "@aws-sdk/client-cloudwatch";
|
|
5
6
|
|
|
6
7
|
//#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.ts
|
|
7
8
|
var AwsCloudWatchMetricNamespace = class extends BaseNamespace {
|
|
@@ -18,7 +19,7 @@ var AwsCloudWatchMetricNamespace = class extends BaseNamespace {
|
|
|
18
19
|
* The namespace is created automatically.
|
|
19
20
|
* Dimensions should contain additional info (but top level).
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
logMetric = async (namespace, metricData) => {
|
|
22
23
|
await this.ensureInit();
|
|
23
24
|
const { PutMetricDataCommand } = await import("@aws-sdk/client-cloudwatch");
|
|
24
25
|
const data = getArray(metricData);
|
|
@@ -27,7 +28,7 @@ var AwsCloudWatchMetricNamespace = class extends BaseNamespace {
|
|
|
27
28
|
MetricData: data.map((metric) => ({
|
|
28
29
|
MetricName: metric.metricName,
|
|
29
30
|
Value: metric.value,
|
|
30
|
-
Unit: metric.
|
|
31
|
+
Unit: metric?.unit || StandardUnit.Count,
|
|
31
32
|
Timestamp: getLuxonDate(metric.timestamp).toJSDate(),
|
|
32
33
|
Dimensions: metric.dimensions?.map((dimension) => ({
|
|
33
34
|
Name: dimension.name,
|