Skip to content

Commit 24bde1e

Browse files
committed
agents: remove ASSERT that can be ignored
Instead of updating the ASSERT with additional error info, remove them since there's nothing to do in case there's an error. PR-URL: #13 Santiago Gimeno <[email protected]>
1 parent bced2ed commit 24bde1e

File tree

3 files changed

+8
-21
lines changed

3 files changed

+8
-21
lines changed

agents/otlp/src/otlp_agent.cc

+3-6
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,9 @@ void OTLPAgent::span_msg_cb_(nsuv::ns_async*, OTLPAgent* agent) {
403403

404404
agent->got_proc_metrics();
405405
for (auto& item : agent->env_metrics_map_) {
406-
int r = item.second.metrics_.Update(thr_metrics_cb_, agent);
407-
// The UV_ESRCH and UV_EBADF errors can happen during the env shutdown
408-
// process. Leaving this assertion for the moment in case another error is
409-
// returned at some point.
410-
// TODO(santi): Remove the assertion
411-
ASSERT(r == 0 || r == UV_ESRCH || r == UV_EBADF);
406+
// Retrieve metrics from the Metrics API. Ignore any return error since
407+
// there's nothing to be done.
408+
item.second.metrics_.Update(thr_metrics_cb_, agent);
412409
}
413410
}
414411

agents/statsd/src/statsd_agent.cc

+3-8
Original file line numberDiff line numberDiff line change
@@ -731,14 +731,9 @@ void StatsDAgent::metrics_timer_cb_(nsuv::ns_timer*, StatsDAgent* agent) {
731731
it != agent->env_metrics_map_.end();
732732
++it) {
733733
ThreadMetrics& e_metrics = std::get<1>(*it);
734-
// Retrieve metrics from the Metrics API.
735-
int r = e_metrics.Update(env_metrics_cb_, agent);
736-
// The UV_ESRCH and UV_EBADF errors can happen during the env shutdown
737-
// process.
738-
// Leaving this assertion for the moment in case another error is returned
739-
// at some point.
740-
// TODO(santi): Remove the assertion.
741-
ASSERT(r == 0 || r == UV_ESRCH || r == UV_EBADF);
734+
// Retrieve metrics from the Metrics API. Ignore any return error since
735+
// there's nothing to be done.
736+
e_metrics.Update(env_metrics_cb_, agent);
742737
}
743738

744739
// Get and send proc metrics

agents/zmq/src/zmq_agent.cc

+2-7
Original file line numberDiff line numberDiff line change
@@ -1638,14 +1638,9 @@ void ZmqAgent::metrics_timer_cb(nsuv::ns_timer*, ZmqAgent* agent) {
16381638
EnvMetricsStor& stor = std::get<1>(*it);
16391639
// Reset fetching flag.
16401640
stor.fetching = false;
1641-
// Retrieve metrics from the Metrics API.
1641+
// Retrieve metrics from the Metrics API. Ignore any return error since
1642+
// there's nothing to be done.
16421643
int r = stor.t_metrics.Update(env_metrics_cb, agent);
1643-
// The UV_ESRCH and UV_EBADF errors can happen during the env shutdown
1644-
// process.
1645-
// Leaving this assertion for the moment in case another error is returned
1646-
// at some point.
1647-
// TODO(santi): Remove the assertion.
1648-
ASSERT(r == 0 || r == UV_ESRCH || r == UV_EBADF);
16491644
if (r == 0)
16501645
stor.fetching = true;
16511646
}

0 commit comments

Comments
 (0)