File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 27
27
flags .DEFINE_integer ("max_input_length" , 1024 , "The batch size" )
28
28
flags .DEFINE_integer ("max_output_length" , 1024 , "The batch size" )
29
29
flags .DEFINE_integer ("port" , 9000 , "port to listen on" )
30
+ flags .DEFINE_integer ("prometheus_port" , 0 , "prometheus metrics port" )
30
31
flags .DEFINE_integer ("threads" , 64 , "number of worker threads in thread pool" )
31
32
flags .DEFINE_string (
32
33
"benchmark_save_offline_result_to_file" ,
@@ -104,6 +105,11 @@ def serve():
104
105
print (f"server_config: { server_config } " )
105
106
106
107
metrics_server_config : MetricsServerConfig | None = None
108
+ if FLAGS .prometheus_port != 0 :
109
+ if 1 <= FLAGS .prometheus_port <= 65535 :
110
+ metrics_server_config = MetricsServerConfig (port = FLAGS .prometheus_port )
111
+ else :
112
+ raise ValueError (f"Invalid port number: { FLAGS .prometheus_port } . Port must be between 1 and 65535." )
107
113
108
114
# We separate credential from run so that we can unit test it with local credentials.
109
115
# We would like to add grpc credentials for OSS.
You can’t perform that action at this time.
0 commit comments