Skip to content

[Module Listing Request]: nuxt-monitoring #1357

@NZ-WEB

Description

@NZ-WEB

Description

npm version
npm downloads
License
Nuxt

A Nuxt module for deep observability, providing separate debug server, health checks, and comprehensive metrics collection.

Features

  • 🐞  Debug server for monitoring endpoints on a separate port
  • 🩺  /health endpoint for health checks
  • 🚀  /ready endpoint for readiness probes
  • 📊  Standard metrics collection via prom-client
  • ➕  Additional metrics collection
  • ✨  Ability to collect custom metrics
  • 🐢  Lazy loading of endpoints

Additional Metrics

The module provides comprehensive metrics collection through the following categories:

HTTP Request Metrics

The module automatically tracks key HTTP request metrics:

Metric Name Type Labels Description
http_request_total Counter method, route, status_code Total number of HTTP requests
http_request_duration_seconds Summary method, route, status_code Duration of HTTP requests in seconds
http_active_requests Gauge Number of active HTTP requests

Standard Node.js Runtime Metrics

Through integration with prom-client, the module automatically collects essential Node.js runtime metrics:

  • CPU usage and utilization
  • Memory usage (heap and system)
  • Event loop lag and duration
  • Garbage collection statistics
  • Node.js version and process information
  • OS-level metrics (platform, architecture, etc.)

Custom Metrics

The module provides a flexible API for collecting custom metrics. Developers can define their own counters, gauges, histograms, and summaries to track application-specific business metrics or performance indicators.

All metrics are exposed in the standard Prometheus format and can be scraped by any Prometheus-compatible monitoring system.

Configuration

The module supports the following configuration options with these defaults:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-monitoring'],
  monitoring: {
    // Metrics collection (enabled by default)
    metrics: {
      enabled: true,
      path: '/metrics'
    },
    // Health check endpoint (enabled by default)
    healthCheck: {
      enabled: true,
      path: '/health'
    },
    // Readiness check endpoint (enabled by default)
    readyCheck: {
      enabled: true,
      path: '/ready'
    },
    // Debug server on separate port (disabled by default)
    debugServer: {
      enabled: false,
      port: 3001
    }
  }
})

You can customize any of these options. For example, to enable the debug server:

export default defineNuxtConfig({
  modules: ['nuxt-monitoring'],
  monitoring: {
    debugServer: {
      enabled: true,
      port: 3001
    }
  }
})

Contribution

Local development
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

License

MIT License - see LICENSE

Repository

https://github.com/NZ-WEB/nuxt-monitoring/blob/main/README.md?plain=1

npm

https://www.npmjs.com/package/nuxt-monitoring

Nuxt Compatibility

Nuxt 4, Nuxt 3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions