1- # HTTP
1+ # HTTP Trace
22
33This document explains tracing of HTTP requests with OpenCensus.
44
55## Spans
66
7- Implementations MUST create a span for outgoing requests at the
8- client and a span for incoming requests at the server.
7+ Implementations MUST create a span for outgoing requests at the client and a span for incoming
8+ requests at the server.
99
1010Span name is formatted as:
1111
1212* /$path for outgoing requests.
1313* /($path|$route) for incoming requests.
1414
15- If route cannot be determined, path is used to name the
16- the span for outgoing requests.
15+ If route cannot be determined, path is used to name the the span for outgoing requests.
1716
1817Port MUST be omitted if it is 80 or 443.
1918
@@ -28,35 +27,31 @@ incoming requests should be a span kind of SERVER.
2827
2928## Propagation
3029
31- Propagation is how SpanContext is transmitted on the wire
32- in an HTTP request.
30+ Propagation is how SpanContext is transmitted on the wire in an HTTP request.
3331
34- Implementations MUST allow users to set their own propagation
35- format and MUST provide an implementation for B3 at least.
32+ Implementations MUST allow users to set their own propagation format and MUST provide an
33+ implementation for B3 at least.
3634
3735If user doesn't set any propagation methods explicitly, B3 is used.
3836
39- The propagation method SHOULD modify a request object to insert
40- a SpanContext or SHOULD be able to extract a SpanContext from a
41- request object.
37+ The propagation method SHOULD modify a request object to insert a SpanContext or SHOULD be able
38+ to extract a SpanContext from a request object.
4239
4340## Status
4441
45- Implementations MUST set status if HTTP request or response
46- is not successful (e.g. not 2xx). In redirection case, if
47- the client doesn't have autoredirection support, request
48- should be considered successful.
42+ Implementations MUST set status if HTTP request or response is not successful (e.g. not 2xx). In
43+ redirection case, if the client doesn't have autoredirection support, request should be
44+ considered successful.
4945
50- Set status code to UNKNOWN (2) if the reason cannot be inferred
51- at the callsite or from the HTTP status code.
46+ Set status code to UNKNOWN (2) if the reason cannot be inferred at the callsite or from the HTTP
47+ status code.
5248
53- Don't set the status message if the reason can be inferred at
54- the callsite of from the HTTP status code.
49+ Don't set the status message if the reason can be inferred at the callsite of from the HTTP
50+ status code.
5551
5652## Message events
5753
58- In the lifetime of an incoming and outgoing request, the following
59- message events SHOULD be created:
54+ In the lifetime of an incoming and outgoing request, the following message events SHOULD be created:
6055
6156* A message event for the request body size if/when determined.
6257* A message event for the response size if/when determined.
@@ -75,9 +70,8 @@ Implementations SHOULD create message event when response size is determined.
7570
7671## Attributes
7772
78- Implementations SHOULD set the following attributes on the client
79- and server spans. For a server, request represents the incoming request.
80- For a client, request represents the outgoing request.
73+ Implementations SHOULD set the following attributes on the client and server spans. For a server,
74+ request represents the incoming request. For a client, request represents the outgoing request.
8175
8276All attributes are optional.
8377
@@ -90,9 +84,8 @@ All attributes are optional.
9084| "http.user_agent" | Request user-agent | "HTTPClient/1.2" |
9185| "http.status_code" | Response status code | 200 |
9286
93- Exporters should always export the collected attributes.
94- Exporters should map the collected attributes to backend's
95- known attributes/labels.
87+ Exporters should always export the collected attributes. Exporters should map the collected
88+ attributes to backend's known attributes/labels.
9689
9790The following table summarizes how OpenCensus attributes maps to the
9891known attributes/labels on supported tracing backends.
0 commit comments