Skip to content

Commit 5b4b32f

Browse files
committed
DPL: add debug information for rate limiting
1 parent a4bd6bc commit 5b4b32f

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

Framework/Core/src/ControlWebSocketHandler.cxx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
#include "StatusWebSocketHandler.h"
1515
#include "Framework/DeviceMetricsHelper.h"
1616
#include "Framework/ServiceMetricsInfo.h"
17+
#include "Framework/Signpost.h"
1718
#include <regex>
1819
#include "Framework/Logger.h"
1920
#include "Framework/DeviceConfigInfo.h"
2021

22+
O2_DECLARE_DYNAMIC_LOG(rate_limiting);
23+
2124
namespace o2::framework
2225
{
2326
void ControlWebSocketHandler::frame(char const* frame, size_t s)
@@ -74,6 +77,10 @@ void ControlWebSocketHandler::endChunk()
7477
if (!didProcessMetric) {
7578
return;
7679
}
80+
O2_SIGNPOST_ID_GENERATE(sid, rate_limiting);
81+
O2_SIGNPOST_START(rate_limiting, sid, "endChunk",
82+
"Processing metrics from device %d (had new metric: %d)",
83+
mIndex, (int)didHaveNewMetric);
7784
size_t timestamp = (uv_hrtime() - mContext.driver->startTime) / 1000000 + mContext.driver->startTimeMsFromEpoch;
7885
assert(mContext.metrics);
7986
assert(mContext.infos);
@@ -91,6 +98,8 @@ void ControlWebSocketHandler::endChunk()
9198
for (auto& metricsInfo : *mContext.metrics) {
9299
std::fill(metricsInfo.changed.begin(), metricsInfo.changed.end(), false);
93100
}
101+
O2_SIGNPOST_END(rate_limiting, sid, "endChunk",
102+
"Done processing metrics from device %d", mIndex);
94103
}
95104

96105
void ControlWebSocketHandler::headers(std::map<std::string, std::string> const& headers)

Framework/Core/src/DevicesManager.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@
1313
#include "Framework/RuntimeError.h"
1414
#include "Framework/Logger.h"
1515
#include "Framework/DeviceController.h"
16+
#include "Framework/Signpost.h"
17+
18+
O2_DECLARE_DYNAMIC_LOG(devices_manager);
1619

1720
namespace o2::framework
1821
{
1922

2023
void DevicesManager::queueMessage(char const* target, char const* message)
2124
{
25+
O2_SIGNPOST_ID_GENERATE(sid, devices_manager);
26+
O2_SIGNPOST_EVENT_EMIT(devices_manager, sid, "queue",
27+
"Queuing message for %{public}s: %{public}s",
28+
target, message);
2229
for (int di = 0; di < specs.size(); ++di) {
2330
if (specs[di].id == target) {
2431
messages.push_back({di, message});
@@ -44,6 +51,10 @@ void DevicesManager::flush()
4451
LOGP(info, "Controller for {} now available.", specs[handle.ref.index].id);
4552
notifiedAvailable = true;
4653
}
54+
O2_SIGNPOST_ID_GENERATE(sid, devices_manager);
55+
O2_SIGNPOST_EVENT_EMIT(devices_manager, sid, "flush",
56+
"Flushing message to %{public}s: %{public}s",
57+
specs[handle.ref.index].id.c_str(), handle.message.c_str());
4758
controller->write(handle.message.c_str(), handle.message.size());
4859
}
4960

0 commit comments

Comments
 (0)