feat(metrics): add per-backend connection, error, protocol, and pool metrics with stale backend pruning
This commit is contained in:
@@ -67,6 +67,13 @@ export interface IMetrics {
|
||||
connections(): number;
|
||||
};
|
||||
|
||||
// Backend metrics
|
||||
backends: {
|
||||
byBackend(): Map<string, IBackendMetrics>;
|
||||
protocols(): Map<string, string>;
|
||||
topByErrors(limit?: number): Array<{ backend: string; errors: number }>;
|
||||
};
|
||||
|
||||
// Performance metrics
|
||||
percentiles: {
|
||||
connectionDuration(): { p50: number; p95: number; p99: number };
|
||||
@@ -98,6 +105,21 @@ export interface IMetricsConfig {
|
||||
prometheusPrefix: string; // Default: smartproxy_
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-backend metrics
|
||||
*/
|
||||
export interface IBackendMetrics {
|
||||
protocol: string;
|
||||
activeConnections: number;
|
||||
totalConnections: number;
|
||||
connectErrors: number;
|
||||
handshakeErrors: number;
|
||||
requestErrors: number;
|
||||
avgConnectTimeMs: number;
|
||||
poolHitRate: number;
|
||||
h2Failures: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal interface for connection byte tracking
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user