UNPKG

@netlify/build

Version:
18 lines (17 loc) 668 B
import { closeClient, formatTags, startClient, validateStatsDOptions } from '../report/statsd.js'; /** * Record number of functions build and differentiate between autogenerated and user generated. * Sends to statsd daemon. */ export const reportMetrics = async function (statsdOpts, metrics) { if (!validateStatsDOptions(statsdOpts) || metrics.length === 0) { return; } const client = await startClient(statsdOpts); metrics.forEach((metric) => { if (typeof client[metric.type] === 'function') { client[metric.type](metric.name, metric.value, formatTags(metric.tags)); } }); await closeClient(client); };