in src/poller/poller-core/index.js [599:627]
async function checkMemorystoreClusterScaleMetricsHTTP(req, res) {
const payload = JSON.stringify([
/** @type {AutoscalerMemorystoreCluster} */ ({
projectId: 'memorystore-cluster-scaler',
regionId: 'us-central1',
clusterId: 'autoscale-test',
scalerPubSubTopic:
'projects/memorystore-cluster-scaler/topics/test-scaling',
minSize: 3,
maxSize: 10,
stateProjectId: 'state-project-id',
units: AutoscalerUnits.SHARDS,
}),
]);
try {
const clusters = await parseAndEnrichPayload(payload);
await forwardMetrics(postPubSubMessage, clusters);
res.status(200).end();
await Counters.incRequestsSuccessCounter();
} catch (err) {
logger.error({
err: err,
payload: payload,
message: `An error occurred in the Autoscaler poller function (HTTP): ${err}`,
});
res.status(500).contentType('text/plain').end('An exception occurred');
await Counters.incRequestsFailedCounter();
}
}