13 lines
401 B
JavaScript
13 lines
401 B
JavaScript
async function pushToMetrics(metric) {
|
|
if (!metric || !metric.type) return;
|
|
|
|
const payload = { ...metric, timestamp: Date.now() };
|
|
|
|
fetch("http://metrics:4005/push", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify(payload)
|
|
}).catch(err => console.error("Metrics push error:", err));
|
|
}
|
|
|
|
module.exports = { pushToMetrics }; |