File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/shadowbox/infrastructure Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -102,12 +102,17 @@ export interface PrometheusClient {
102102}
103103
104104export class ApiPrometheusClient implements PrometheusClient {
105- constructor ( private address : string ) { }
105+ private readonly agent : http . Agent ;
106+
107+ constructor ( private address : string ) {
108+ this . agent = new http . Agent ( { keepAlive : true } ) ;
109+ }
106110
107111 private request ( url : string ) : Promise < QueryResultData > {
108112 return new Promise < QueryResultData > ( ( fulfill , reject ) => {
113+ const options = { agent : this . agent } ;
109114 http
110- . get ( url , ( response ) => {
115+ . get ( url , options , ( response ) => {
111116 if ( response . statusCode < 200 || response . statusCode > 299 ) {
112117 reject ( new Error ( `Got error ${ response . statusCode } ` ) ) ;
113118 response . resume ( ) ;
You can’t perform that action at this time.
0 commit comments