in src/poller/poller-core/index.js [355:389]
async function getMetrics(cluster) {
logger.info({
message: `----- ${cluster.projectId}/${cluster.regionId}/${cluster.clusterId}: Getting Metrics -----`,
projectId: cluster.projectId,
regionId: cluster.regionId,
clusterId: cluster.clusterId,
});
/** @type {MemorystoreClusterMetricValue[]} */
const metrics = [];
for (const m of cluster.metrics) {
const metric = /** @type {MemorystoreClusterMetric} */ (m);
const [maxMetricValue, maxLocation] = await getMaxMetricValue(
cluster.projectId,
cluster.regionId,
cluster.clusterId,
metric,
);
logger.debug({
message: ` ${metric.name} = ${maxMetricValue}, period = ${metric.period}, location = ${maxLocation}`,
projectId: cluster.projectId,
regionId: cluster.regionId,
clusterId: cluster.clusterId,
});
/** @type {MemorystoreClusterMetricValue} */
const metricsObject = {
name: metric.name,
value: maxMetricValue,
};
metrics.push(metricsObject);
}
return metrics;
}