
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@nokkel/monitoring
Advanced tools
A monitoring library for integrating monitoring and observability platforms and generating logs for monitoring
A monitoring library for integrating monitoring and observability platforms and generating logs for monitoring.
To install this library follow the steps below:
npm add @nokkel/monitoring
Once installed you can use the library to do the following:
logger.ts
import { createLogger } from '@nokkel/monitoring';
export const logger = createLogger({
name: process.env.HOSTNAME,
logLevel: process.env.LOG_LEVEL,
// Can optionally configure the logger for the browser
// isBrowser: true,
});
Enjoy!
logger.loki.ts
import { createLokiLogger } from '@nokkel/monitoring/grafana';
export const logger = createLokiLogger({
name: process.env.SERVICE_NAME || 'my-service',
logLevel: (process.env.LOG_LEVEL as any) || 'info',
loki: {
host: process.env.LOKI_URL || 'http://localhost:3100',
labels: { service: 'my-service', env: process.env.NODE_ENV || 'dev' },
},
});
logger.info({ msg: 'hello loki' });
Alternatively, compose your own pino with a Loki destination:
import { createLogger } from '@nokkel/monitoring';
import { createLokiDestination } from '@nokkel/monitoring/grafana';
const destination = createLokiDestination({ host: 'http://localhost:3100' });
export const logger = createLogger({ name: 'svc', logLevel: 'info', destination });
Expose a /metrics endpoint Prometheus/Grafana Agent can scrape.
import { initMetrics, startMetricsServer, promClient } from '@nokkel/monitoring/metrics';
// set default labels and collect Node process metrics
initMetrics({ defaultLabels: { service: 'my-service' } });
// define custom metrics
export const requests = new promClient.Counter({ name: 'http_requests_total', help: 'Total HTTP requests' });
// start a metrics server on :9464/metrics
startMetricsServer({ port: 9464 });
Send traces via OTLP HTTP to Grafana Agent or Tempo.
import { initTracing } from '@nokkel/monitoring/tracing';
await initTracing({
serviceName: 'my-service',
serviceVersion: '1.0.0',
environment: process.env.NODE_ENV || 'dev',
otlpUrl: process.env.OTLP_TRACES_URL || 'http://localhost:4318/v1/traces',
});
// Your app code; auto-instrumentations cover http/express/etc.
Notes:
pino-loki. Ensure Grafana Loki accepts pushes at LOKI_URL.prom-client and are scrape-based (no Pushgateway assumed).OTLP_TRACES_URL to Grafana Agent/Tempo.FAQs
A monitoring library for integrating monitoring and observability platforms and generating logs for monitoring
We found that @nokkel/monitoring demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.