Skip to content
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

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

Open
schmidtw opened this issue Mar 14, 2019 · 3 comments
Open

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

schmidtw opened this issue Mar 14, 2019 · 3 comments
Assignees
Labels
webpa-common archival/deprecation work related to the archival & deprecation of webpa-common

Comments

@schmidtw
Copy link
Member

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
Copy link
Contributor

@johnabass would we replace this dependence with candlelight?

@denopink denopink self-assigned this Jun 16, 2022
@denopink
Copy link
Contributor

looks like we're leverage the following from webpa-common/tracing

type Response interface {
Note
tracing.Mergeable
}
// response is the internal Response implementation
type response struct {
note
spans []tracing.Span
}
func (r *response) Spans() []tracing.Span {
return r.spans
}
func (r *response) WithSpans(spans ...tracing.Span) interface{} {
if len(spans) > 0 {
return &response{
note: r.note,
spans: spans,
}
}
return r
}

func testResponseSpans(t *testing.T, message wrp.Message) {
var (
require = require.New(t)
assert = assert.New(t)
spanner = tracing.NewSpanner()
original = WrapAsResponse(&message)
)

// 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 denopink added the webpa-common archival/deprecation work related to the archival & deprecation of webpa-common label Sep 16, 2022
@denopink denopink assigned renaz6 and unassigned denopink Feb 27, 2023
@denopink
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
webpa-common archival/deprecation work related to the archival & deprecation of webpa-common
Projects
None yet
Development

No branches or pull requests

3 participants