Page MenuHomeSoftware Heritage

Add a statsd client module
ClosedPublic

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

Details

Summary

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

tox

Diff Detail

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

Event Timeline

douardda added inline comments.
swh/core/statsd.py
56

wouldn't time.monotonic be preferable here?

76

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

181

if ':' in tag ?

This revision now requires changes to proceed.Dec 20 2018, 11:05 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.