Page MenuHomeSoftware Heritage

Add a statsd client module

Authored by olasd on Dec 19 2018, 3:38 PM.



prometheus-statsd-exporter uses the datadog format for its tags, so base our
client on their Python code, with the following modifications:

  • Removed python < 3.5 compat code
  • trimmed the imports down to be a single module
  • adjust some options:
    • drop unix socket connection option
    • add environment variable support for setting the statsd host and port (pulled the idea from the main python statsd module)
    • only send timer metrics in milliseconds (that's what prometheus-statsd-exporter expects)
    • drop DataDog-specific metric types (that are unsupported in prometheus-statsd-exporter)
  • made the tags a dict instead of a list (prometheus-statsd-exporter only supports tags with a value, mirroring prometheus)
  • improve unit test coverage
  • documentation cleanup
Test Plan


Diff Detail

rDCORE Foundations and core functionalities
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

olasd created this revision.Dec 19 2018, 3:38 PM
douardda requested changes to this revision.Dec 20 2018, 11:05 AM
douardda added inline comments.

wouldn't time.monotonic be preferable here?


what is self.elapsed needed for? tests? if so, document this (comment) plz


if ':' in tag ?

This revision now requires changes to proceed.Dec 20 2018, 11:05 AM
olasd updated this revision to Diff 2789.Dec 21 2018, 3:11 PM

Apply David's comments

olasd marked 3 inline comments as done.Dec 21 2018, 3:11 PM
douardda accepted this revision.Jan 7 2019, 10:56 AM
This revision is now accepted and ready to land.Jan 7 2019, 10:56 AM
This revision was automatically updated to reflect the committed changes.