apple/swift-distributed-tracing

Add documentation for SpanAttributeKey

adam-fowler opened this issue · 0 comments

I only found this by mistake. It isn't obvious from the reference documentation how you would use this.

I'm assuming it works as follows.

extension SpanAttribute {
    var httpMethod: SpanAttributeKey<String> { .init(name: "http.method") }
}
span.attributes.httpMethod = .string("GET")

Is there anyway to get this to work

func setMethod(_ method: String) {
    span.attributes.httpMethod = method
}