Skip to content

How to set custom attributes at child spans? #5090

Answered by dmathieu
athoscouto asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, the approach you describe is what I mentioned.
Within your transport, you would have something like this:

func (t *yourTransport) RoundTrip(r *http.Request) (*http.Response, error) {
  span := trace.SpanFromContext(r.Context())
  span.SetAttributes(attributes.String("myTransport", "is here"))

  return t.parent.RoundTrip()
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@athoscouto
Comment options

@dmathieu
Comment options

Answer selected by athoscouto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants