Skip to content

Add prometheus_port flag to CLI #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions jetstream_pt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
flags.DEFINE_integer("max_input_length", 1024, "The batch size")
flags.DEFINE_integer("max_output_length", 1024, "The batch size")
flags.DEFINE_integer("port", 9000, "port to listen on")
flags.DEFINE_integer("prometheus_port", 0, "prometheus metrics port")
flags.DEFINE_integer("threads", 64, "number of worker threads in thread pool")
flags.DEFINE_string(
"benchmark_save_offline_result_to_file",
Expand Down Expand Up @@ -104,6 +105,11 @@ def serve():
print(f"server_config: {server_config}")

metrics_server_config: MetricsServerConfig | None = None
if FLAGS.prometheus_port != 0:
if 1 <= FLAGS.prometheus_port <= 65535:
metrics_server_config = MetricsServerConfig(port=FLAGS.prometheus_port)
else:
raise ValueError(f"Invalid port number: {FLAGS.prometheus_port}. Port must be between 1 and 65535.")

# We separate credential from run so that we can unit test it with local credentials.
# We would like to add grpc credentials for OSS.
Expand Down
Loading