Installation
Install the Metlo package from npm:Quick Start
Add Metlo to your Express application by requiring it at the start of your main script:Configuration
Required Parameters
Your Metlo API key for authentication with the collector
The URL of your Metlo collector instance (e.g.,
https://collector.metlo.com)Optional Configuration
You can pass an optional configuration object as the third parameter:Override the host value sent in trace data. Useful when your application is behind a proxy.
How It Works
Metlo’s Express integration usesrequire-in-the-middle to automatically instrument Express’s response methods:
- Intercepts responses - Patches
res.send(),res.json(),res.jsonp(), andres.sendFile() - Captures request/response data - Collects headers, body, query parameters, and metadata
- Asynchronous transmission - Sends data to Metlo collector using a worker pool
Captured Data
For each request, Metlo captures: Request:- URL (host, path, query parameters)
- HTTP method
- Headers
- Request body
- Source IP and port
- Status code
- Headers
- Response body
- Destination IP and port
- Environment (from
process.env.NODE_ENV) - Source identifier:
node/express - Timestamp
Example with TypeScript
Troubleshooting
Metlo not capturing requests
Metlo not capturing requests
Ensure that:
metlo()is called before requiring Express- Your collector URL is correct and accessible
- Your API key is valid
- Check console for any error messages
Performance concerns
Performance concerns
Metlo uses a worker pool to send data asynchronously, minimizing impact on request latency. The worker pool size is automatically set based on CPU count.
Large response bodies
Large response bodies
Metlo captures the full response body. For very large responses, consider implementing body size limits in your application.
Requirements
- Node.js >= 11.7.0
- Express (any version)
Next Steps
View API Inventory
See your discovered APIs in the Metlo dashboard
Configure Alerts
Set up alerts for sensitive data exposure