mirror of
https://github.com/alexgo-io/redstone-cache-layer.git
synced 2026-01-12 16:53:15 +08:00
chore: disabled metrics saving in cloudwatch without removing metrics endpoint
This commit is contained in:
@@ -1,22 +1,26 @@
|
||||
import AWS from "aws-sdk";
|
||||
// import AWS from "aws-sdk";
|
||||
import { logger } from "../helpers/logger";
|
||||
import { isProduction } from "../config";
|
||||
// import { isProduction } from "../config";
|
||||
|
||||
export const saveMetric = async ({ label, value }) => {
|
||||
if (isProduction) {
|
||||
const cloudwatch = new AWS.CloudWatch({apiVersion: "2010-08-01"});
|
||||
// We disabled saving metrics in cloudwatch because of
|
||||
// rapidly growing costs. We've switched to our self-hosted
|
||||
// metrics storage in oracle-monitoring instances
|
||||
logger.info("Metric saving in AWS cloudwatch skipped");
|
||||
// if (isProduction) {
|
||||
// const cloudwatch = new AWS.CloudWatch({apiVersion: "2010-08-01"});
|
||||
|
||||
const metricParams = {
|
||||
MetricData: [{
|
||||
MetricName: label,
|
||||
Value: value,
|
||||
}],
|
||||
Namespace: "CustomPerformanceMetrics",
|
||||
};
|
||||
// const metricParams = {
|
||||
// MetricData: [{
|
||||
// MetricName: label,
|
||||
// Value: value,
|
||||
// }],
|
||||
// Namespace: "CustomPerformanceMetrics",
|
||||
// };
|
||||
|
||||
await cloudwatch.putMetricData(metricParams).promise();
|
||||
} else {
|
||||
logger.info(
|
||||
"Metric saving in AWS cloudwatch skipped in non-prod environment");
|
||||
}
|
||||
// await cloudwatch.putMetricData(metricParams).promise();
|
||||
// } else {
|
||||
// logger.info(
|
||||
// "Metric saving in AWS cloudwatch skipped in non-prod environment");
|
||||
// }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user