Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> You want to strive to test that logging logs and observability observes?

You're asking this rhetorically, but I often find interesting problems once I start really exercising the latter, like:

- Non-global collectors we forgot to register, or fail to get registered on some code paths.

- Collectors that get registered twice or overlap with other collectors only in some conditions (e.g. connection addresses that are sometimes the same and sometimes not depending on how your service gets distributed).

- Collectors that are not really safe scraping concurrently with the rest of the program; our test suites include race detectors.

- Metrics that don't follow idiomatic naming conventions (can be found via e.g. `promtool check metrics`).

- Metrics with legitimate difficult-to-notice bugs. We had an underflow counting the size of a connection pool because `Close()`ing one twice was explicitly allowed.

> Testing trivial code brings negative value

Agreed in the abstract, but if we were good judges of what code was trivial or not, we'd write a lot less bugs in the first place!

That being said, this is also a discussion about coverage, not assertions. Even if I'm not actually checking any of those things, those code paths (and logging) are still getting exercised via any decent E2E/functional/behavioral test suite.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: