Support trace event overflow.
This commit is contained in:
parent
2a46fdb31d
commit
047563aa62
|
@ -119,6 +119,7 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) {
|
|||
init( TRACE_EVENT_METRIC_UNITS_PER_SAMPLE, 500 );
|
||||
init( TRACE_EVENT_THROTLLER_SAMPLE_EXPIRY, 1800.0 ); // 30 mins
|
||||
init( TRACE_EVENT_THROTTLER_MSG_LIMIT, 20000 );
|
||||
init( TRACE_EVENT_MAX_SIZE, 4000 );
|
||||
init( TRACE_LOG_MAX_PREOPEN_BUFFER, 1000000 );
|
||||
|
||||
//TDMetrics
|
||||
|
|
|
@ -141,6 +141,7 @@ public:
|
|||
int TRACE_EVENT_METRIC_UNITS_PER_SAMPLE;
|
||||
int TRACE_EVENT_THROTLLER_SAMPLE_EXPIRY;
|
||||
int TRACE_EVENT_THROTTLER_MSG_LIMIT;
|
||||
int TRACE_EVENT_MAX_SIZE;
|
||||
int TRACE_LOG_MAX_PREOPEN_BUFFER;
|
||||
|
||||
//TDMetrics
|
||||
|
|
|
@ -879,9 +879,12 @@ TraceEvent& TraceEvent::detailImpl( std::string key, std::string value, bool wri
|
|||
|
||||
fields.addField(key, value);
|
||||
length += key.size() + value.size();
|
||||
// TODO: Overflow? buffer was first 300 bytes. TraceEvent(SevError, "TraceEventOverflow").detail("TraceFirstBytes", buffer);
|
||||
|
||||
if(writeEventMetricField) {
|
||||
if(length > FLOW_KNOBS->TRACE_EVENT_MAX_SIZE) {
|
||||
TraceEvent(SevError, "TraceEventOverflow").detail("TraceFirstBytes", fields.toString().substr(300));
|
||||
enabled = false;
|
||||
}
|
||||
else if(writeEventMetricField) {
|
||||
tmpEventMetric->setField(key.c_str(), Standalone<StringRef>(StringRef(value)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue