davidbarsky / tracing-tree

Apache License 2.0
123 stars 31 forks source link

Add Configuration for Higher Time Precision with Decimals #68

Closed hrmsk66 closed 11 months ago

hrmsk66 commented 1 year ago

To address https://github.com/davidbarsky/tracing-tree/issues/67, add a new configuration option, with_higher_precision. When this option is enabled, the time is displayed with higher precision, including decimal points.

[^1]: If this PR looks good, I'd like to propose an implementation to address Issue 17 based on this as a foundation.

Example Output: With higher_precision enabled, the output will look like this.

┐run{hostname="localhost"}
├─ 45.96μs TRACE Request received
├─┐fetch_httpbin{method=GET, path="/"}
│ ├─ 3.70s  DEBUG Response received, backend=httpbin, status=200 OK, cache_status=MISS
├─┘
├─┐fetch_example{method=GET, path="/"}
│ ├─ 587.93ms DEBUG Response received from example, backend=example, status=200 OK, cache_status=HIT
│ ├─┐open_datastore{name="subscriptions"}
│ ├─┘
│ ├─┐read_from_datastore{key="foo@example.com"}
│ │ ├─ 43.04μs  WARN Item found, key=foo@example.com
│ ├─┘
├─┘
├─ 4.29s  TRACE Returning response, status=200 OK
┘
hrmsk66 commented 11 months ago

Hi @oli-obk Rebased to resolve conflicts and noticed my PR needed updates to align with the main branch. In the "concurrent span switching detection (8ccafe8)" commit by @ten3roberts, the steps for retrieving Span's Extensions seemed to have been simplified in the on_event method. https://github.com/davidbarsky/tracing-tree/blob/8aa51bc654f0c09389fd885ac7310a53ad207693/src/lib.rs#L476-L487

I've adjusted this PR accordingly in 4c66dca.

oli-obk commented 11 months ago

Thanks!