-
Notifications
You must be signed in to change notification settings - Fork 18
Telemetry integration for Rialto Server Manager #478
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # | ||
| # If not stated otherwise in this file or this component's LICENSE file the | ||
| # following copyright and licenses apply: | ||
| # | ||
| # Copyright 2026 Sky UK | ||
| # | ||
| # 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. | ||
| # | ||
|
|
||
| if(NOT NATIVE_BUILD) | ||
| find_path(TELEMETRY_INCLUDE_DIR NAMES telemetry_busmessage_sender.h) | ||
| find_library(TELEMETRY_LIBRARY NAMES telemetry_msgsender) | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(TELEMETRY DEFAULT_MSG TELEMETRY_LIBRARY TELEMETRY_INCLUDE_DIR) | ||
|
|
||
| mark_as_advanced(TELEMETRY_INCLUDE_DIR TELEMETRY_LIBRARY) | ||
|
|
||
| if(TELEMETRY_FOUND) | ||
| set(TELEMETRY_LIBRARIES ${TELEMETRY_LIBRARY}) | ||
| set(TELEMETRY_INCLUDE_DIRS ${TELEMETRY_INCLUDE_DIR}) | ||
| else() | ||
| set(TELEMETRY_LIBRARIES "") | ||
| set(TELEMETRY_INCLUDE_DIRS "") | ||
| endif() | ||
| else() | ||
| set(TELEMETRY_INCLUDE_DIRS "") | ||
| set(TELEMETRY_LIBRARIES "") | ||
| endif() |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |||||||||||||
|
|
||||||||||||||
| set(RialtoLogging_HEADERS | ||||||||||||||
| include/RialtoLogging.h | ||||||||||||||
| include/RialtoTelemetry.h | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| set(RialtoLogging_SOURCES | ||||||||||||||
|
|
@@ -34,20 +35,50 @@ set(RialtoLogging_INCLUDES | |||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| add_library(RialtoLogging STATIC ${RialtoLogging_HEADERS} ${RialtoLogging_SOURCES}) | ||||||||||||||
| target_include_directories(RialtoLogging PUBLIC "$<BUILD_INTERFACE:${RialtoLogging_INCLUDES}>") | ||||||||||||||
| set_target_properties(RialtoLogging PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) | ||||||||||||||
| set_target_properties(RialtoLogging PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||||||||||||||
| target_include_directories(RialtoLogging PUBLIC | ||||||||||||||
| "$<BUILD_INTERFACE:${RialtoLogging_INCLUDES}>" | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| # Telemetry support | ||||||||||||||
| if(CMAKE_TELEMETRY_2_0_REQUIRED) | ||||||||||||||
| message(STATUS "Telemetry 2.0 support enabled") | ||||||||||||||
| target_compile_definitions(RialtoLogging PUBLIC RIALTO_TELEMETRY_SUPPORT=1) | ||||||||||||||
| target_include_directories(RialtoLogging PUBLIC ${TELEMETRY_INCLUDE_DIRS}) | ||||||||||||||
| target_link_libraries(RialtoLogging PUBLIC ${TELEMETRY_LIBRARIES}) | ||||||||||||||
| else() | ||||||||||||||
| message(STATUS "Telemetry support disabled (stub mode)") | ||||||||||||||
| endif() | ||||||||||||||
|
|
||||||||||||||
| set_target_properties(RialtoLogging PROPERTIES | ||||||||||||||
| CXX_STANDARD 17 | ||||||||||||||
| CXX_STANDARD_REQUIRED ON | ||||||||||||||
| CXX_EXTENSIONS OFF | ||||||||||||||
| POSITION_INDEPENDENT_CODE ON | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| # EthanLog support | ||||||||||||||
| find_package(EthanLog) | ||||||||||||||
| if (EthanLog_FOUND AND RIALTO_ENABLE_ETHAN_LOG) | ||||||||||||||
| message(STATUS "EthanLog is enabled") | ||||||||||||||
| add_library(RialtoEthanLog STATIC ${RialtoLogging_HEADERS} ${RialtoLogging_SOURCES}) | ||||||||||||||
| target_include_directories(RialtoEthanLog PUBLIC "$<BUILD_INTERFACE:${RialtoLogging_INCLUDES}>") | ||||||||||||||
| target_compile_definitions(RialtoEthanLog PRIVATE USE_ETHANLOG) | ||||||||||||||
| target_link_libraries(RialtoEthanLog PUBLIC EthanLog::EthanLog) | ||||||||||||||
| set_target_properties(RialtoEthanLog PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) | ||||||||||||||
| set_target_properties(RialtoEthanLog PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||||||||||||||
| else () | ||||||||||||||
| if(CMAKE_TELEMETRY_2_0_REQUIRED) | ||||||||||||||
| message(STATUS "Telemetry 2.0 support enabled") | ||||||||||||||
| target_compile_definitions(RialtoLogging PUBLIC RIALTO_TELEMETRY_SUPPORT=1) | ||||||||||||||
| target_include_directories(RialtoLogging PUBLIC ${TELEMETRY_INCLUDE_DIRS}) | ||||||||||||||
| target_link_libraries(RialtoLogging PUBLIC ${TELEMETRY_LIBRARIES}) | ||||||||||||||
|
Comment on lines
+69
to
+71
|
||||||||||||||
| target_compile_definitions(RialtoLogging PUBLIC RIALTO_TELEMETRY_SUPPORT=1) | |
| target_include_directories(RialtoLogging PUBLIC ${TELEMETRY_INCLUDE_DIRS}) | |
| target_link_libraries(RialtoLogging PUBLIC ${TELEMETRY_LIBRARIES}) | |
| target_compile_definitions(RialtoEthanLog PUBLIC RIALTO_TELEMETRY_SUPPORT=1) | |
| target_include_directories(RialtoEthanLog PUBLIC ${TELEMETRY_INCLUDE_DIRS}) | |
| target_link_libraries(RialtoEthanLog PUBLIC ${TELEMETRY_LIBRARIES}) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ extern "C" | |
| { | ||
| #endif | ||
|
|
||
| #include "RialtoTelemetry.h" | ||
| #include <stdarg.h> | ||
| #include <stdint.h> | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| /* | ||
| * If not stated otherwise in this file or this component's LICENSE file the | ||
| * following copyright and licenses apply: | ||
| * | ||
| * Copyright 2026 Sky UK | ||
| * | ||
| * 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 RIALTO_TELEMETRY_H_ | ||
| #define RIALTO_TELEMETRY_H_ | ||
|
|
||
| #ifdef RIALTO_TELEMETRY_SUPPORT | ||
| #include <telemetry_busmessage_sender.h> | ||
| #endif | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
| #endif | ||
|
|
||
| #ifdef RIALTO_TELEMETRY_SUPPORT | ||
|
|
||
| #define TELEMETRY_INIT(component) \ | ||
| do \ | ||
| { \ | ||
| t2_init(reinterpret_cast<char *>(component)); \ | ||
| } while (0) | ||
|
|
||
| #define TELEMETRY_UNINIT() \ | ||
| do \ | ||
| { \ | ||
| t2_uninit(); \ | ||
| } while (0) | ||
|
|
||
| #define TELEMETRY_EVENT_STRING(marker, value) \ | ||
| do \ | ||
| { \ | ||
| t2_event_s(reinterpret_cast<char *>(marker), reinterpret_cast<char *>(value)); \ | ||
| } while (0) | ||
|
|
||
| #define TELEMETRY_EVENT_FLOAT(marker, value) \ | ||
| do \ | ||
| { \ | ||
| t2_event_f(reinterpret_cast<char *>(marker), static_cast<double>(value)); \ | ||
| } while (0) | ||
|
|
||
| #define TELEMETRY_EVENT_INT(marker, value) \ | ||
| do \ | ||
| { \ | ||
| t2_event_d(reinterpret_cast<char *>(marker), static_cast<int>(value)); \ | ||
| } while (0) | ||
|
Comment on lines
+34
to
+62
|
||
|
|
||
| #else /* stub implementation if telemetry not enabled */ | ||
|
|
||
| #define TELEMETRY_INIT(component) \ | ||
| do \ | ||
| { \ | ||
| } while (0) | ||
| #define TELEMETRY_UNINIT() \ | ||
| do \ | ||
| { \ | ||
| } while (0) | ||
| #define TELEMETRY_EVENT_STRING(m, v) \ | ||
| do \ | ||
| { \ | ||
| } while (0) | ||
| #define TELEMETRY_EVENT_FLOAT(m, v) \ | ||
| do \ | ||
| { \ | ||
| } while (0) | ||
| #define TELEMETRY_EVENT_INT(m, v) \ | ||
| do \ | ||
| { \ | ||
| } while (0) | ||
|
|
||
| #endif /* RIALTO_TELEMETRY_SUPPORT */ | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* RIALTO_TELEMETRY_H_ */ | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -115,6 +115,10 @@ bool ControlIpc::getSharedMemory(int32_t &fd, uint32_t &size) | |||||
| if (ipcController->Failed()) | ||||||
| { | ||||||
| RIALTO_CLIENT_LOG_ERROR("failed to get the shared memory due to '%s'", ipcController->ErrorText().c_str()); | ||||||
| char telemetryBuff[128] = {0}; | ||||||
| snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get the shared memory due to '%s'", | ||||||
| ipcController->ErrorText().c_str()); | ||||||
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | ||||||
|
||||||
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Telemetry marker string uses "ControllIpc" (extra 'l'), which looks like a typo and will create a separate marker from the intended component name. Rename the marker to match the actual module/class name ("ControlIpc") so telemetry aggregation stays consistent.
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Telemetry marker string uses "ControllIpc" (extra 'l'), which looks like a typo and will create a separate marker from the intended component name. Rename the marker to match the actual module/class name ("ControlIpc") so telemetry aggregation stays consistent.
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Telemetry marker string uses "ControllIpc" (extra 'l'), which looks like a typo and will create a separate marker from the intended component name. Rename the marker to match the actual module/class name ("ControlIpc") so telemetry aggregation stays consistent.
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Telemetry support is gated on
CMAKE_TELEMETRY_2_0_REQUIRED, but this CMakeLists doesn’t callfind_package(telemetry)(or otherwise populateTELEMETRY_INCLUDE_DIRS/TELEMETRY_LIBRARIES). As a result, enabling telemetry will likely fail to find headers/libs or silently link nothing. Consider invokingfind_package(telemetry REQUIRED)inside the telemetry-enabled block (using the newcmake/Findtelemetry.cmake) and validating the variables before adding include dirs/link libs.