Repository navigation
Cyclic buffer telemetry exporter moved to use plug-in infrastructure #1088
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
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6bd6d50
Cyclic buffer telemetry exporter moved to use plug-in infrastructure
alexanderbilk cf67e7e
Removing redundant headers and try/catch routines
alexanderbilk 876eebc
Minor fixes
alexanderbilk 63c3310
Moving buffer to be class member
alexanderbilk bfe3671
Removing fall back routine
alexanderbilk 3ff2778
Allowing NIXL_TELEMETRY_DIR to be not set
alexanderbilk e6e371f
Compilance with previous functionality. If NIXL_TELEMETRY_DIR is not …
alexanderbilk 673bc58
Removing redaundant logging
alexanderbilk c344d6a
Not letting to load default telemetry plug-in if NIXL_TELEMETRY_DIR i…
alexanderbilk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * 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. | ||
| */ | ||
| #include "buffer_exporter.h" | ||
| #include "common/nixl_log.h" | ||
|
|
||
| constexpr const char telemetryDirVar[] = "NIXL_TELEMETRY_DIR"; | ||
|
|
||
| namespace { | ||
| static std::filesystem::path | ||
| getFilePath(const nixlTelemetryExporterInitParams &init_params) { | ||
| auto telemetry_dir = std::getenv(telemetryDirVar); | ||
| if (!telemetry_dir) { | ||
| throw std::invalid_argument(std::string(telemetryDirVar) + " is not set"); | ||
| } | ||
|
|
||
| return std::filesystem::path(telemetry_dir) / init_params.agentName.data(); | ||
| } | ||
| } // namespace | ||
|
|
||
| nixlTelemetryBufferExporter::nixlTelemetryBufferExporter( | ||
| const nixlTelemetryExporterInitParams &init_params) | ||
| : nixlTelemetryExporter(init_params), | ||
| filePath_(getFilePath(init_params)), | ||
| buffer_(filePath_.string(), true, TELEMETRY_VERSION, getMaxEventsBuffered()) { | ||
| NIXL_INFO << "Telemetry enabled, using buffer path: " << filePath_.string() | ||
| << " with size: " << getMaxEventsBuffered(); | ||
| } | ||
|
|
||
| nixl_status_t | ||
| nixlTelemetryBufferExporter::exportEvent(const nixlTelemetryEvent &event) { | ||
| if (!buffer_.push(event)) { | ||
| return NIXL_ERR_UNKNOWN; | ||
| } | ||
|
|
||
| return NIXL_SUCCESS; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * 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. | ||
| */ | ||
| #ifndef _TELEMETRY_BUFFER_EXPORTER_H | ||
| #define _TELEMETRY_BUFFER_EXPORTER_H | ||
|
|
||
| #include "common/cyclic_buffer.h" | ||
| #include "telemetry/telemetry_exporter.h" | ||
| #include "telemetry_event.h" | ||
| #include "nixl_types.h" | ||
|
|
||
| #include <filesystem> | ||
|
|
||
| /** | ||
| * @class nixlTelemetryBufferExporter | ||
| * @brief Shared memory buffer based telemetry exporter implementation | ||
| * | ||
| * This class implements the telemetry exporter interface to export | ||
| * telemetry events to a shared memory buffer. | ||
| */ | ||
| class nixlTelemetryBufferExporter : public nixlTelemetryExporter { | ||
| public: | ||
| /** | ||
| * @brief Constructor using init params (plugin-compatible) | ||
| * @param init_params Initialization parameters | ||
| */ | ||
| explicit nixlTelemetryBufferExporter(const nixlTelemetryExporterInitParams &init_params); | ||
|
|
||
| nixl_status_t | ||
| exportEvent(const nixlTelemetryEvent &event) override; | ||
|
|
||
| private: | ||
| std::filesystem::path filePath_; | ||
| sharedRingBuffer<nixlTelemetryEvent> buffer_; | ||
| }; | ||
|
|
||
| #endif // _TELEMETRY_BUFFER_EXPORTER_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * 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. | ||
| */ | ||
|
|
||
| #include "buffer_exporter.h" | ||
| #include "telemetry/telemetry_plugin.h" | ||
| #include "telemetry/telemetry_exporter.h" | ||
|
|
||
| // Plugin type alias for convenience | ||
| using buffer_exporter_plugin_t = nixlTelemetryPluginCreator<nixlTelemetryBufferExporter>; | ||
|
|
||
| nixlTelemetryPlugin * | ||
| createStaticBUFFERPlugin() { | ||
|
rakhmets marked this conversation as resolved.
Resolved
|
||
| return buffer_exporter_plugin_t::create(nixlTelemetryPluginApiVersionV1, "buffer", "1.0.0"); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.