Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
prometheus-remote-write
Advanced tools
Using remote_write facility (see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) to send metrics to remote Prometheus from NodeJS app.
Pretty much anything from https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage should be supported, but tested only with grafana.com:
(List copied from https://github.com/prometheus/docs/blob/main/content/docs/operating/integrations.md)
import { pushTimeseries, pushMetrics } from "prometheus-remote-write";
// Just push some metrics metrics
await pushMetrics(
{
queue_depth_total: 100,
},
{
url: process.env.GRAFANA_PUSH_URL || "http://localhost:9201",
labels: { service: "queue-worker" },
}
);
// Follows remote_write payload format (see https://github.com/prometheus/prometheus/blob/main/prompb/types.proto)
await pushTimeseries(
{
labels: {
// Name should conform to https://prometheus.io/docs/practices/naming/
__name__: "queue_depth_total",
instance: "dev.example.com",
service: "SQS",
},
samples: [
{
value: 150,
timestamp: Date.now(),
},
],
},
config
);
// Full config - only url is required
const config = {
// Remote url
url: "http://localhost:9201",
// Auth settings
auth: {
username: "...",
password: "...",
},
// Optional prometheus protocol descripton .proto/.json
proto: undefined,
// Override default console.name(...log) used
console: undefined,
// Be verbose
verbose: false,
timing: false,
// Override used node-fetch
fetch: undefined,
// Additional labels to apply to each timeseries, i.e. [{ service: "SQS" }]
labels: undefined,
// Additional HTTP headers to send with each request
headers: undefined
};
FAQs
Send samples to prometheus via remote_write from NodeJS
We found that prometheus-remote-write demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.