Skip to content

Errors in send_stats #259

@aniruddhb

Description

@aniruddhb

Hey all,

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 could raise. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions