The one-liner node.js proxy middleware for connect, express, next.js and more
92
Pending
Does it follow best practices?
Impact
92%
1.24xAverage score across 10 eval scenarios
Pending
The risk profile of this skill
A middleware-based request monitoring and metrics system that tracks proxy operations and provides real-time statistics.
@generates
Implement a proxy monitoring system that extends the capabilities of an HTTP proxy middleware to collect and expose metrics about proxy operations. The system should provide real-time visibility into proxy performance and error patterns.
The system must implement a middleware that:
The metrics object returned should have the following structure:
{
requests: <number>, // Total proxied requests
responses: {
success: <number>, // Responses with status < 400
error: <number> // Responses with status >= 400
},
responseTime: <array>, // Array of response times in milliseconds
errors: <array>, // Array of error objects with timestamp, url, and error message
averageResponseTime: <number> // Average of all response times
}/**
* Creates a monitoring plugin for the proxy middleware that tracks
* requests, responses, and errors
*
* @param {Object} proxyServer - The http-proxy server instance
* @param {Object} options - The proxy middleware options
*/
function createMonitoringPlugin(proxyServer, options) {
// Plugin implementation
}
/**
* Gets the current metrics collected by the monitoring plugin
*
* @returns {Object} Metrics object containing request counts, response times, and errors
*/
function getMetrics() {
// Returns metrics object
}
module.exports = {
createMonitoringPlugin,
getMetrics
};Provides proxy middleware functionality with plugin support.
@satisfied-by
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10