@@ -25,7 +25,7 @@ namespace WPEFramework
2525{
2626namespace Plugin
2727{
28- AppManagerTelemetryReporting::AppManagerTelemetryReporting (): mTelemetryMetricsObject (nullptr ), mCurrentservice (nullptr )
28+ AppManagerTelemetryReporting::AppManagerTelemetryReporting (): mTelemetryPluginObject (nullptr ), mCurrentservice (nullptr )
2929 {
3030 }
3131
@@ -46,9 +46,9 @@ namespace Plugin
4646 mAdminLock .Lock ();
4747 mCurrentservice = service;
4848 mAdminLock .Unlock ();
49- if (Core::ERROR_NONE != createTelemetryMetricsPluginObject ())
49+ if (Core::ERROR_NONE != createTelemetryPluginObject ())
5050 {
51- LOGERR (" Failed to create TelemetryMetricsObject \n " );
51+ LOGERR (" Failed to create TelemetryObject \n " );
5252 }
5353 }
5454
@@ -59,7 +59,7 @@ namespace Plugin
5959 return ((time_t )(ts.tv_sec * 1000 ) + ((time_t )ts.tv_nsec /1000000 ));
6060 }
6161
62- Core::hresult AppManagerTelemetryReporting::createTelemetryMetricsPluginObject ()
62+ Core::hresult AppManagerTelemetryReporting::createTelemetryPluginObject ()
6363 {
6464 Core::hresult status = Core::ERROR_GENERAL;
6565
@@ -68,14 +68,14 @@ namespace Plugin
6868 {
6969 LOGERR (" mCurrentservice is null \n " );
7070 }
71- else if (nullptr == (mTelemetryMetricsObject = mCurrentservice ->QueryInterfaceByCallsign <WPEFramework::Exchange::ITelemetryMetrics >(" org.rdk.TelemetryMetrics " )))
71+ else if (nullptr == (mTelemetryPluginObject = mCurrentservice ->QueryInterfaceByCallsign <WPEFramework::Exchange::ITelemetry >(" org.rdk.Telemetry " )))
7272 {
73- LOGERR (" Failed to create TelemetryMetricsObject \n " );
73+ LOGERR (" Failed to create TelemetryObject \n " );
7474 }
7575 else
7676 {
7777 status = Core::ERROR_NONE;
78- LOGINFO (" created TelemetryMetrics Object" );
78+ LOGINFO (" created Telemetry Object" );
7979 }
8080 mAdminLock .Unlock ();
8181 return status;
@@ -86,19 +86,20 @@ namespace Plugin
8686 JsonObject jsonParam;
8787 std::string telemetryMetrics = " " ;
8888 std::string markerName = " " ;
89+ std::string appMarker = " " ;
8990 time_t currentTime = getCurrentTimestamp ();
9091 AppManagerImplementation*appManagerImplInstance = AppManagerImplementation::getInstance ();
9192
92- if (nullptr == mTelemetryMetricsObject ) /* mTelemetryMetricsObject is null retry to create*/
93+ if (nullptr == mTelemetryPluginObject ) /* mTelemetryPluginObject is null retry to create*/
9394 {
94- if (Core::ERROR_NONE != createTelemetryMetricsPluginObject ())
95+ if (Core::ERROR_NONE != createTelemetryPluginObject ())
9596 {
96- LOGERR (" Failed to create TelemetryMetricsObject \n " );
97+ LOGERR (" Failed to create TelemetryObject \n " );
9798 }
9899 }
99100
100101 auto it = appManagerImplInstance->mAppInfo .find (appId);
101- if ((it != appManagerImplInstance->mAppInfo .end ()) && (currentAction == it->second .currentAction ) && (nullptr != mTelemetryMetricsObject ))
102+ if ((it != appManagerImplInstance->mAppInfo .end ()) && (currentAction == it->second .currentAction ) && (nullptr != mTelemetryPluginObject ))
102103 {
103104 LOGINFO (" Received data for appId %s current action %d " ,appId.c_str (), currentAction);
104105
@@ -129,16 +130,18 @@ namespace Plugin
129130
130131 if (!markerName.empty ())
131132 {
133+ jsonParam[" markerName" ] = markerName;
132134 jsonParam.ToString (telemetryMetrics);
133135 if (!telemetryMetrics.empty ())
134136 {
135- mTelemetryMetricsObject ->Record (appId, telemetryMetrics, markerName);
137+ appMarker = appId + " :" + markerName;
138+ mTelemetryPluginObject ->Record (appMarker, telemetryMetrics);
136139 }
137140 }
138141 }
139142 else
140143 {
141- LOGERR (" Failed to report telemetry data as appId/currentAction or mTelemetryMetricsObject is not valid" );
144+ LOGERR (" Failed to report telemetry data as appId/currentAction or mTelemetryPluginObject is not valid" );
142145 }
143146 }
144147
@@ -147,19 +150,20 @@ namespace Plugin
147150 JsonObject jsonParam;
148151 std::string telemetryMetrics = " " ;
149152 std::string markerName = " " ;
153+ std::string appMarker = " " ;
150154 time_t currentTime = getCurrentTimestamp ();
151155 AppManagerImplementation*appManagerImplInstance = AppManagerImplementation::getInstance ();
152156
153- if (nullptr == mTelemetryMetricsObject ) /* mTelemetryMetricsObject is null retry to create*/
157+ if (nullptr == mTelemetryPluginObject ) /* mTelemetryPluginObject is null retry to create*/
154158 {
155- if (Core::ERROR_NONE != createTelemetryMetricsPluginObject ())
159+ if (Core::ERROR_NONE != createTelemetryPluginObject ())
156160 {
157- LOGERR (" Failed to create TelemetryMetricsObject \n " );
161+ LOGERR (" Failed to create TelemetryObject \n " );
158162 }
159163 }
160164
161165 auto it = appManagerImplInstance->mAppInfo .find (appId);
162- if ((it != appManagerImplInstance->mAppInfo .end ()) && (nullptr != mTelemetryMetricsObject ))
166+ if ((it != appManagerImplInstance->mAppInfo .end ()) && (nullptr != mTelemetryPluginObject ))
163167 {
164168 switch (it->second .currentAction )
165169 {
@@ -168,6 +172,7 @@ namespace Plugin
168172 {
169173 jsonParam[" totalLaunchTime" ] = (int )(currentTime - it->second .currentActionTime );
170174 jsonParam[" launchType" ] = ((AppManagerImplementation::APPLICATION_TYPE_INTERACTIVE == it->second .packageInfo .type )?" LAUNCH_INTERACTIVE" :" START_SYSTEM" );
175+ jsonParam[" markerFilters" ] = TELEMETRY_MARKER_LAUNCH_TIME_FILTER;
171176 markerName = TELEMETRY_MARKER_LAUNCH_TIME;
172177 }
173178 break ;
@@ -176,6 +181,7 @@ namespace Plugin
176181 {
177182 jsonParam[" totalLaunchTime" ] = (int )(currentTime - it->second .currentActionTime );
178183 jsonParam[" launchType" ] = ((AppManagerImplementation::APPLICATION_TYPE_INTERACTIVE == it->second .packageInfo .type )?" PRELOAD_INTERACTIVE" :" START_SYSTEM" );
184+ jsonParam[" markerFilters" ] = TELEMETRY_MARKER_LAUNCH_TIME_FILTER;
179185 markerName = TELEMETRY_MARKER_LAUNCH_TIME;
180186 }
181187 break ;
@@ -186,6 +192,7 @@ namespace Plugin
186192 {
187193 jsonParam[" totalCloseTime" ] = (int )(currentTime - it->second .currentActionTime );
188194 jsonParam[" closeType" ] = ((AppManagerImplementation::APP_ACTION_CLOSE == it->second .currentAction )?" CLOSE" :((AppManagerImplementation::APP_ACTION_TERMINATE == it->second .currentAction )?" TERMINATE" :" KILL" ));
195+ jsonParam[" markerFilters" ] = TELEMETRY_MARKER_CLOSE_TIME_FILTER;
189196 markerName = TELEMETRY_MARKER_CLOSE_TIME;
190197 }
191198 break ;
@@ -199,17 +206,20 @@ namespace Plugin
199206 jsonParam[" appId" ] = appId;
200207 jsonParam[" appInstanceId" ] = it->second .appInstanceId ;
201208 jsonParam[" appVersion" ] = it->second .packageInfo .version ;
209+ jsonParam[" secondaryId" ] = " appInstanceId" ;
210+ jsonParam[" markerName" ] = markerName;
202211 jsonParam.ToString (telemetryMetrics);
203212 if (!telemetryMetrics.empty ())
204213 {
205- mTelemetryMetricsObject ->Record (appId, telemetryMetrics, markerName);
206- mTelemetryMetricsObject ->Publish (appId, markerName);
214+ appMarker = appId + " :" + markerName;
215+ mTelemetryPluginObject ->Record (appMarker, telemetryMetrics);
216+ mTelemetryPluginObject ->Publish (appMarker);
207217 }
208218 }
209219 }
210220 else
211221 {
212- LOGERR (" Failed to report telemetry data as appId/mTelemetryMetricsObject is not valid" );
222+ LOGERR (" Failed to report telemetry data as appId/mTelemetryPluginObject is not valid" );
213223 }
214224 }
215225
@@ -218,41 +228,47 @@ namespace Plugin
218228 JsonObject jsonParam;
219229 std::string telemetryMetrics = " " ;
220230 std::string markerName = " " ;
231+ std::string appMarker = " " ;
221232
222233 LOGINFO (" Received data for appId %s current action %d app errorCode %d" ,appId.c_str (), currentAction, errorCode);
223234
224- if (nullptr == mTelemetryMetricsObject ) /* mTelemetryMetricsObject is null retry to create*/
235+ if (nullptr == mTelemetryPluginObject ) /* mTelemetryPluginObject is null retry to create*/
225236 {
226- if (Core::ERROR_NONE != createTelemetryMetricsPluginObject ())
237+ if (Core::ERROR_NONE != createTelemetryPluginObject ())
227238 {
228- LOGERR (" Failed to create TelemetryMetricsObject \n " );
239+ LOGERR (" Failed to create TelemetryObject \n " );
229240 }
230241 }
231242
232243 switch (currentAction)
233244 {
234245 case AppManagerImplementation::APP_ACTION_LAUNCH:
235246 case AppManagerImplementation::APP_ACTION_PRELOAD:
247+ jsonParam[" markerFilters" ] = TELEMETRY_MARKER_LAUNCH_ERROR_FILTER;
236248 markerName = TELEMETRY_MARKER_LAUNCH_ERROR;
237249 break ;
238250 case AppManagerImplementation::APP_ACTION_CLOSE:
239251 case AppManagerImplementation::APP_ACTION_TERMINATE:
240252 case AppManagerImplementation::APP_ACTION_KILL:
253+ jsonParam[" markerFilters" ] = TELEMETRY_MARKER_CLOSE_ERROR_FILTER;
241254 markerName = TELEMETRY_MARKER_CLOSE_ERROR;
242255 break ;
243256 default :
244257 LOGERR (" currentAction is invalid" );
245258 break ;
246259 }
247260
248- if (!markerName.empty () && (nullptr != mTelemetryMetricsObject ))
261+ if (!markerName.empty () && (nullptr != mTelemetryPluginObject ))
249262 {
250263 jsonParam[" errorCode" ] = (int )errorCode;
264+ jsonParam[" secondaryId" ] = " appInstanceId" ;
265+ jsonParam[" markerName" ] = markerName;
251266 jsonParam.ToString (telemetryMetrics);
252267 if (!telemetryMetrics.empty ())
253268 {
254- mTelemetryMetricsObject ->Record (appId, telemetryMetrics, markerName);
255- mTelemetryMetricsObject ->Publish (appId, markerName);
269+ appMarker = appId + " :" + markerName;
270+ mTelemetryPluginObject ->Record (appMarker, telemetryMetrics);
271+ mTelemetryPluginObject ->Publish (appMarker);
256272 }
257273 }
258274 }
0 commit comments