You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, thanks for making such a wonderful piece of software. Appreciate it :)
I'm wondering about the error behavior of send_stats in lib/datadog/statsd.rb, which is called by count, distribution, gauge, histogram, set, and timing.
Specifically, I was wondering whether calling this function can result in an error being raised.
I looked at the implementation of send_stats and noticed that it calls some functions that couldraise. For example, send_stats calls forwarder.send_message(full_stat), which calls sender.add(message). The implementation of sender.add seems like it could raise the following error.
def add(message)
raise ArgumentError, 'Start sender first' unless message_queue
... continued ...
end
This issue from 2016 seems to indicate that send_stats is safe (i.e. does not raise an error or call any functions that raise errors), but I wanted to re-confirm the answer.
Thanks!
The text was updated successfully, but these errors were encountered:
You are right that following the code path it looks like it has changed recently (since 5.0.0 I think). How much of this is an issue to you? Do you think that adding this information to methods documentation would be enough?
If this is an issue to you right now, you can use the single thread sender implementation (using single_thread: true on statsd constructor) which should never raise an error while using count, gauge and others.
Firstly, thanks for the response. I appreciate your help :)
I don't think its too much of an issue. I am working around it by rescuing errors on the caller side. I was mainly curious whether I could remove this layer of rescuing around the caller or not.
When I get some free time this week, I'll raise a PR to add this information to the method documentation.
Hey all,
Firstly, thanks for making such a wonderful piece of software. Appreciate it :)
I'm wondering about the error behavior of
send_stats
inlib/datadog/statsd.rb
, which is called bycount
,distribution
,gauge
,histogram
,set
, andtiming
.Specifically, I was wondering whether calling this function can result in an error being raised.
I looked at the implementation of
send_stats
and noticed that it calls some functions that couldraise
. For example,send_stats
callsforwarder.send_message(full_stat)
, which callssender.add(message)
. The implementation ofsender.add
seems like it could raise the following error.This issue from 2016 seems to indicate that
send_stats
is safe (i.e. does not raise an error or call any functions that raise errors), but I wanted to re-confirm the answer.Thanks!
The text was updated successfully, but these errors were encountered: