Page MenuHomeSoftware Heritage

statsd: make TimedContextManagerDecorator report errors
ClosedPublic

Authored by douardda on Mar 27 2019, 10:51 AM.

Details

Summary

using an incremented counter, instead of pushing an inacurrate timing
data (if calling the encapsulated function raises an exception).

Depends on D1296

Diff Detail

Repository
rDCORE Foundations and core functionalities
Branch
current
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 4845
Build 6459: tox-on-jenkinsJenkins
Build 6458: arc lint + arc unit

Event Timeline

olasd requested changes to this revision.Mar 27 2019, 11:37 AM
olasd added a subscriber: olasd.

No tests for the error behavior? Sad :(

This revision now requires changes to proceed.Mar 27 2019, 11:37 AM
vlorentz added inline comments.
swh/core/statsd.py
108–110

You can drop the start = None and replace

finally:
    if start is not None:
        self._send(start)

by:

else:
    self._send(start)

(same comment for the block below)

swh/core/statsd.py
108–110

gheez, you are damn right!

swh/core/statsd.py
108–110

In fact no, at least not exactly, because of the return statement in the try block.

swh/core/statsd.py
108–110

Oops indeed. The return could be at the end of the function, though.

Add tests and follow vlorentz' advice

This revision is now accepted and ready to land.Mar 28 2019, 11:15 AM
This revision was automatically updated to reflect the committed changes.