Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
appmetrics-codewind
Advanced tools
appmetrics-codewind provides /metrics endpoints necessary for Prometheus monitoring and Eclipse Codewind monitoring
The data available on the /metrics endpoint is as follows:
appmetrics-codewind uses Node Application Metrics to monitor the application.
Download Prometheus from: Prometheus Downloads.
Follow the instructions on the Prometheus getting started page.
Or follow the simple example below.
Install Prometheus using:
tar xvfz prometheus-*.tar.gz
cd prometheus-*
Next you need to modify the configuration file that Prometheus uses.
In the prometheus folder there is a file named prometheus.yml
.
In this file you can alter which IP addresses and port numbers are scraped by Prometheus and also how often the scraping occurs.
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'
# A scrape configuration:
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'YOUR JOB NAME'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
static_configs:
- targets: ['IPADDRESS:PORT', 'IPADDRESS:PORT']
Set the targets field to your IP address and port number. You can monitor many applications by adding a comma between each IP address and port number.
Start Prometheus by using the command:
./prometheus -config.file=prometheus.yml
Prometheus can be found at localhost:9090
.
npm install appmetrics-codewind
Place the following code at the top of your applications server file.
require('appmetrics-codewind').attach()
or to use preloading:
$ node --require appmetrics-codewind/attach app.js
This will launch the /metrics endpoints and start monitoring your application.
Simple example using the express framework.
// This application uses express as its web server
// for more info, see: http://expressjs.com
var express = require('express');
var appmetricsCodewind = require('appmetrics-codewind').attach();
// cfenv provides access to your Cloud Foundry environment
// for more info, see: https://www.npmjs.com/package/cfenv
var cfenv = require('cfenv');
// create a new express server
var app = express();
// serve the files out of ./public as our main files
app.use(express.static(__dirname + '/public'));
// get the app environment from Cloud Foundry
var appEnv = cfenv.getAppEnv();
// start server on the specified port and binding host
var server = app.listen(appEnv.port, '0.0.0.0', function() {
// print a message when the server starts listening
console.log("server starting on " + appEnv.url);
});
require('appmetrics')
can be
injected if the application wants to use appmetrics, since it is a singleton
module and only one can be present in an application. Optional, defaults to
the appmetrics dependency of this module.Auto-attach to all http
servers created after this call, calling appmetricsCodewind.monitor(options)
for every server.
Simple example using attach.
require('appmetrics-codewind').attach();
var http = require('http');
const port = 3000;
const requestHandler = (request, response) => {
response.end('Hello')
}
const server = http.createServer(requestHandler);
server.listen(port, (err) => {
if (err) {
return console.log('An error occurred', err)
}
console.log(`Server is listening on ${port}`)
});
Our testing has shown that the performance overhead in terms of processing is minimal, adding less than 0.5 % to the CPU usage of your application.
We gathered this information by monitoring the sample application Acme Air. We used MongoDB as our datastore and used JMeter to drive load though the program. We have performed this testing with Node.js version 6.10.3.
We welcome contributions. Please see CONTRIBUTING.md for details about the contributor licence agreement and other information. If you want to do anything more involved than a bug fix or a minor enhancement then we would recommend discussing it in an issue first before doing the work to make sure that it's likely to be accepted. We're also keen to improve test coverage and may not accept new code unless there are accompanying tests.
This module adopts the Module Long Term Support (LTS) policy, with the following End Of Life (EOL) dates:
Module Version | Release Date | Minimum EOL | EOL With | Status |
---|---|---|---|---|
V2.x.x | Jun 2018 | Dec 2019 | Current |
0.3.0
FAQs
Provides a /metrics endpoints for Application Metrics
The npm package appmetrics-codewind receives a total of 2 weekly downloads. As such, appmetrics-codewind popularity was classified as not popular.
We found that appmetrics-codewind demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.