Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
3dbab3f1
Unverified
Commit
3dbab3f1
authored
Dec 05, 2025
by
dmitrygx
Committed by
GitHub
Dec 05, 2025
Browse files
fix(sglang): fix IPv6 support for ZMQ endpoint (#4403)
Signed-off-by:
Dmitrii Gabor
<
dmitryg1709@gmail.com
>
parent
21f6d1e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
components/src/dynamo/sglang/publisher.py
components/src/dynamo/sglang/publisher.py
+26
-2
No files found.
components/src/dynamo/sglang/publisher.py
View file @
3dbab3f1
...
@@ -10,7 +10,7 @@ import sglang as sgl
...
@@ -10,7 +10,7 @@ import sglang as sgl
import
zmq
import
zmq
import
zmq.asyncio
import
zmq.asyncio
from
prometheus_client
import
CollectorRegistry
,
multiprocess
from
prometheus_client
import
CollectorRegistry
,
multiprocess
from
sglang.srt.utils
import
get_local_ip_auto
,
get_zmq_socket
from
sglang.srt.utils
import
get_local_ip_auto
,
get_zmq_socket
,
maybe_wrap_ipv6_address
from
dynamo.common.utils.prometheus
import
register_engine_metrics_callback
from
dynamo.common.utils.prometheus
import
register_engine_metrics_callback
from
dynamo.llm
import
(
from
dynamo.llm
import
(
...
@@ -26,6 +26,30 @@ from dynamo.runtime import Component, Endpoint
...
@@ -26,6 +26,30 @@ from dynamo.runtime import Component, Endpoint
from
dynamo.sglang.args
import
Config
from
dynamo.sglang.args
import
Config
def
format_zmq_endpoint
(
endpoint_template
:
str
,
ip_address
:
str
)
->
str
:
"""Format ZMQ endpoint by replacing wildcard with IP address.
Properly handles IPv6 addresses by wrapping them in square brackets.
Uses SGLang's maybe_wrap_ipv6_address for consistent formatting.
Args:
endpoint_template: ZMQ endpoint template with wildcard (e.g., "tcp://*:5557")
ip_address: IP address to use (can be IPv4 or IPv6)
Returns:
Formatted ZMQ endpoint string
Example:
>>> format_zmq_endpoint("tcp://*:5557", "192.168.1.1")
'tcp://192.168.1.1:5557'
>>> format_zmq_endpoint("tcp://*:5557", "2a02:6b8:c46:2b4:0:74c1:75b0:0")
'tcp://[2a02:6b8:c46:2b4:0:74c1:75b0:0]:5557'
"""
# Use SGLang's utility to wrap IPv6 addresses in brackets
formatted_ip
=
maybe_wrap_ipv6_address
(
ip_address
)
return
endpoint_template
.
replace
(
"*"
,
formatted_ip
)
class
DynamoSglangPublisher
:
class
DynamoSglangPublisher
:
"""
"""
Handles SGLang kv events and metrics reception and publishing.
Handles SGLang kv events and metrics reception and publishing.
...
@@ -121,7 +145,7 @@ class DynamoSglangPublisher:
...
@@ -121,7 +145,7 @@ class DynamoSglangPublisher:
if
self
.
server_args
.
kv_events_config
:
if
self
.
server_args
.
kv_events_config
:
kv_events
=
json
.
loads
(
self
.
server_args
.
kv_events_config
)
kv_events
=
json
.
loads
(
self
.
server_args
.
kv_events_config
)
ep
=
kv_events
.
get
(
"endpoint"
)
ep
=
kv_events
.
get
(
"endpoint"
)
zmq_ep
=
ep
.
replace
(
"*"
,
get_local_ip_auto
())
if
ep
else
None
zmq_ep
=
format_zmq_endpoint
(
ep
,
get_local_ip_auto
())
if
ep
else
None
zmq_config
=
ZmqKvEventPublisherConfig
(
zmq_config
=
ZmqKvEventPublisherConfig
(
worker_id
=
self
.
generate_endpoint
.
connection_id
(),
worker_id
=
self
.
generate_endpoint
.
connection_id
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment