Closed
Description
Currently the Tracer
protocol has the startSpan
requirement. The return of startSpan
is a Span
which is a protocol. In other words we return an existential here. Instead we might want to consider making the Span an associated type and returning the concrete type:
public protocol Tracer: Instrument {
associatedType Span: SpanProtocol // the current Span protocol maybe needs a rename to SpanProtocol for this?
func startSpan(
_ operationName: String,
baggage: Baggage,
ofKind kind: SpanKind,
at time: DispatchWallTime,
function: String,
file fileID: String,
line: UInt
) -> Span
func forceFlush()
}
I can see no reasons, why a Tracer would return Spans of different types. If that was a requirement adopters could work around this, by using internal enums.
Result
We preserve more type information if we work with a concrete Tracer.
Metadata
Metadata
Assignees
Labels
No labels