Skip to content

Commit e645064

Browse files
RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Profiles (#190)
* RDK-59221: Enable Accumulate Support For Grep Markers in Telemetry Profiles Signed-off-by: Yogeswaran K <yogeswaransky@comcast.com>
1 parent 690272a commit e645064

File tree

20 files changed

+1022
-383
lines changed

20 files changed

+1022
-383
lines changed

schemas/t2_reportProfileSchema.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"logFile": { "type": "string", "description": "The name of the log file to be searched."},
4141
"use": { "$ref": "#/definitions/parmUse", "description": "This property indicates how the data for this parameter should be gathered and reported.<br/>&bull;&nbsp;&nbsp;\"count\": Indicates that the value to report for this parameter is the number of times it has occurred during the reporting interval..<br/>&bull;&nbsp;&nbsp;\"absolute\": Indicates that the value to report for this parameter is the last actual value received, in the case of events, or found in the log file, in the case of greps.<br/>&bull;&nbsp;&nbsp;\"csv\": Indicates that the value to report for this parameter is a comma separated list of all the actual values received, in the case of events, or found in the log file, in the case of greps. <b>NOTE:</b> \"csv\" is not currently supported in Telemetry 2.0."},
4242
"reportEmpty": { "type": "boolean", "default":"false", "description": "Should this marker name be included in the generated report even if the search string was not found in the log file?"},
43+
"reportTimestamp": { "$ref": "#/definitions/parmReportTimestamp", "description": "This property indicates whether or not a timestamp should be encoded to indicate the time at which this parameter data was received."}
4344
"firstSeekFromEOF": { "type": "integer", "description": "An offset, in bytes, backward from logFile EOF to where the grep for search must begin for the first report this profile generates. See documentation."}
4445
},
4546
"additionalProperties": false,

source/bulkdata/profile.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ static void* CollectAndReport(void* data)
339339
int count = profile->grepSeekProfile->execCounter;
340340

341341
Vector *profileParamVals = NULL;
342-
Vector *grepResultList = NULL;
343342
cJSON *valArray = NULL;
344343
char* jsonReport = NULL;
345344
cJSON *triggercondition = NULL;
@@ -452,26 +451,13 @@ static void* CollectAndReport(void* data)
452451
}
453452
if(profile->topMarkerList != NULL && Vector_Size(profile->topMarkerList) > 0)
454453
{
455-
Vector *topMarkerResultList = NULL;
456-
Vector_Create(&topMarkerResultList);
457-
processTopPattern(profile->name, profile->topMarkerList, topMarkerResultList, 0);
458-
long int reportSize = Vector_Size(topMarkerResultList);
459-
if(reportSize != 0)
460-
{
461-
T2Info("Top markers report is compleated report size %ld\n", (unsigned long)reportSize);
462-
encodeGrepResultInJSON(valArray, topMarkerResultList);
463-
}
464-
else
465-
{
466-
T2Debug("Top markers report generated but is empty possabliy the memory value is changed");
467-
}
468-
Vector_Destroy(topMarkerResultList, freeGResult);
454+
processTopPattern(profile->name, profile->topMarkerList, 0);
455+
encodeTopResultInJSON(valArray, profile->topMarkerList);
469456
}
470457
if(profile->gMarkerList != NULL && Vector_Size(profile->gMarkerList) > 0)
471458
{
472-
getGrepResults(&(profile->grepSeekProfile), profile->gMarkerList, &grepResultList, profile->bClearSeekMap, false, customLogPath); // Passing 5th argument as false so that it doesn't check rotated logs for the first reporting after bootup for multiprofiles.
473-
encodeGrepResultInJSON(valArray, grepResultList);
474-
Vector_Destroy(grepResultList, freeGResult);
459+
getGrepResults(&(profile->grepSeekProfile), profile->gMarkerList, profile->bClearSeekMap, false, customLogPath); // Passing 4th argument as false so that it doesn't check rotated logs for the first reporting after bootup for multiprofiles.
460+
encodeGrepResultInJSON(valArray, profile->gMarkerList);
475461
}
476462
if(profile->eMarkerList != NULL && Vector_Size(profile->eMarkerList) > 0)
477463
{

source/bulkdata/profilexconf.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ static void* CollectAndReportXconf(void* data)
227227
}
228228
profile = singleProfile;
229229
Vector *profileParamVals = NULL;
230-
Vector *grepResultList = NULL;
231230
cJSON *valArray = NULL;
232231
char* jsonReport = NULL;
233232
char* customLogPath = NULL;
@@ -287,27 +286,15 @@ static void* CollectAndReportXconf(void* data)
287286
}
288287
if(profile->topMarkerList != NULL && Vector_Size(profile->topMarkerList) > 0)
289288
{
290-
Vector *topMarkerResultList = NULL;
291-
Vector_Create(&topMarkerResultList);
292-
processTopPattern(profile->name, profile->topMarkerList, topMarkerResultList, count);
293-
long int reportSize = Vector_Size(topMarkerResultList);
294-
if(reportSize != 0)
295-
{
296-
T2Info("Top markers report is compleated report size %ld\n", (unsigned long)reportSize);
297-
encodeGrepResultInJSON(valArray, topMarkerResultList);
298-
}
299-
else
300-
{
301-
T2Debug("Top markers report generated but is empty possabliy the memory value is changed");
302-
}
303-
Vector_Destroy(topMarkerResultList, freeGResult);
289+
processTopPattern(profile->name, profile->topMarkerList, count);
290+
T2Info("Top markers report is completed\n");
291+
encodeTopResultInJSON(valArray, profile->topMarkerList);
304292
}
305293
if(profile->gMarkerList != NULL && Vector_Size(profile->gMarkerList) > 0)
306294
{
307-
getGrepResults(&(profile->grepSeekProfile), profile->gMarkerList, &grepResultList, profile->bClearSeekMap, checkRotated, customLogPath); // Passing 5th argument as true to check rotated logs only in case of single profile
295+
getGrepResults(&(profile->grepSeekProfile), profile->gMarkerList, profile->bClearSeekMap, checkRotated, customLogPath); // Passing 4th argument as true to check rotated logs only in case of single profile
308296
T2Info("Grep complete for %lu markers \n", (unsigned long)Vector_Size(profile->gMarkerList));
309-
encodeGrepResultInJSON(valArray, grepResultList);
310-
Vector_Destroy(grepResultList, freeGResult);
297+
encodeGrepResultInJSON(valArray, profile->gMarkerList);
311298
}
312299

313300
dcaFlagReportCompleation();

0 commit comments

Comments
 (0)