Skip to content

Commit

Permalink
Output a warning only if the queue exceeds its peak
Browse files Browse the repository at this point in the history
  • Loading branch information
Keukhan committed Oct 14, 2024
1 parent 5092cd5 commit a65c593
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/projects/modules/managed_queue/managed_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,14 @@ namespace ov

// Logging
_last_logging_time += _stats_metric_interval;
if (_last_logging_time >= _log_interval)
if ((_last_logging_time >= _log_interval) && (_last_logged_peak < _peak))
{
_last_logging_time = 0;

auto shared_lock = std::shared_lock(_name_mutex);
logw(LOG_TAG, "[%u] %s size has exceeded the threshold: queue: %zu, threshold: %zu, peak: %zu", GetId(), _urn->ToString().CStr(), _size, _threshold, _peak);
logw(LOG_TAG, "[%u] %s has exceeded the threshold and increased peak. size: %zu, threshold: %zu, peak: %zu", GetId(), _urn->ToString().CStr(), _size, _threshold, _peak);

_last_logged_peak = _peak;
}
}
else
Expand Down Expand Up @@ -625,6 +628,9 @@ namespace ov
// Stop flag
bool _stop;

// Use to print logs when the peak value of the queue is increased.
size_t _last_logged_peak = 0;

// Message Skip for lack of performance
bool _skip_message_enabled = false;
int64_t _skip_messages_last_check_time = ov::Time::GetTimestampInMs();
Expand Down

0 comments on commit a65c593

Please sign in to comment.