
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@snapshot-labs/snapshot-metrics
Advanced tools
`snapshot-metrics` is a npm package that handle the metrics export for Snapshot backend projects. It simplifies and standardizes the process of setting up the metrics endpoint for any snapshot services.
snapshot-metrics
is a npm package that handle the metrics export for Snapshot backend projects.
It simplifies and standardizes the process of setting up the metrics endpoint for any snapshot services.
Add it in your project with
yarn add @snapshot-labs/snapshot-metrics
Import it in your app after creating the express instance
import express from 'express';
import initMetrics from '@snapshot-labs/metrics';
const app = express();
initMetrics(app);
By default, it will create a new /metrics
endpoint, with some nodejs and express metrics.
The initMetrics
function takes an optional options
parameter with the following signature:
options?: {
promBundleOptions?: promBundle.Opts;
normalizedPath?: NormalizePathEntry[] | NormalizePathFn;
whitelistedPath?: RegExp[];
errorHandler?: (e: any) => void;
}
The same object as https://github.com/jochen-schweizer/express-prom-bundle#options, to override the default option set by the lib.
Same as object as https://github.com/jochen-schweizer/express-prom-bundle#more-details-on-includepath-option
In case promBundleOptions
is set, it will have priority over this option.
An array of RegExp, to filter the HTTP requests tracked by the metrics.
In case promBundleOptions
is set, it will have priority over this option.
An error handler function, to handle error thrown by the pushgateway connection.
Default: (e: any) => console.log(e)
The module export default metrics from https://github.com/siimon/prom-client and https://github.com/jochen-schweizer/express-prom-bundle, as well as some custom metrics tailored for the @snapshot-labs.
The module export a client
object, which is a prom-client instance. You can use it to create custom metrics.
new client.Gauge({
name: 'my_custom_metric',
help: 'My custom metric',
labelNames: ['my_label'],
}).set({ my_label: 'my_value' }, 1);
See https://github.com/siimon/prom-client#custom-metrics
You can lock the /metrics
behind authencation by setting the METRICS_AUTHORIZATION
env variable.
You then need to use the Authorization
header when polling the /metrics
endpoint:
curl -X GET -H "Authorization: Bearer [METRICS_AUTHORIZATION]" http://localhost/metrics
You can push the metrics to a pushgateway by setting the METRICS_PUSHGATEWAY_URL
and METRICS_INSTANCE
env variable.
# Value to be used as prefix to the instance label of pushed metrics
METRICS_INSTANCE=snapshot.org
# URL of the pushgateway
METRICS_PUSHGATEWAY_URL=http://localhost:9091
# Job name to be added to the job label of pushed metrics
METRICS_JOB_NAME=prometheus # Default
The pushed metrics instance
label will be set to the process.env.METRICS_INSTANCE
,
followed by process.env.HOSTNAME
, in order to differentiate multiple
servers/container running the same service. HOSTNAME
should already be set
by most server.
If the pushgateway requires authentication, set the following env var:
# Basic auth user
METRICS_PUSHGATEWAY_USER=
# Basic auth password
METRICS_PUSHGATEWAY_PASSWORD=
FAQs
`snapshot-metrics` is a npm package that handle the metrics export for Snapshot backend projects. It simplifies and standardizes the process of setting up the metrics endpoint for any snapshot services.
The npm package @snapshot-labs/snapshot-metrics receives a total of 131 weekly downloads. As such, @snapshot-labs/snapshot-metrics popularity was classified as not popular.
We found that @snapshot-labs/snapshot-metrics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.