Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ee8adb3
CONFIG: Part 2 (use).
ColinNV Feb 20, 2026
b86c07c
CONFIG: Part 2 (use).
ColinNV Feb 20, 2026
7aa6a31
CONFIG: Part 2 (use).
ColinNV Feb 20, 2026
6ef095d
Merge branch 'main' into config_part2_use
ColinNV Feb 20, 2026
b2e3b8f
CONFIG: Part 2 (use).
ColinNV Feb 20, 2026
f0c1c9e
Merge branch 'config_part2_use' of https://github.com/ColinNV/nixl in…
ColinNV Feb 20, 2026
a93b573
CONFIG: Part 2 (use).
ColinNV Feb 20, 2026
5add22a
CONFIG: Part 2 (use).
ColinNV Feb 20, 2026
54955a3
Merge branch 'main' into config_part2_use
ColinNV Feb 20, 2026
14ddf21
Merge branch 'main' into config_part2_use
ColinNV Feb 23, 2026
955e64d
CONFIG: Part 2 (use).
ColinNV Feb 23, 2026
5332995
CONFIG: Part 2 (use).
ColinNV Feb 23, 2026
9936e84
Merge branch 'main' into config_part2_use
ColinNV Feb 24, 2026
6ca822f
TEST/PYTHON: Use valid environment variable value.
ColinNV Feb 24, 2026
7f7b04e
TEST/PYTHON: Use valid environment variable value.
ColinNV Feb 24, 2026
fa2596e
CONFIG: Part 2 (use).
ColinNV Feb 24, 2026
cf13e33
Merge branch 'main' into config_part2_use
ColinNV Feb 24, 2026
01a3402
Merge branch 'main' into config_part2_use
brminich Feb 25, 2026
af8940b
Merge branch 'main' into config_part2_use
ColinNV Feb 25, 2026
bc4e20e
Merge branch 'main' into config_part2_use
brminich Feb 26, 2026
ad563dc
Fix conflict.
ColinNV Feb 27, 2026
be0abdf
CONFIG: Fix previous handling of empty variable.
ColinNV Feb 27, 2026
756c05a
Merge branch 'main' into config_part2_use
ColinNV Feb 27, 2026
17bf449
CONFIG: Update documentation.
ColinNV Feb 27, 2026
5ecbe8a
Merge branch 'main' into config_part2_use
ColinNV Feb 27, 2026
1aa1963
Merge main.
ColinNV Mar 2, 2026
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
18 changes: 7 additions & 11 deletions src/core/nixl_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "transfer_request.h"
#include "agent_data.h"
#include "plugin_manager.h"
#include "common/configuration.h"
#include "common/nixl_log.h"
#include "common/operators.h"
#include "telemetry.h"
Expand Down Expand Up @@ -110,7 +111,7 @@ nixlAgentData::nixlAgentData(const std::string &name, const nixlAgentConfig &cfg
config(cfg),
lock(cfg.syncMode) {
#if HAVE_ETCD
if (getenv("NIXL_ETCD_ENDPOINTS")) {
if (nixl::config::checkExistence("NIXL_ETCD_ENDPOINTS")) {
useEtcd = true;
NIXL_DEBUG << "NIXL ETCD is enabled";
} else {
Expand All @@ -125,24 +126,19 @@ nixlAgentData::nixlAgentData(const std::string &name, const nixlAgentConfig &cfg
throw std::invalid_argument("Agent needs a name");

memorySection = new nixlLocalSection();
const char *telemetry_env_val = std::getenv(TELEMETRY_ENABLED_VAR);

if (telemetry_env_val != nullptr) {
if (!strcasecmp(telemetry_env_val, "y") || !strcasecmp(telemetry_env_val, "1") ||
!strcasecmp(telemetry_env_val, "yes") || !strcasecmp(telemetry_env_val, "on")) {
const auto telemetry_enabled = nixl::config::getValueOptional<bool>(TELEMETRY_ENABLED_VAR);

if (telemetry_enabled) {
if (*telemetry_enabled) {
telemetryEnabled = true;
telemetry_ = std::make_unique<nixlTelemetry>(name, backendEngines);
} else if (cfg.captureTelemetry) {
telemetryEnabled = true;
NIXL_WARN << "NIXL telemetry is enabled through config, "
"ignoring the NIXL_TELEMETRY_ENABLE environment variable";
} else if (!strcasecmp(telemetry_env_val, "n") || !strcasecmp(telemetry_env_val, "0") ||
!strcasecmp(telemetry_env_val, "no") || !strcasecmp(telemetry_env_val, "off")) {
NIXL_DEBUG << "NIXL telemetry is disabled";
} else {
NIXL_WARN
<< "NIXL telemetry is disabled for invalid NIXL_TELEMETRY_ENABLE environment "
"variable -- valid are 'y', 'yes', '1', 'on', 'n', 'no', '0', 'off', any case";
NIXL_DEBUG << "NIXL telemetry is disabled";
}
} else if (cfg.captureTelemetry) {
telemetryEnabled = true;
Expand Down
22 changes: 10 additions & 12 deletions src/core/nixl_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <fcntl.h>
#include "nixl.h"
#include "common/configuration.h"
#include "common/nixl_time.h"
#include "agent_data.h"
#include "common/nixl_log.h"
Expand Down Expand Up @@ -193,7 +194,7 @@ recvCommMessage(int fd, std::string &msg) {
class nixlEtcdClient {
private:
std::unique_ptr<etcd::SyncClient> etcd;
std::string namespace_prefix;
const std::string namespace_prefix;
std::vector<std::string> invalidated_agents;
std::mutex invalidated_agents_mutex;
std::unordered_map<std::string, std::unique_ptr<etcd::Watcher>,
Expand All @@ -209,13 +210,14 @@ class nixlEtcdClient {
}

public:
nixlEtcdClient(const std::string &my_agent_name,
const std::chrono::microseconds &timeout = std::chrono::microseconds(5000000))
: watchTimeout_(timeout) {
const char* etcd_endpoints = std::getenv("NIXL_ETCD_ENDPOINTS");
if (!etcd_endpoints || strlen(etcd_endpoints) == 0) {
throw std::runtime_error("No etcd endpoints provided");
}
explicit nixlEtcdClient(
const std::string &my_agent_name,
const std::chrono::microseconds &timeout = std::chrono::microseconds(5000000))
: namespace_prefix(
nixl::config::getValueDefaulted<std::string>("NIXL_ETCD_NAMESPACE",
NIXL_ETCD_NAMESPACE_DEFAULT)),
watchTimeout_(timeout) {
const auto etcd_endpoints = nixl::config::getNonEmptyString("NIXL_ETCD_ENDPOINTS");

try {
etcd = std::make_unique<etcd::SyncClient>(etcd_endpoints);
Expand All @@ -225,10 +227,6 @@ class nixlEtcdClient {
return;
}
NIXL_DEBUG << "Created etcd client to endpoints: " << etcd_endpoints;

const char* etcd_namespace = std::getenv("NIXL_ETCD_NAMESPACE");
namespace_prefix = etcd_namespace ? etcd_namespace : NIXL_ETCD_NAMESPACE_DEFAULT;

NIXL_DEBUG << "Using etcd namespace for agents: " << namespace_prefix;

std::string agent_prefix = makeKey(my_agent_name, "");
Expand Down
10 changes: 5 additions & 5 deletions src/core/nixl_plugin_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

#include "plugin_manager.h"
#include "nixl.h"
#include "common/configuration.h"
#include "common/nixl_log.h"
#include <dlfcn.h>
#include <filesystem>
#include <dirent.h>
#include <unistd.h> // For access() and F_OK
#include <cstdlib> // For getenv
#include <fstream>
#include <string>
#include <map>
Expand Down Expand Up @@ -269,13 +269,13 @@ nixlPluginManager::loadPluginsFromList(const std::string &filename) {
}

namespace {
static std::string
std::string
getPluginDir() {
// Environment variable takes precedence
const char *plugin_dir = getenv("NIXL_PLUGIN_DIR");
if (plugin_dir) {
return plugin_dir;
if (const auto plugin_dir = nixl::config::getValueOptional<std::string>("NIXL_PLUGIN_DIR")) {
return *plugin_dir;
}

// By default, use the plugin directory relative to the binary
Dl_info info;
int ok = dladdr(reinterpret_cast<void *>(&getPluginDir), &info);
Expand Down
9 changes: 5 additions & 4 deletions src/core/telemetry/buffer_exporter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,14 +15,15 @@
* limitations under the License.
*/
#include "buffer_exporter.h"
#include "common/configuration.h"
#include "common/nixl_log.h"

namespace {
static std::filesystem::path
[[nodiscard]] std::filesystem::path
getFilePath(const nixlTelemetryExporterInitParams &init_params) {
// if we reach here, we ensured env var is set
auto telemetry_dir = std::getenv(telemetryDirVar);
return std::filesystem::path(telemetry_dir) / init_params.agentName.data();
const auto dir = nixl::config::getValue<std::filesystem::path>(telemetryDirVar);
return dir / init_params.agentName.data();
}
} // namespace

Expand Down
52 changes: 32 additions & 20 deletions src/core/telemetry/telemetry.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -23,6 +23,7 @@
#include <cstring>
#include <algorithm>

#include "common/configuration.h"
#include "common/nixl_log.h"
#include "telemetry.h"
#include "telemetry_event.h"
Expand Down Expand Up @@ -66,49 +67,60 @@ nixlTelemetry::~nixlTelemetry() {
}
}

namespace {
[[nodiscard]] std::optional<std::string>
getExporterName() {
if (const auto name = nixl::config::getValueOptional<std::string>(telemetryExporterVar)) {
return name;
Comment thread
brminich marked this conversation as resolved.
Resolved
}

if (!nixl::config::checkExistence(telemetryDirVar)) {
NIXL_DEBUG << telemetryDirVar
<< " is not set, NIXL telemetry is enabled without any exporter";
return std::nullopt;
}

NIXL_INFO << "No telemetry exporter was specified, using default: " << defaultTelemetryPlugin;

return defaultTelemetryPlugin;
}

} // namespace

void
nixlTelemetry::initializeTelemetry() {
auto buffer_size = std::getenv(TELEMETRY_BUFFER_SIZE_VAR) ?
std::stoul(std::getenv(TELEMETRY_BUFFER_SIZE_VAR)) :
DEFAULT_TELEMETRY_BUFFER_SIZE;
const auto buffer_size = nixl::config::getValueDefaulted<size_t>(TELEMETRY_BUFFER_SIZE_VAR,
DEFAULT_TELEMETRY_BUFFER_SIZE);

if (buffer_size == 0) {
throw std::invalid_argument("Telemetry buffer size cannot be 0");
}

const char *exporter_name = std::getenv(telemetryExporterVar);
const std::optional<std::string> exporter_name = getExporterName();

if (!exporter_name) {
NIXL_INFO << "No telemetry exporter was specified, using default: "
<< defaultTelemetryPlugin;
exporter_name = defaultTelemetryPlugin;
if (!std::getenv(telemetryDirVar)) {
NIXL_DEBUG << telemetryDirVar
<< " is not set, NIXL telemetry is enabled without any exporter";
return;
}
return;
}

auto &plugin_manager = nixlPluginManager::getInstance();
std::shared_ptr<const nixlTelemetryPluginHandle> plugin_handle =
plugin_manager.loadTelemetryPlugin(exporter_name);
plugin_manager.loadTelemetryPlugin(*exporter_name);

if (plugin_handle == nullptr) {
throw std::runtime_error("Failed to load telemetry plugin: " + std::string(exporter_name));
throw std::runtime_error("Failed to load telemetry plugin: " + *exporter_name);
}

const nixlTelemetryExporterInitParams init_params{agentName_, buffer_size};
exporter_ = plugin_handle->createExporter(init_params);
if (!exporter_) {
NIXL_ERROR << "Failed to create telemetry exporter: " << exporter_name;
NIXL_ERROR << "Failed to create telemetry exporter: " << *exporter_name;
return;
}

NIXL_DEBUG << "NIXL telemetry is enabled with " << exporter_name << "exporter";
NIXL_DEBUG << "NIXL telemetry is enabled with exporter: " << *exporter_name;

auto run_interval = std::getenv(TELEMETRY_RUN_INTERVAL_VAR) ?
std::chrono::milliseconds(std::stoul(std::getenv(TELEMETRY_RUN_INTERVAL_VAR))) :
DEFAULT_TELEMETRY_RUN_INTERVAL;
const auto run_interval =
nixl::config::getValueDefaulted(TELEMETRY_RUN_INTERVAL_VAR, DEFAULT_TELEMETRY_RUN_INTERVAL);

// Update write task interval and start it
writeTask_.callback_ = [this]() { return writeEventHelper(); };
Expand Down
20 changes: 7 additions & 13 deletions src/plugins/azure_blob/azure_blob_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <stdexcept>
#include <cstdlib>
#include <absl/strings/str_format.h>
#include "common/configuration.h"
#include "nixl_types.h"

namespace {
Expand All @@ -38,11 +39,8 @@ getAccountUrl(nixl_b_params_t *custom_params) {
return account_it->second;
}
}
const char *env_account = std::getenv("AZURE_STORAGE_ACCOUNT_URL");
if (env_account && env_account[0] != '\0') return std::string(env_account);
throw std::runtime_error(
"Account URL not found. Please provide 'account_url' in custom_params or "
"set AZURE_STORAGE_ACCOUNT_URL environment variable");

return nixl::config::getNonEmptyString("AZURE_STORAGE_ACCOUNT_URL");
}

std::string
Expand All @@ -54,11 +52,7 @@ getContainerName(nixl_b_params_t *custom_params) {
}
}

const char *env_container = std::getenv("AZURE_STORAGE_CONTAINER_NAME");
if (env_container && env_container[0] != '\0') return std::string(env_container);
throw std::runtime_error(
"Container name not found. Please provide 'container_name' in custom_params or "
"set AZURE_STORAGE_CONTAINER_NAME environment variable");
return nixl::config::getNonEmptyString("AZURE_STORAGE_CONTAINER_NAME");
}

std::string
Expand All @@ -69,9 +63,9 @@ getCaBundle(nixl_b_params_t *custom_params) {
return ca_bundle_it->second;
}
}
const char *env_ca_bundle = std::getenv("AZURE_CA_BUNDLE");
if (env_ca_bundle && env_ca_bundle[0] != '\0') return std::string(env_ca_bundle);
return ""; // Return empty string if not provided, which means use default CA bundle

// Return empty string if not provided, which means use default CA bundle
return nixl::config::getValueDefaulted<std::string>("AZURE_CA_BUNDLE", "");
}

} // namespace
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/libfabric/libfabric_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "libfabric_backend.h"
#include "serdes/serdes.h"
#include "common/configuration.h"
#include "common/nixl_log.h"

#include <dlfcn.h>
Expand Down Expand Up @@ -309,7 +310,7 @@ nixlLibfabricEngine::nixlLibfabricEngine(const nixlBackendInitParams *init_param
// Initialize CUDA context management
vramInitCtx();
// CUDA address workaround
if (getenv("NIXL_DISABLE_CUDA_ADDR_WA")) {
if (nixl::config::checkExistence("NIXL_DISABLE_CUDA_ADDR_WA")) {
NIXL_DEBUG << "Disabling CUDA address workaround";
cuda_addr_wa_ = false;
} else {
Expand Down
24 changes: 16 additions & 8 deletions src/plugins/mooncake/mooncake_backend.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -16,6 +16,7 @@
*/
#include "mooncake_backend.h"
#include "serdes/serdes.h"
#include "common/configuration.h"
#include "common/nixl_log.h"

#include <arpa/inet.h>
Expand All @@ -26,6 +27,7 @@
#include <sys/socket.h>
#include <unistd.h>

namespace {
std::vector<std::string>
findLocalIpAddresses() {
std::vector<std::string> ips;
Expand Down Expand Up @@ -68,14 +70,20 @@ findLocalIpAddresses() {
return ips;
}

[[nodiscard]] std::string
chooseIpAddress() {
static const std::string local = "127.0.0.1";
static const std::vector<std::string> ips = findLocalIpAddresses();
static const std::string &fallback = ips.empty() ? local : ips[0];
return nixl::config::getValueDefaulted("NIXL_MOONCAKE_IP_ADDR", fallback);
}

} // namespace

nixlMooncakeEngine::nixlMooncakeEngine(const nixlBackendInitParams *init_params)
: nixlBackendEngine(init_params) {
local_agent_name_ = init_params->localAgent;
auto ips = findLocalIpAddresses();
std::string segment_name = "127.0.0.1";
if (!ips.empty()) segment_name = ips[0];
if (getenv("NIXL_MOONCAKE_IP_ADDR"))
segment_name = std::string(getenv("NIXL_MOONCAKE_IP_ADDR"));
: nixlBackendEngine(init_params),
local_agent_name_(init_params->localAgent) {
const std::string segment_name = chooseIpAddress();
engine_ = createTransferEngine("P2PHANDSHAKE", segment_name.c_str(), "", 0, true);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/mooncake/mooncake_backend.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -119,7 +119,7 @@ class nixlMooncakeEngine : public nixlBackendEngine {

mutable std::mutex mutex_;
transfer_engine_t engine_;
std::string local_agent_name_;
const std::string local_agent_name_;
std::unordered_map<uint64_t, nixlMooncakeBackendMD *> mem_reg_info_;
std::unordered_map<std::string, AgentInfo> connected_agents_;
};
Expand Down
Loading
Loading