Skip to content

Abstract away time source: TracingTime #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

ktoso
Copy link
Member

@ktoso ktoso commented Feb 2, 2023

Introduce a TracingTime type that hides the dispatch use for the time source.
If we get a Clock that can do this, we can more easily move to using it in API, without breaking tracer implementations.

Kind of... Resolves #71

/// The `DispatchWallTime` at which this event occurred.
public let time: DispatchWallTime
/// The time at which this event occurred.
public let time: TracingTime
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The important part here is that even if we deprecate Span creation with this type and move to Clock, it would not have to be breaking to Tracer implementations -- they can still work without rushing to a breaking change in time type

public struct TracingTime: Sendable {
enum Repr {
case dispatchWallTime(DispatchWallTime)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potentially other Clock.Instants or other time sources here...

}
private var repr: Repr

private init(dispatchWallTime: DispatchWallTime) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not public?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i attempted to hide away dispatch completely, debatable if we care to do so or not

@ktoso
Copy link
Member Author

ktoso commented Mar 29, 2023

replaced by #98

@ktoso ktoso closed this Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adopt Clock in tracing APIs
2 participants