-
Notifications
You must be signed in to change notification settings - Fork 18
Telemetry integration #472
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) | ||||||||
|
||||||||
| find_package_handle_standard_args(TELEMETRY DEFAULT_MSG TELEMETRY_LIBRARY TELEMETRY_INCLUDE_DIR) | |
| find_package_handle_standard_args(telemetry DEFAULT_MSG TELEMETRY_LIBRARY TELEMETRY_INCLUDE_DIR) | |
| set(TELEMETRY_FOUND ${telemetry_FOUND}) |
Copilot
AI
Apr 8, 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.
Findtelemetry.cmake calls find_package_handle_standard_args with package name "TELEMETRY" (line 25). Since the project uses find_package(telemetry ...), this will set TELEMETRY_FOUND instead of telemetry_FOUND, so find_package(telemetry REQUIRED) may incorrectly fail even when the library is present. Also, when NATIVE_BUILD is true, no *_FOUND variable is set at all, so REQUIRED will always fail. Use the same package name casing as find_package() (e.g., telemetry) in find_package_handle_standard_args, and ensure the module sets telemetry_FOUND appropriately (or avoid REQUIRED unless telemetry is enabled).
Copilot
AI
Apr 8, 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.
The module filename suggests it will be used via find_package(telemetry), but find_package_handle_standard_args is invoked with TELEMETRY, producing TELEMETRY_FOUND rather than telemetry_FOUND. This case mismatch can make find_package(telemetry) report "not found" even when the library/header are present. Align the package name/casing throughout (filename, find_package_handle_standard_args argument, and _FOUND variable checks).
| 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 | ||
|
|
@@ -27,27 +28,60 @@ set(RialtoLogging_SOURCES | |
| source/LogFileHandle.cpp | ||
| source/LogFileHandle.h | ||
| source/RialtoLogging.cpp | ||
| source/RialtoTelemetry.cpp | ||
| ) | ||
|
|
||
| set(RialtoLogging_INCLUDES | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/include" | ||
| ) | ||
|
|
||
| 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") | ||
| find_package(telemetry REQUIRED) | ||
| add_definitions( -DRIALTO_TELEMETRY_SUPPORT=1 ) | ||
|
|
||
| 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
+43
to
+50
|
||
| 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(RialtoEthanLog PUBLIC RIALTO_TELEMETRY_SUPPORT=1) | ||
| target_include_directories(RialtoEthanLog PUBLIC ${TELEMETRY_INCLUDE_DIRS}) | ||
| target_link_libraries(RialtoEthanLog PUBLIC ${TELEMETRY_LIBRARIES}) | ||
| else() | ||
| message(STATUS "Telemetry support disabled (stub mode)") | ||
| endif() | ||
| set_target_properties(RialtoEthanLog PROPERTIES | ||
| CXX_STANDARD 17 | ||
| CXX_STANDARD_REQUIRED ON | ||
| CXX_EXTENSIONS OFF | ||
| POSITION_INDEPENDENT_CODE ON | ||
| ) | ||
| else() | ||
| message(STATUS "EthanLog is disabled") | ||
| add_library(RialtoEthanLog ALIAS RialtoLogging) | ||
| endif () | ||
| endif() | ||
| 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,54 @@ | ||
| /* | ||
| * 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 | ||
|
|
||
| void TELEMETRY_INIT(const char* component); | ||
| void TELEMETRY_UNINIT(); | ||
| void TELEMETRY_EVENT_STRING(const char* marker, const char* value); | ||
| void TELEMETRY_EVENT_FLOAT(const char* marker, float value); | ||
| void TELEMETRY_EVENT_INT(const char* marker, int value); | ||
|
|
||
| #else /* stub implementation if telemetry not enabled */ | ||
|
|
||
| inline void TELEMETRY_INIT(const char* component) {} | ||
| inline void TELEMETRY_UNINIT() {} | ||
| inline void TELEMETRY_EVENT_STRING(const char* marker, const char* value) {} | ||
| inline void TELEMETRY_EVENT_FLOAT(const char* marker, float value) {} | ||
| inline void TELEMETRY_EVENT_INT(const char* marker, int value) {} | ||
|
|
||
| #endif /* RIALTO_TELEMETRY_SUPPORT */ | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* RIALTO_TELEMETRY_H_ */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| #include "RialtoLogging.h" | ||
| #include <cstring> | ||
| #include <cstdio> | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
| #endif | ||
|
|
||
| #define RIALTO_TELEMETRY_LOG_MIL(fmt, args...) RIALTO_LOG_MIL(RIALTO_COMPONENT_SERVER, fmt, ##args) | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
Comment on lines
+24
to
+33
|
||
|
|
||
| #ifdef RIALTO_TELEMETRY_SUPPORT | ||
|
|
||
| void TELEMETRY_INIT(const char* component) | ||
| { | ||
| RIALTO_TELEMETRY_LOG_MIL("Telemetry initialized for: %s", component); | ||
| printf("Telemetry initialized for: %s", component); | ||
| // Copy into a mutable buffer: t2_init takes char* and may write to it, | ||
|
Comment on lines
+37
to
+41
|
||
| // so passing a const/string-literal directly is undefined behavior. | ||
| char buf[64]; | ||
| strncpy(buf, component, sizeof(buf) - 1); | ||
| buf[sizeof(buf) - 1] = '\0'; | ||
| t2_init(buf); | ||
|
Comment on lines
+43
to
+46
|
||
| } | ||
|
Comment on lines
+20
to
+47
|
||
|
|
||
| void TELEMETRY_UNINIT() | ||
| { | ||
| t2_uninit(); | ||
| } | ||
|
|
||
| void TELEMETRY_EVENT_STRING(const char* marker, const char* value) | ||
| { | ||
| RIALTO_LOG_MIL(RIALTO_COMPONENT_SERVER, "Telemetry marker: %s, value: %s", marker, value); | ||
| printf("Telemetry marker: %s, value: %s", marker, value); | ||
| t2_event_s(const_cast<char*>(marker), const_cast<char*>(value)); | ||
|
Comment on lines
+24
to
+58
|
||
| } | ||
|
Comment on lines
+54
to
+59
|
||
|
|
||
| void TELEMETRY_EVENT_FLOAT(const char* marker, float value) | ||
| { | ||
| t2_event_f(const_cast<char*>(marker), static_cast<double>(value)); | ||
| } | ||
|
Comment on lines
+54
to
+64
|
||
|
|
||
| void TELEMETRY_EVENT_INT(const char* marker, int value) | ||
| { | ||
| t2_event_d(const_cast<char*>(marker), static_cast<int>(value)); | ||
|
|
||
| } | ||
|
|
||
| #endif /* RIALTO_TELEMETRY_SUPPORT */ | ||
|
Comment on lines
+1
to
+71
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |||||||
| #define RIALTO_CLIENT_LOGGING_H_ | ||||||||
|
|
||||||||
| #include "RialtoLogging.h" | ||||||||
|
||||||||
| #include "RialtoLogging.h" | |
| #include "RialtoLogging.h" | |
| #include "RialtoTelemetry.h" |
Copilot
AI
Apr 8, 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.
RialtoClientLogging.h now includes , but this header doesn’t use stdio APIs directly. Pulling into a widely-included logging header increases coupling/compile time; prefer including only in the .cpp files that call snprintf.
| #include <cstdio> |
| 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 6, 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 has a typo: "ControllIpc" (double 'l'). This will fragment metrics under an incorrect marker name; please correct the marker identifier.
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
Copilot
AI
Apr 6, 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 name has a typo ("ControllIpc"). Please rename it to "ControlIpc" to keep markers consistent across the codebase/metrics.
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
Copilot
AI
Apr 7, 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.
Same telemetry marker typo as above (ControllIpc -> ControlIpc).
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
Copilot
AI
Apr 7, 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.
The telemetry marker string has a typo: "ControllIpc" (double “l”). This makes the marker inconsistent and harder to query/aggregate. Rename it to "ControlIpc" (and keep it consistent across all occurrences in this file).
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
Copilot
AI
Apr 6, 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 name has a typo ("ControllIpc"). Please rename it to "ControlIpc" to keep markers consistent across the codebase/metrics.
Copilot
AI
Apr 7, 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.
Same telemetry marker typo as above (ControllIpc -> ControlIpc).
Copilot
AI
Apr 7, 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.
The telemetry marker string has a typo: "ControllIpc" (double “l”). This makes the marker inconsistent and harder to query/aggregate. Rename it to "ControlIpc" (and keep it consistent across all occurrences in this file).
Copilot
AI
Apr 6, 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 name has a typo ("ControllIpc"). Please rename it to "ControlIpc" to keep markers consistent across the codebase/metrics.
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
Copilot
AI
Apr 7, 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.
Same telemetry marker typo as above (ControllIpc -> ControlIpc).
| TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); | |
| TELEMETRY_EVENT_STRING("Rialto Client - ControlIpc", telemetryBuff); |
Copilot
AI
Apr 7, 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.
The telemetry marker string has a typo: "ControllIpc" (double “l”). This makes the marker inconsistent and harder to query/aggregate. Rename it to "ControlIpc" (and keep it consistent across all occurrences in this file).
| 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.
Findtelemetry.cmake uses find_package_handle_standard_args(TELEMETRY ...) which sets TELEMETRY_FOUND, but the project calls find_package(telemetry ...), which expects telemetry_FOUND. This case mismatch can cause find_package(telemetry REQUIRED) to fail even when the library is present. Use find_package_handle_standard_args(telemetry ...) (or otherwise set telemetry_FOUND) to match the package name.