
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
@emartech/aggregate-metric-logger
Advanced tools
Aggregate metrics in memory and send them to GCP them every minute.
Set METRIC_LOGGER_ENABLED
env variable to true
for aggregate-metric-logger to
start collecting and logging measurements.
Set MONITORING_PROJECT_ID
and GCP_CREDENTIALS
env variables. HOSTNAME
env variable also has to be
set, but for a pod running on kubernetes this should already be set.
Add Monitoring Metrics Writer
Role to the service account in the GCP project.
const metricLogger = require('@emartech/aggregate-metric-logger')
metricLogger.count('etwas-went-wrong', { customer_id: 11 });
metricLogger.count('etwas-went-wrong', { customer_id: 11 });
// will aggregate these to a single metric
If you want aggregate measurements about something you need to simply call the measure
method
for each value:
const metricLogger = require('@emartech/aggregate-metric-logger')
metricLogger.measure('thing-to-measure', 14, { customer_id: 12 })
metricLogger.measure('thing-to-measure', 20, { customer_id: 44 })
For duration measurements, there are two convenient methods: start
, and stop
;
You start the measurement with start
, the counted value for aggregation will be the duration
between this start
and the matching stop
call;
function exampleIOHeavyFunction() {
const measurement = metricLogger.start('tag-for-the-measuement', { customer_id: 23 });
const result = db.findItems();
metricLogger.stop(measurement);
return result;
}
FAQs
aggregate metrics in memory for logging
The npm package @emartech/aggregate-metric-logger receives a total of 549 weekly downloads. As such, @emartech/aggregate-metric-logger popularity was classified as not popular.
We found that @emartech/aggregate-metric-logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 284 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.