Add TraceEvent severity knob (#6326)

* add knob for trace event severity

* add knob for TraceEvent severity

* fix format

* fix switch format

* moved intToSeverity call inside __test initialization

* updated knob name

* fix line length format

* fix format

* git clang-format
This commit is contained in:
Steven Li 2022-02-02 11:36:17 -08:00 committed by GitHub
parent 65f2c14f31
commit 36c6e23700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 4 deletions

View File

@ -209,6 +209,7 @@ void FlowKnobs::initialize(Randomize randomize, IsSimulated isSimulated) {
init( MAX_TRACE_EVENT_LENGTH, 4000 ); // If the value of this is changed, the corresponding default in Trace.cpp should be changed as well
init( ALLOCATION_TRACING_ENABLED, true );
init( SIM_SPEEDUP_AFTER_SECONDS, 450 );
init( CODE_COV_TRACE_EVENT_SEVERITY, 10 ); // Code coverage TraceEvent severity level
//TDMetrics
init( MAX_METRICS, 600 );

View File

@ -265,6 +265,7 @@ public:
int MAX_TRACE_FIELD_LENGTH;
int MAX_TRACE_EVENT_LENGTH;
bool ALLOCATION_TRACING_ENABLED;
int CODE_COV_TRACE_EVENT_SEVERITY;
// TDMetrics
int64_t MAX_METRIC_SIZE;

View File

@ -64,6 +64,29 @@ enum Severity {
SevMax = 1000000
};
inline Severity intToSeverity(int sevnum) {
switch (sevnum) {
case 0:
return SevVerbose;
case 1:
return SevSample;
case 5:
return SevDebug;
case 10:
return SevInfo;
case 20:
return SevWarn;
case 30:
return SevWarnAlways;
case 40:
return SevError;
case 1000000:
return SevMax;
default:
return SevInfo;
}
}
enum class ErrorKind : uint8_t {
Unset,
DiskIssue,

View File

@ -61,10 +61,11 @@
#define TEST(condition) \
if (!(condition)) { \
} else { \
static TraceEvent* __test = &(TraceEvent("CodeCoverage") \
.detail("File", __FILE__) \
.detail("Line", __LINE__) \
.detail("Condition", #condition)); \
static TraceEvent* __test = \
&(TraceEvent(intToSeverity(FLOW_KNOBS->CODE_COV_TRACE_EVENT_SEVERITY), "CodeCoverage") \
.detail("File", __FILE__) \
.detail("Line", __LINE__) \
.detail("Condition", #condition)); \
(void)__test; \
}