Markers whose type is configured as "<message_bus>"
In T2.0, the aim is to instrument possible number of split and count based markers from component side. These are termed as event markers. Can be classified as one more type under the classification of markers. Once a marker is instrumented from component side, its configuration on xconf will be changed from the configured file name to "<event>" in 'type:' section.
Overview of Instrumenting RDKB components with T2 shared library (commonlib) APIs:
Steps to instrument split based and count based markers from RDKB components side.
Check if that particular device Build have the Telemtry2.0 building capability
Include required headers
Compile the component with telemetry 2.0 support
Initialize the module with telemetry
Find the correct place to report a marker
Use appropriate APIs to report markers and values.
Must check notes
To Check if a particular device build have the Telemtry2.0 building capability
Should have an entry in device based.xml file
"telemetry2_0" should be appeneded to DISTRO_FEATURES in machine configuration file.NOTE: Distro feature will be removed soon, and this page will be updated to reflect that.
Include required headers / declare enough sized telemetry buffer and send events to T2 with t2_event_s() api
NOTE: Now that T2.0 is present on all RDK-B platforms, there is no need to use the #if defined for the header or T2.0 API calls
To compile a component with Telemetry2.0 if it is enabled for that device. NOTE: Distro feature will be removed soon, and this page will be updated to reflect that.
Add depends to telemetry module.
Add Compile time (-DENABLE_FEATURE_TELEMETRY2_0) and linking time (-ltelemetry_msgsender) flags to the recipe file.
Make sure that bb file has below line to avoid compilation errors.
Previously in DCA telemetry, a marker is reported based on the xconf configured "content" string - when the content string is found in corresponding configured filename configured under 'type:' section .
Once the place is decided, use the right API to report Marker and values.
For markers without "_split" suffix, the marker data is just a count of the number of times the marker is received. In this case, thet2_event_dAPI can be used because the marker data passed to the API is not important.
For markers with "_split" suffix, the marker data is important, so use the API most appropriate to the marker data. For instance, if the marker data is a string, uset2_event_s. But if marker data is numeric, use one oft2_event_dort2_event_f. Also note that testing must ensure the string used for marker data matches the string expected by legacy telemetry.
In RDKB we have logs coming from both scripts and component's code (code in C). From which markers are reported/grepped.
List of APIs :
To report markers from components
t2_event_s(char* marker, char* value) - To send _split marker with string value to T2
Usage:
t2_event_s("xh_mac_3_split", "xh_MAC_value”);
t2_event_s("xh_mac_3_split", strBuff); /* where strBuff contains the string value to be reported for this marker */
NOTE: The instrumented component could use a static buffer or do a buffer malloc itself; but T2 common lib makes its own copy regardless, so instrumented component must clean up after itself.
t2_event_f(char* marker, double value) - To send marker with double value to T2
Usage: t2_event_d("HWREV_split", 2.2);
t2_event_d(char* marker, int value) - To send marker with integer value to T2 (or) to report count based markers
Usage:
t2_event_d("WIFI_INFO_Zero_5G_Clients", 1); /* To report counter based markers-- The value is reported as "1" */
t2_event_d("Total_5G_clients_split", num_devs); /* To report integer type split markers */
If you are defining a character array buffer to store the value corresponding to marker ,Make sure Maximum buffer size is allocated, And is reset with '\0' before and after its use.