apple / swift-distributed-tracing

Instrumentation library for Swift server applications
https://swiftpackageindex.com/apple/swift-distributed-tracing/main/documentation/tracing
Apache License 2.0
222 stars 30 forks source link

remove clock protocol, use autoclosure "now" instant #120

Closed ktoso closed 1 year ago

ktoso commented 1 year ago

Motivation:

we don't need the clock protocol, but we do need the default clock to provide an instant.

We also add time to recordError in this PR

Resolves https://github.com/apple/swift-distributed-tracing/issues/119 Resolves https://github.com/apple/swift-distributed-tracing/issues/108

ktoso commented 1 year ago

We have discussed this one with @fabianfett yesterday at length, it'll work nicely

ktoso commented 1 year ago

I'll merge since I want to get the documentation / reference docs revived today, but post-merge review is welcome -- this mostly just swaps clock: some TracerClock for at instant: @autoclosure () -> some TracerInstant but we default impl using TracerClock so we can still mock it out globally if we wanted to 👍