-
Notifications
You must be signed in to change notification settings - Fork 36
startSpan should take tracepoint location #68
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
Conversation
…ther general and powerful
Paging @weissi - the idea that we talked about yesterday. this would enable various location sensitive configuration or whatever one would want to do in a tracer |
func startSpan( | ||
_ operationName: String, | ||
baggage: Baggage, | ||
ofKind kind: SpanKind, | ||
at time: DispatchWallTime | ||
at time: DispatchWallTime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not the new Clock/Duration/... API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah just noticed this too tbh...
I'll need to think about this, it'd force users to require 5.7+ so we may not want that... we'd want vapor to adopt without having to suddenly bump their required swift versions. Probably we can add an public API accepting Instant
but I guess implementors may have to implement against dispatch time or something else... to keep the swift requirement low :-/
I'll think about it more and ticketify. AHC we'd also not want to force to require 5.7 suddenly 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add an overload though that delegates to the dispatch time one 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add overload in separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b8e4975
to
12d7326
Compare
@swift-server-bot test this please |
e7341c3
to
e4773fb
Compare
e4773fb
to
8ed9307
Compare
361c8dc
to
12b040a
Compare
12b040a
to
7ea80f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -47,25 +53,111 @@ public protocol Tracer: Instrument { | |||
} | |||
|
|||
extension Tracer { | |||
/// Start a new ``Span`` with the given `Baggage` starting at `DispatchWallTime.now()`. | |||
#if swift(>=5.3.0) | |||
/// Start a new ``Span`` with the given `Baggage` starting "now". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good simplification 👍
ofKind kind: SpanKind = .internal | ||
ofKind kind: SpanKind = .internal, | ||
function: String = #function, | ||
file fileID: String = #fileID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very much looking forward to a time where we can start to only support #fileID
in server-side Swift projects 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh NIO requires 5.5+ already, so most projects can. I'm not even sure we should keep trying with 5.1+ here... but for now we do.
Co-authored-by: Moritz Lang <[email protected]>
resolves #67
This allows the implementation of ad-hoc tracerbullets and configurable per "trace location" tracers.
Here's the gist of it:
or even better: