Skip to content

Commit 010ac75

Browse files
committed
enable task retry recording
1 parent 40cf447 commit 010ac75

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

lib/recorder.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const std::string Recorder::REC_START = "|recording started";
1010
const std::string Recorder::SWSS_FNAME = "swss.rec";
1111
const std::string Recorder::SAIREDIS_FNAME = "sairedis.rec";
1212
const std::string Recorder::RESPPUB_FNAME = "responsepublisher.rec";
13-
13+
const std::string Recorder::RETRY_FNAME = "retry.rec";
1414

1515
Recorder& Recorder::Instance()
1616
{
@@ -19,6 +19,17 @@ Recorder& Recorder::Instance()
1919
}
2020

2121

22+
SwSSRec::RetryRec()
23+
{
24+
/* Set Default values */
25+
setRecord(true);
26+
setRotate(false);
27+
setLocation(Recorder::DEFAULT_DIR);
28+
setFileName(Recorder::RETRY_FNAME);
29+
setName("Retry");
30+
}
31+
32+
2233
SwSSRec::SwSSRec()
2334
{
2435
/* Set Default values */

lib/recorder.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ class RecWriter : public RecBase {
4848
std::string fname;
4949
};
5050

51+
class RetryRec : public RecWriter {
52+
public:
53+
RetryRec();
54+
};
55+
5156
class SwSSRec : public RecWriter {
5257
public:
5358
SwSSRec();
@@ -73,12 +78,14 @@ class Recorder {
7378
static const std::string SWSS_FNAME;
7479
static const std::string SAIREDIS_FNAME;
7580
static const std::string RESPPUB_FNAME;
81+
static const std::string RETRY_FNAME;
7682

7783
Recorder() = default;
7884
/* Individual Handlers */
7985
SwSSRec swss;
8086
SaiRedisRec sairedis;
8187
ResPubRec respub;
88+
RetryRec retry;
8289
};
8390

8491
}

orchagent/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ extern bool gIsNatSupported;
6262
#define SAIREDIS_RECORD_ENABLE 0x1
6363
#define SWSS_RECORD_ENABLE (0x1 << 1)
6464
#define RESPONSE_PUBLISHER_RECORD_ENABLE (0x1 << 2)
65+
#define RETRY_RECORD_ENABLE (0x1 << 3)
6566

6667
/* orchagent heart beat message interval */
6768
#define HEART_BEAT_INTERVAL_MSECS_DEFAULT 10 * 1000
@@ -109,6 +110,7 @@ void sighup_handler(int signo)
109110
/*
110111
* Don't do any logging since they are using mutexes.
111112
*/
113+
Recorder::Instance().retry.setRotate(true);
112114
Recorder::Instance().swss.setRotate(true);
113115
Recorder::Instance().sairedis.setRotate(true);
114116
Recorder::Instance().respub.setRotate(true);
@@ -361,6 +363,7 @@ int main(int argc, char **argv)
361363
string record_location = Recorder::DEFAULT_DIR;
362364
string swss_rec_filename = Recorder::SWSS_FNAME;
363365
string sairedis_rec_filename = Recorder::SAIREDIS_FNAME;
366+
string retry_rec_filename = Recorder::RETRY_FNAME;
364367
string zmq_server_address = "tcp://127.0.0.1:" + to_string(ORCH_ZMQ_PORT);
365368
string vrf;
366369
bool enable_zmq = false;
@@ -395,7 +398,7 @@ int main(int argc, char **argv)
395398
// Disable all recordings if atoi() fails i.e. returns 0 due to
396399
// invalid command line argument.
397400
record_type = atoi(optarg);
398-
if (record_type < 0 || record_type > 7)
401+
if (record_type < 0 || record_type > 15)
399402
{
400403
usage();
401404
exit(EXIT_FAILURE);
@@ -522,6 +525,13 @@ int main(int argc, char **argv)
522525
Recorder::Instance().respub.setFileName(responsepublisher_rec_filename);
523526
Recorder::Instance().respub.startRec(false);
524527

528+
Recorder::Instance().retry.setRecord(
529+
(record_type & RETRY_RECORD_ENABLE) == RETRY_RECORD_ENABLE
530+
);
531+
Recorder::Instance().retry.setLocation(record_location);
532+
Recorder::Instance().retry.setFileName(retry_rec_filename);
533+
Recorder::Instance().retry.startRec(true);
534+
525535
// Instantiate database connectors
526536
DBConnector appl_db("APPL_DB", 0);
527537
DBConnector config_db("CONFIG_DB", 0);

0 commit comments

Comments
 (0)