Created
November 22, 2022 13:22
-
-
Save yaasita/3b7ed311aec61227979bd58f6d3a0c14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
CloudWatchClient, | |
PutMetricDataCommand, | |
} from "@aws-sdk/client-cloudwatch"; | |
const cw = new CloudWatchClient({ region: "ap-northeast-1" }); | |
async function putcloudwatch(name, count) { | |
const metricname = `${ENV}:${name}`; | |
const params = { | |
MetricData: [ | |
{ | |
MetricName: metricname, | |
Timestamp: new Date(), | |
Unit: "Count", | |
Value: count, | |
}, | |
], | |
Namespace: "WorkerQueues", | |
}; | |
const command = new PutMetricDataCommand(params); | |
const response = await cw.send(command); | |
console.log(`putMetric: ${metricname}, ${count}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment