File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ def initialize(
5656 port : ENV . fetch ( "PROMETHEUS_EXPORTER_PORT" , PrometheusExporter ::DEFAULT_PORT ) ,
5757 max_queue_size : nil ,
5858 thread_sleep : 0.5 ,
59+ connect_timeout : nil ,
5960 json_serializer : nil ,
6061 custom_labels : nil ,
6162 logger : Logger . new ( STDERR ) ,
@@ -83,6 +84,7 @@ def initialize(
8384 @worker_thread = nil
8485 @mutex = Mutex . new
8586 @thread_sleep = thread_sleep
87+ @connect_timeout = connect_timeout
8688
8789 @json_serializer = json_serializer == :oj ? PrometheusExporter ::OjCompat : JSON
8890
@@ -228,7 +230,8 @@ def ensure_socket!
228230
229231 close_socket_if_old!
230232 if !@socket
231- @socket = TCPSocket . new @host , @port
233+ @socket = TCPSocket . new @host , @port , connect_timeout : @connect_timeout
234+
232235 @socket . write ( "POST /send-metrics HTTP/1.1\r \n " )
233236 @socket . write ( "Transfer-Encoding: chunked\r \n " )
234237 @socket . write ( "Host: #{ @host } \r \n " )
You can’t perform that action at this time.
0 commit comments