Skip to content

Commit

Permalink
agents: remove ASSERT that can be ignored
Browse files Browse the repository at this point in the history
Instead of updating the ASSERT with additional error info, remove them
since there's nothing to do in case there's an error.
  • Loading branch information
trevnorris committed Oct 30, 2023
1 parent 3b0c50d commit 1ab84d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
9 changes: 3 additions & 6 deletions agents/otlp/src/otlp_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,9 @@ void OTLPAgent::span_msg_cb_(nsuv::ns_async*, OTLPAgent* agent) {

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

Expand Down
11 changes: 3 additions & 8 deletions agents/statsd/src/statsd_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -731,14 +731,9 @@ void StatsDAgent::metrics_timer_cb_(nsuv::ns_timer*, StatsDAgent* agent) {
it != agent->env_metrics_map_.end();
++it) {
ThreadMetrics& e_metrics = std::get<1>(*it);
// Retrieve metrics from the Metrics API.
int r = e_metrics.Update(env_metrics_cb_, agent);
// The UV_ESRCH and UV_EBADF errors can happen during the env shutdown
// process.
// Leaving this assertion for the moment in case another error is returned
// at some point.
// TODO(santi): Remove the assertion.
ASSERT(r == 0 || r == UV_ESRCH || r == UV_EBADF);
// Retrieve metrics from the Metrics API. Ignore any return error since
// there's nothing to be done.
e_metrics.Update(env_metrics_cb_, agent);
}

// Get and send proc metrics
Expand Down
9 changes: 2 additions & 7 deletions agents/zmq/src/zmq_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1638,14 +1638,9 @@ void ZmqAgent::metrics_timer_cb(nsuv::ns_timer*, ZmqAgent* agent) {
EnvMetricsStor& stor = std::get<1>(*it);
// Reset fetching flag.
stor.fetching = false;
// Retrieve metrics from the Metrics API.
// Retrieve metrics from the Metrics API. Ignore any return error since
// there's nothing to be done.
int r = stor.t_metrics.Update(env_metrics_cb, agent);
// The UV_ESRCH and UV_EBADF errors can happen during the env shutdown
// process.
// Leaving this assertion for the moment in case another error is returned
// at some point.
// TODO(santi): Remove the assertion.
ASSERT(r == 0 || r == UV_ESRCH || r == UV_EBADF);
if (r == 0)
stor.fetching = true;
}
Expand Down

0 comments on commit 1ab84d0

Please sign in to comment.