-
Notifications
You must be signed in to change notification settings - Fork 19
Telemetry integration for Rialto Server #477
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)); \ | ||||||||||||||||||||||||||||
|
Comment on lines
+34
to
+37
|
||||||||||||||||||||||||||||
| #define TELEMETRY_INIT(component) \ | |
| do \ | |
| { \ | |
| t2_init(reinterpret_cast<char *>(component)); \ | |
| static inline void rialtoTelemetryInit(const char *component) | |
| { | |
| t2_init(const_cast<char *>(component)); | |
| } | |
| #define TELEMETRY_INIT(component) \ | |
| do \ | |
| { \ | |
| rialtoTelemetryInit(component); \ |
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_EVENT_STRING casts marker/value to char* with reinterpret_cast, which discards constness and can be undefined behavior. Use const_cast<char*> at most, or update the wrapper to accept const char* so callers don’t need to worry about mutability.
| 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 typo repeated here: "ControllIpc" should be "ControlIpc" to keep telemetry naming 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 typo repeated here: "ControllIpc" should be "ControlIpc" to keep telemetry naming 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 typo repeated here: "ControllIpc" should be "ControlIpc" to keep telemetry naming 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_INCLUDE_DIRS/TELEMETRY_LIBRARIESare used here, but there is nofind_package(telemetry)(or equivalent include ofFindtelemetry.cmake) anywhere in the repo, so these variables will be undefined and telemetry linking will not work whenCMAKE_TELEMETRY_2_0_REQUIREDis enabled. Please ensure the telemetry find-module is invoked before thesetarget_*calls.