Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-health-agent

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-health-agent

[![GitHub release](https://badge.fury.io/js/node-health-agent.svg)](https://github.com/wallet77/node-health-agent/releases/) [![GitHub license](https://img.shields.io/github/license/wallet77/node-health-agent)](https://github.com/wallet77/node-health-agen

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

GitHub release GitHub license

Purpose

Node agent for Node health project.

Compatibility

/!\ This module use async/await syntax and the inspector module, this is why you must have node 8.0+.

Supported and tested : >= 8.0

VersionSupportedTested
12.xyesyes
10.xyesyes
9.xyesyes
8.xyesyes

In order to have all features we recommend to use at least Node.js version 10 or higher.

Installation

$ npm install node-health-agent --save

Usage

Basic

const agent = require('node-health-agent')({
  appName: 'testAPI',
  serverUrl: 'ws://localhost:3001',
  inspector: {
    storage: {
      type: "s3",
      bucket: process.env.CONFIG_S3_BUCKET,
      dir: 'inspector'
    }
  }
})

Add a custom event

agent.addEvent('myEvent', (event) => {
  console.log(event)
})

Add a custom event and send data to server

agent.addEvent('myEvent', (event, ws) => {
  const data = ... // get data in any way
  event.data = data
  ws.send(JSON.stringify(event))
})

Trigger event manually

agent._events.cpu_profiling_start({}, agent.ws, agent.inspector)
// ...
// a few moment later
const profile = await agent._events.cpu_profiling_stop({}, agent.ws, agent.inspector)

List of built-in events

Eventdescription
cpu_profiling_startStart a CPU profiling
cpu_profiling_stopStop a CPU profiling
extract_env_varExtract environment variables
extract_package_fileExtract package.json file content
extract_dependenciesExtract the full dependencies tree
memory_dumpTake a memory snapshot
memory_sampling_startStart a memory sampling
memory_sampling_stopStop memory sampling
code_coverage_startStart to collect code coverage data
code_coverage_stopStop code coevrage and send data
diagnosis_reportRun Node.js diagnosis report
memory_cpu_usageExport CPU and memory info

Debug

Node-health's agent use debug module in order not to pollute your logs. If you want to see all agent output just use DEBUG environment variable:

DEBUG=node-health-agent* node myApp.js

Test

$ npm test

Coverage report can be found in coverage/.

FAQs

Package last updated on 10 Sep 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc