[model-gateway] support customizing Prometheus duration buckets (#14716)
This commit is contained in:
@@ -54,6 +54,7 @@ class RouterArgs:
|
||||
# Prometheus configuration
|
||||
prometheus_port: Optional[int] = None
|
||||
prometheus_host: Optional[str] = None
|
||||
prometheus_duration_buckets: Optional[List[float]] = None
|
||||
# Request ID headers configuration
|
||||
request_id_headers: Optional[List[str]] = None
|
||||
# Request timeout in seconds
|
||||
@@ -342,6 +343,12 @@ class RouterArgs:
|
||||
default="0.0.0.0",
|
||||
help="Host address to bind the Prometheus metrics server. Supports IPv4, IPv6 (e.g., ::, ::1), or 0.0.0.0 for all interfaces",
|
||||
)
|
||||
parser.add_argument(
|
||||
f"--{prefix}prometheus-duration-buckets",
|
||||
type=float,
|
||||
nargs="+",
|
||||
help="Buckets for Prometheus duration metrics",
|
||||
)
|
||||
parser.add_argument(
|
||||
f"--{prefix}request-id-headers",
|
||||
type=str,
|
||||
|
||||
@@ -177,6 +177,7 @@ struct Router {
|
||||
bootstrap_port_annotation: String,
|
||||
prometheus_port: Option<u16>,
|
||||
prometheus_host: Option<String>,
|
||||
prometheus_duration_buckets: Option<Vec<f64>>,
|
||||
request_timeout_secs: u64,
|
||||
request_id_headers: Option<Vec<String>>,
|
||||
pd_disaggregation: bool,
|
||||
@@ -439,6 +440,7 @@ impl Router {
|
||||
bootstrap_port_annotation = String::from("sglang.ai/bootstrap-port"),
|
||||
prometheus_port = None,
|
||||
prometheus_host = None,
|
||||
prometheus_duration_buckets = None,
|
||||
request_timeout_secs = 1800,
|
||||
request_id_headers = None,
|
||||
pd_disaggregation = false,
|
||||
@@ -516,6 +518,7 @@ impl Router {
|
||||
bootstrap_port_annotation: String,
|
||||
prometheus_port: Option<u16>,
|
||||
prometheus_host: Option<String>,
|
||||
prometheus_duration_buckets: Option<Vec<f64>>,
|
||||
request_timeout_secs: u64,
|
||||
request_id_headers: Option<Vec<String>>,
|
||||
pd_disaggregation: bool,
|
||||
@@ -606,6 +609,7 @@ impl Router {
|
||||
bootstrap_port_annotation,
|
||||
prometheus_port,
|
||||
prometheus_host,
|
||||
prometheus_duration_buckets,
|
||||
request_timeout_secs,
|
||||
request_id_headers,
|
||||
pd_disaggregation,
|
||||
@@ -695,6 +699,7 @@ impl Router {
|
||||
.prometheus_host
|
||||
.clone()
|
||||
.unwrap_or_else(|| "127.0.0.1".to_string()),
|
||||
duration_buckets: self.prometheus_duration_buckets.clone(),
|
||||
});
|
||||
|
||||
let runtime = tokio::runtime::Runtime::new()
|
||||
|
||||
Reference in New Issue
Block a user