redpanda-data / redpanda

Redpanda is a streaming data platform for developers. Kafka API compatible. 10x faster. No ZooKeeper. No JVM!
https://redpanda.com
9.39k stars 577 forks source link

Unexpected time formatting for ss::lowres_clock #12009

Open travisdowns opened 1 year ago

travisdowns commented 1 year ago

Version & Environment

Redpanda version: 23.2

What went wrong?

In to_string.h we have a operator<<(std::ostream& o, const ss::lowres_clock::duration& d) overload which casts down to milliseconds and prints the value without units.

This was bad but mostly not awful when lowres_clock was measured in ms, but now that it's in ns, it just produces totally unexpected and wrong results.

See:

https://redpandadata.slack.com/archives/C044RD18NMV/p1668035746200669

What should have happened instead?

Time should be printed without down-casting and with units (among other possible options).

How to reproduce the issue?

  1. Examine the code.

Additional information

This occurred in part because lowres_clock switched its definition from a coarse definition (ms-resolution) to a fine-grained unit of nanoseconds quite some time ago.

JIRA Link: CORE-1369

github-actions[bot] commented 7 months ago

This issue hasn't seen activity in 3 months. If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in two weeks.