diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a69d25844e..7dfc64cad99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,9 @@ release. - Add attributes for Apache RocketMQ. ([#1904](https://github.com/open-telemetry/opentelemetry-specification/pull/1904)) +- Define http tracing attributes provided at span creation time + ([#1919](https://github.com/open-telemetry/opentelemetry-specification/pull/1916)) + ### Compatibility ### OpenTelemetry Protocol diff --git a/semantic_conventions/trace/http.yaml b/semantic_conventions/trace/http.yaml index 55b81f433ce..20adebca11c 100644 --- a/semantic_conventions/trace/http.yaml +++ b/semantic_conventions/trace/http.yaml @@ -10,6 +10,7 @@ groups: type: string required: always brief: 'HTTP request method.' + sampling_relevant: true examples: ["GET", "POST", "HEAD"] - id: url type: string @@ -19,10 +20,12 @@ groups: note: > `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`. + sampling_relevant: true examples: ['https://www.foo.bar/search?q=OpenTelemetry#SemConv'] - id: target type: string brief: 'The full request target as passed in a HTTP request line or equivalent.' + sampling_relevant: true examples: ['/path/12314/?q=ddds#123'] - id: host type: string @@ -35,10 +38,12 @@ groups: in certain cases, according the aforementioned [section of RFC 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not set the attribute MUST NOT be set. + sampling_relevant: true examples: ['www.example.org'] - id: scheme type: string brief: 'The URI scheme identifying the used protocol.' + sampling_relevant: true examples: ["http", "https"] - id: status_code type: int @@ -99,6 +104,12 @@ groups: brief: > The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. examples: 5493 + - ref: net.peer.name + sampling_relevant: true + - ref: net.peer.ip + sampling_relevant: true + - ref: net.peer.port + sampling_relevant: true constraints: - include: network diff --git a/specification/trace/semantic_conventions/http.md b/specification/trace/semantic_conventions/http.md index b5050a783e8..348ea10044d 100644 --- a/specification/trace/semantic_conventions/http.md +++ b/specification/trace/semantic_conventions/http.md @@ -71,6 +71,9 @@ Don't set the span status description if the reason can be inferred from `http.s | `http.request_content_length_uncompressed` | int | The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used. | `5493` | No | | `http.response_content_length` | int | The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. | `3495` | No | | `http.response_content_length_uncompressed` | int | The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. | `5493` | No | +| [`net.peer.ip`](span-general.md) | string | Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) | `127.0.0.1` | No | +| [`net.peer.name`](span-general.md) | string | Remote hostname or similar, see note below. | `example.com` | No | +| [`net.peer.port`](span-general.md) | int | Remote port number. | `80`; `8080`; `443` | No | **[1]:** `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`. @@ -87,6 +90,17 @@ Don't set the span status description if the reason can be inferred from `http.s | `2.0` | HTTP 2 | | `SPDY` | SPDY protocol. | | `QUIC` | QUIC protocol. | + +Following attributes MUST be provided **at span creation time** (when provided at all): + +* `http.method` +* `http.url` +* `http.target` +* `http.host` +* `http.scheme` +* [`net.peer.ip`](span-general.md) +* [`net.peer.name`](span-general.md) +* [`net.peer.port`](span-general.md) It is recommended to also use the general [network attributes][], especially `net.peer.ip`. If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed.