opencensus-specs icon indicating copy to clipboard operation
opencensus-specs copied to clipboard

Define standard annotations for HTTP

Open Sebruck opened this issue 7 years ago • 2 comments

When a server answers with an HttpResponse there are two relevant events.

  1. The server generated the response and sent it to the client
  2. The body is fully transferred to the client

While 2. is indicated by the span end, 1. should be an annotation.

I think we should have a standard name for this annotation, something like response sent (server side) and response received (client side) comes into my mind.

WDYT? Any opinions?

Sebruck avatar May 15 '18 20:05 Sebruck

Interesting idea. I assume you mean annotations on the client-side span (since the server-side span would not known when the response had been received).

Why is the server-side span not sufficient for this? It should give you this information and be contained within the client-side span.

The only reason I could think for not having the server-side span is if the server is controlled by someone else. In this case, how would you know when the server had sent a response (seems to require cooperation from the server)?

semistrict avatar May 19 '18 00:05 semistrict

I think this also applies for the server side span.

In the end a timeline of a http request looks like this:

|--------------------------------------------------------------------------------------------------------------------------------------------------->|
conn        request header      request entity                  response header                response body                    connection closed       
open        received            fully received                  sent                           fully sent
                                                                                           (could be chunked / SSE)

For the client side it looks similar, just the received and sent key words flip.

In frameworks like akka-http or http4s it is easy to determine when these events happen since the Http Message (request or response) and their entity are separate asynchronous operations (Futures/Streams)

I think it would be nice to have for those events standardised annotations.

Sebruck avatar May 19 '18 11:05 Sebruck