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
1eadc013
Unverified
Commit
1eadc013
authored
Jul 17, 2025
by
Graham King
Committed by
GitHub
Jul 17, 2025
Browse files
feat(runtime): Support tokio-console (#1986)
parent
b62e633c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
150 additions
and
94 deletions
+150
-94
.cargo/config.toml
.cargo/config.toml
+6
-0
Cargo.lock
Cargo.lock
+60
-0
Cargo.toml
Cargo.toml
+0
-12
docs/guides/dynamo_run.md
docs/guides/dynamo_run.md
+9
-0
launch/dynamo-run/Cargo.toml
launch/dynamo-run/Cargo.toml
+2
-0
launch/dynamo-run/src/main.rs
launch/dynamo-run/src/main.rs
+0
-12
lib/runtime/Cargo.toml
lib/runtime/Cargo.toml
+3
-21
lib/runtime/src/logging.rs
lib/runtime/src/logging.rs
+70
-49
No files found.
.cargo/config.toml
0 → 100644
View file @
1eadc013
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
[build]
# tokio-console needs this
rustflags
=
[
"--cfg"
,
"tokio_unstable"
]
Cargo.lock
View file @
1eadc013
...
@@ -551,6 +551,12 @@ version = "0.13.1"
...
@@ -551,6 +551,12 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
[[package]]
name = "base64"
name = "base64"
version = "0.22.1"
version = "0.22.1"
...
@@ -1084,6 +1090,45 @@ dependencies = [
...
@@ -1084,6 +1090,45 @@ dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.59.0",
]
]
[[package]]
name = "console-api"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8030735ecb0d128428b64cd379809817e620a40e5001c54465b99ec5feec2857"
dependencies = [
"futures-core",
"prost 0.13.5",
"prost-types",
"tonic",
"tracing-core",
]
[[package]]
name = "console-subscriber"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6539aa9c6a4cd31f4b1c040f860a1eac9aa80e7df6b05d506a6e7179936d6a01"
dependencies = [
"console-api",
"crossbeam-channel",
"crossbeam-utils",
"futures-task",
"hdrhistogram",
"humantime",
"hyper-util",
"prost 0.13.5",
"prost-types",
"serde",
"serde_json",
"thread_local",
"tokio",
"tokio-stream",
"tonic",
"tracing",
"tracing-core",
"tracing-subscriber",
]
[[package]]
[[package]]
name = "const-oid"
name = "const-oid"
version = "0.9.6"
version = "0.9.6"
...
@@ -1896,6 +1941,7 @@ dependencies = [
...
@@ -1896,6 +1941,7 @@ dependencies = [
"blake3",
"blake3",
"bytes",
"bytes",
"chrono",
"chrono",
"console-subscriber",
"derive-getters",
"derive-getters",
"derive_builder",
"derive_builder",
"educe",
"educe",
...
@@ -2873,6 +2919,19 @@ dependencies = [
...
@@ -2873,6 +2919,19 @@ dependencies = [
"foldhash",
"foldhash",
]
]
[[package]]
name = "hdrhistogram"
version = "7.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d"
dependencies = [
"base64 0.21.7",
"byteorder",
"flate2",
"nom",
"num-traits",
]
[[package]]
[[package]]
name = "heck"
name = "heck"
version = "0.4.1"
version = "0.4.1"
...
@@ -7060,6 +7119,7 @@ dependencies = [
...
@@ -7060,6 +7119,7 @@ dependencies = [
"slab",
"slab",
"socket2",
"socket2",
"tokio-macros",
"tokio-macros",
"tracing",
"windows-sys 0.52.0",
"windows-sys 0.52.0",
]
]
...
...
Cargo.toml
View file @
1eadc013
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[workspace]
[workspace]
members
=
[
members
=
[
...
...
docs/guides/dynamo_run.md
View file @
1eadc013
...
@@ -669,3 +669,12 @@ More fully-featured Backend engines (used by `dynamo-run`):
...
@@ -669,3 +669,12 @@ More fully-featured Backend engines (used by `dynamo-run`):
-
[
vllm
](
https://github.com/ai-dynamo/dynamo/blob/main/launch/dynamo-run/src/subprocess/vllm_inc.py
)
-
[
vllm
](
https://github.com/ai-dynamo/dynamo/blob/main/launch/dynamo-run/src/subprocess/vllm_inc.py
)
-
[
sglang
](
https://github.com/ai-dynamo/dynamo/blob/main/launch/dynamo-run/src/subprocess/sglang_inc.py
)
-
[
sglang
](
https://github.com/ai-dynamo/dynamo/blob/main/launch/dynamo-run/src/subprocess/sglang_inc.py
)
### Debugging
`dynamo-run`
and
`dynamo-runtime`
support
[
tokio-console
](
https://github.com/tokio-rs/console
)
. Build with the feature to enable:
```
cargo build --features cuda,tokio-console -p dynamo-run
```
The listener uses the default tokio console port, and all interfaces (0.0.0.0).
launch/dynamo-run/Cargo.toml
View file @
1eadc013
...
@@ -23,6 +23,8 @@ metal = ["dynamo-engine-llamacpp/metal", "dynamo-engine-mistralrs/metal"]
...
@@ -23,6 +23,8 @@ metal = ["dynamo-engine-llamacpp/metal", "dynamo-engine-mistralrs/metal"]
vulkan
=
["dynamo-engine-llamacpp/vulkan"]
vulkan
=
["dynamo-engine-llamacpp/vulkan"]
openmp
=
["dynamo-engine-llamacpp/openmp"]
openmp
=
["dynamo-engine-llamacpp/openmp"]
tokio-console
=
["dynamo-runtime/tokio-console"]
[dependencies]
[dependencies]
dynamo-llm
=
{
workspace
=
true
}
dynamo-llm
=
{
workspace
=
true
}
dynamo-runtime
=
{
workspace
=
true
}
dynamo-runtime
=
{
workspace
=
true
}
...
...
launch/dynamo-run/src/main.rs
View file @
1eadc013
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use
std
::
env
;
use
std
::
env
;
...
...
lib/runtime/Cargo.toml
View file @
1eadc013
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[package]
[package]
name
=
"dynamo-runtime"
name
=
"dynamo-runtime"
...
@@ -27,8 +15,8 @@ description = "Dynamo Runtime Library"
...
@@ -27,8 +15,8 @@ description = "Dynamo Runtime Library"
[features]
[features]
default
=
[]
default
=
[]
integration
=
[]
integration
=
[]
# Tests that require an active ETCD server
testing-etcd
=
[]
# Tests that require an active ETCD server
t
esting-etcd
=
[
]
t
okio-console
=
[
"dep:console-subscriber"
,
"tokio/tracing"
]
[dependencies]
[dependencies]
# Use workspace dependencies where available
# Use workspace dependencies where available
...
@@ -64,6 +52,7 @@ xxhash-rust = { workspace = true }
...
@@ -64,6 +52,7 @@ xxhash-rust = { workspace = true }
arc-swap
=
{
version
=
"1"
}
arc-swap
=
{
version
=
"1"
}
async-once-cell
=
{
version
=
"0.5.4"
}
async-once-cell
=
{
version
=
"0.5.4"
}
console-subscriber
=
{
version
=
"0.4"
,
optional
=
true
}
educe
=
{
version
=
"0.6.0"
}
educe
=
{
version
=
"0.6.0"
}
figment
=
{
version
=
"0.10.19"
,
features
=
[
"env"
,
"json"
,
"toml"
,
"test"
]
}
figment
=
{
version
=
"0.10.19"
,
features
=
[
"env"
,
"json"
,
"toml"
,
"test"
]
}
local-ip-address
=
{
version
=
"0.6.3"
}
local-ip-address
=
{
version
=
"0.6.3"
}
...
@@ -81,10 +70,3 @@ env_logger = { version = "0.11" }
...
@@ -81,10 +70,3 @@ env_logger = { version = "0.11" }
reqwest
=
{
workspace
=
true
}
reqwest
=
{
workspace
=
true
}
rstest
=
{
version
=
"0.23.0"
}
rstest
=
{
version
=
"0.23.0"
}
temp-env
=
{
version
=
"0.3.6"
}
temp-env
=
{
version
=
"0.3.6"
}
# These patches are to address issues in reqwest, which is used in the HTTP server test (but not on servers).
# These are transitive dependencies to use secure versions and mitigate known vulnerabilities.
[patch.crates-io]
tokio
=
{
version
=
"1.18.4"
}
# addresses RUSTSEC-2023-0001
h2
=
{
version
=
"0.4.4"
}
# addresses RUSTSEC-2024-0332
rustls
=
{
version
=
"0.23.18"
}
# addresses RUSTSEC-2024-0399
lib/runtime/src/logging.rs
View file @
1eadc013
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Dynamo Distributed Logging Module.
//! Dynamo Distributed Logging Module.
//!
//!
...
@@ -46,6 +34,7 @@ use figment::{
...
@@ -46,6 +34,7 @@ use figment::{
Figment
,
Figment
,
};
};
use
serde
::{
Deserialize
,
Serialize
};
use
serde
::{
Deserialize
,
Serialize
};
use
tracing
::
level_filters
::
LevelFilter
;
use
tracing
::{
Event
,
Subscriber
};
use
tracing
::{
Event
,
Subscriber
};
use
tracing_subscriber
::
fmt
::
time
::
FormatTime
;
use
tracing_subscriber
::
fmt
::
time
::
FormatTime
;
use
tracing_subscriber
::
fmt
::
time
::
LocalTime
;
use
tracing_subscriber
::
fmt
::
time
::
LocalTime
;
...
@@ -58,6 +47,8 @@ use tracing_subscriber::registry::LookupSpan;
...
@@ -58,6 +47,8 @@ use tracing_subscriber::registry::LookupSpan;
use
tracing_subscriber
::
EnvFilter
;
use
tracing_subscriber
::
EnvFilter
;
use
tracing_subscriber
::{
filter
::
Directive
,
fmt
};
use
tracing_subscriber
::{
filter
::
Directive
,
fmt
};
use
crate
::
config
::{
disable_ansi_logging
,
jsonl_logging_enabled
};
/// ENV used to set the log level
/// ENV used to set the log level
const
FILTER_ENV
:
&
str
=
"DYN_LOG"
;
const
FILTER_ENV
:
&
str
=
"DYN_LOG"
;
...
@@ -98,12 +89,58 @@ impl Default for LoggingConfig {
...
@@ -98,12 +89,58 @@ impl Default for LoggingConfig {
/// Initialize the logger
/// Initialize the logger
pub
fn
init
()
{
pub
fn
init
()
{
INIT
.call_once
(||
{
INIT
.call_once
(
setup_logging
);
let
config
=
load_config
();
}
#[cfg(feature
=
"tokio-console"
)]
fn
setup_logging
()
{
// Start tokio-console server. Returns a tracing-subscriber Layer.
let
tokio_console_layer
=
console_subscriber
::
ConsoleLayer
::
builder
()
.with_default_env
()
.server_addr
(([
0
,
0
,
0
,
0
],
console_subscriber
::
Server
::
DEFAULT_PORT
))
.spawn
();
let
tokio_console_target
=
tracing_subscriber
::
filter
::
Targets
::
new
()
.with_default
(
LevelFilter
::
ERROR
)
.with_target
(
"runtime"
,
LevelFilter
::
TRACE
)
.with_target
(
"tokio"
,
LevelFilter
::
TRACE
);
let
l
=
fmt
::
layer
()
.with_ansi
(
!
disable_ansi_logging
())
.event_format
(
fmt
::
format
()
.compact
()
.with_timer
(
TimeFormatter
::
new
()))
.with_writer
(
std
::
io
::
stderr
)
.with_filter
(
filter
(
load_config
));
tracing_subscriber
::
registry
()
.with
(
l
)
.with
(
tokio_console_layer
.with_filter
(
tokio_console_target
))
.init
();
}
#[cfg(not(feature
=
"tokio-console"
))]
fn
setup_logging
()
{
let
f
=
filters
(
load_config
());
// The generics mean we have to repeat everything. Each builder method returns a
// specialized type.
if
jsonl_logging_enabled
()
{
// JSON logger for NIM
let
l
=
fmt
::
layer
()
.with_ansi
(
false
)
.event_format
(
CustomJsonFormatter
::
new
())
.with_writer
(
std
::
io
::
stderr
)
.with_filter
(
f
);
tracing_subscriber
::
registry
()
.with
(
l
)
.init
();
}
else
{
// Normal logging
let
l
=
fmt
::
layer
()
.with_ansi
(
!
disable_ansi_logging
())
.event_format
(
fmt
::
format
()
.compact
()
.with_timer
(
TimeFormatter
::
new
()))
.with_writer
(
std
::
io
::
stderr
)
.with_filter
(
f
);
tracing_subscriber
::
registry
()
.with
(
l
)
.init
();
}
}
// Examples to remove noise
fn
filters
(
config
:
LoggingConfig
)
->
EnvFilter
{
// .add_directive("rustls=warn".parse()?)
// .add_directive("tokio_util::codec=warn".parse()?)
let
mut
filter_layer
=
EnvFilter
::
builder
()
let
mut
filter_layer
=
EnvFilter
::
builder
()
.with_default_directive
(
config
.log_level
.parse
()
.unwrap
())
.with_default_directive
(
config
.log_level
.parse
()
.unwrap
())
.with_env_var
(
FILTER_ENV
)
.with_env_var
(
FILTER_ENV
)
...
@@ -120,23 +157,7 @@ pub fn init() {
...
@@ -120,23 +157,7 @@ pub fn init() {
}
}
}
}
}
}
filter_layer
if
crate
::
config
::
jsonl_logging_enabled
()
{
let
l
=
fmt
::
layer
()
.with_ansi
(
false
)
// ansi terminal escapes and colors always disabled
.event_format
(
CustomJsonFormatter
::
new
())
.with_writer
(
std
::
io
::
stderr
)
.with_filter
(
filter_layer
);
tracing_subscriber
::
registry
()
.with
(
l
)
.init
();
}
else
{
let
l
=
fmt
::
layer
()
.with_ansi
(
!
crate
::
config
::
disable_ansi_logging
())
.event_format
(
fmt
::
format
()
.compact
()
.with_timer
(
TimeFormatter
::
new
()))
.with_writer
(
std
::
io
::
stderr
)
.with_filter
(
filter_layer
);
tracing_subscriber
::
registry
()
.with
(
l
)
.init
();
};
});
}
}
/// Log a message with file and line info
/// Log a message with file and line info
...
...
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