Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Cleanup the ochttp package #536

Merged
merged 1 commit into from
Mar 8, 2018

Conversation

rakyll
Copy link
Contributor

@rakyll rakyll commented Mar 8, 2018

Several reorganization related and readability improvements.

Several reorganization related and readability improvements.
Copy link
Member

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks @rakyll. LGTM with some nits. Thank you!

if !h.NoTrace {
var end func()
r, end = h.startTrace(w, r)
defer end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, I like this, I read the previous code on my way back home and had the urge for this kind of change, so thank you!

}

span.SetAttributes(requestAttrs(r)...)
return r.WithContext(trace.WithSpan(r.Context(), span)), span.End
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for changing it from func() { span.End } to span.End!

writer http.ResponseWriter
}

var _ http.ResponseWriter = (*trackingResponseWriter)(nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for this cleanup.

start time.Time
statusCode int
endOnce sync.Once
writer http.ResponseWriter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writer seems quite ambigious for the field of http.ResponseWriter.

How about either of?

  • rw
  • responseWriter

@semistrict semistrict merged commit c863f21 into census-instrumentation:master Mar 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants