xmidt-org / wrp-go

go implementation of the Web Routing Protocol
Apache License 2.0
4 stars 7 forks source link

Decouple github.com/Comcast/webpa-common/tracing #8

Open schmidtw opened 5 years ago

schmidtw commented 5 years ago
wrpendpoint/requestResponse.go
wrpendpoint/requestResponse_test.go
wrphttp/mocks_test.go

The wrp-go package shouldn't depend on the tracing solution from webpa-common.

denopink commented 2 years ago

@johnabass would we replace this dependence with candlelight?

denopink commented 2 years ago

looks like we're leverage the following from webpa-common/tracing https://github.com/xmidt-org/wrp-go/blob/5acbd902ae2b8b6bc1e31cea75b8d682cd4371e3/wrpendpoint/requestResponse.go#L193-L217

https://github.com/xmidt-org/wrp-go/blob/3719b163ade887ad7abe5dc4d58173bffa896128/wrpendpoint/requestResponse_test.go#L307-L313

// NewSpanner constructs a new Spanner with the given options.  By default, a Spanner
// will use time.Now() to get the current time and time.Since() to compute durations.
func NewSpanner(o ...SpannerOption) Spanner {
    sp := &spanner{
        now:   time.Now,
        since: time.Since,
    }

    for _, option := range o {
        option(sp)
    }

    return sp
}

// Mergeable represents a Spanned which can be merged with other spans
type Mergeable interface {
    Spanned

    // WithSpans returns an instance of this object with the new Spans, possibly
    // merged into those returned by Spans.  This method should generally return
    // a shallow copy of itself with the new spans, to preserve immutability.
    WithSpans(...Span) interface{}
}

// Span represents the result of some arbitrary section of code.  Clients create Span objects
// via a Spanner.  A Span is immutable once it has been created via a Spanner closure.
type Span interface {
    // Name is the name of the operation
    Name() string

    // Start is the time at which the operation started
    Start() time.Time

    // Duration is how long the operation took.  This value is computed once, when the
    // closure from Spanner.Start is called.
    Duration() time.Duration

    // Error is any error that occurred.  This will be the error passed to the closure
    // returned from Spanner.Start.  This error can be nil.
    Error() error
}
denopink commented 1 year ago

assigning @renaz6 so she can let us know when candlelight is at a better state