diff --git a/specification/trace/semantic_conventions/span-general.md b/specification/trace/semantic_conventions/span-general.md index 618b725a63b..d50a13f6bd4 100644 --- a/specification/trace/semantic_conventions/span-general.md +++ b/specification/trace/semantic_conventions/span-general.md @@ -25,32 +25,32 @@ while the `net.host.*` properties describe the local end. In an ideal situation, not accounting for proxies, multiple IP addresses or host names, the `net.peer.*` properties of a client are equal to the `net.host.*` properties of the server and vice versa. -| Attribute name | Notes and examples | -| :--------------- | :-------------------------------------------------------------------------------- | -| `net.transport` | Transport protocol used. See [note below](#net.transport). | -| `net.peer.ip` | Remote address of the peer (dotted decimal for IPv4 or [RFC5952][] for IPv6) | -| `net.peer.port` | Remote port number as an integer. E.g., `80`. | -| `net.peer.name` | Remote hostname or similar, see [note below](#net.name). | -| `net.host.ip` | Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. | -| `net.host.port` | Like `net.peer.port` but for the host port. | -| `net.host.name` | Local hostname or similar, see [note below](#net.name). | - -[RFC5952]: https://tools.ietf.org/html/rfc5952 - - - -### `net.transport` attribute - -This attribute should be set to the name of the transport layer protocol (or the relevant protocol below the "application protocol"). One of these strings should be used: - -* `IP.TCP` -* `IP.UDP` -* `IP`: Another IP-based protocol. -* `Unix`: Unix Domain socket. See note below. -* `pipe`: Named or anonymous pipe. See note below. -* `inproc`: Signals that there is only in-process communication not using a "real" network protocol in cases where network attributes would normally be expected. Usually all other network attributes can be left out in that case. -* `other`: Something else (not IP-based). - + +| Attribute | Type | Description | Example | Required | +|---|---|---|---|---| +| `net.transport` | string enum | Transport protocol used. See note below. | `IP.TCP` | No | +| `net.peer.ip` | 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.port` | number | Remote port number. | `80`
`8080`
`443` | No | +| `net.peer.name` | string | Remote hostname or similar, see note below. | `example.com` | No | +| `net.host.ip` | string | Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. | `192.168.0.1` | No | +| `net.host.port` | number | Like `net.peer.port` but for the host port. | `35555` | No | +| `net.host.name` | string | Local hostname or similar, see note below. | `localhost` | No | + +`net.transport` MUST be one of the following: + +| Value | Description | +|---|---| +| `IP.TCP` | IP.TCP | +| `IP.UDP` | IP.UDP | +| `IP` | Another IP-based protocol | +| `Unix` | Unix Domain socket. See below. | +| `pipe` | Named or anonymous pipe. See note below. | +| `inproc` | In-process communication. [1] | +| `other` | Something else (non IP-based). | + +**[1]:** Signals that there is only in-process communication not using a "real" network protocol in cases where network attributes would normally be expected. Usually all other network attributes can be left out in that case. + + For `Unix` and `pipe`, since the connection goes over the file system instead of being directly to a known peer, `net.peer.name` is the only attribute that usually makes sense (see description of `net.peer.name` below). diff --git a/yaml/span_attribute/faas.yaml b/yaml/span_attribute/faas.yaml deleted file mode 100644 index 14fb9270b31..00000000000 --- a/yaml/span_attribute/faas.yaml +++ /dev/null @@ -1,108 +0,0 @@ -groups: - - id: faas - prefix: faas - brief: > - This document defines how to describe an instance of a function that - runs without provisioning or managing of servers (also known as - serverless) with spans. - attributes: - - id: trigger - required: always - sampling_relevant: true - brief: 'Type of the trigger on which the function is executed.' - type: - allow_custom_values: false - members: - - id: datasource - value: 'datasource' - brief: 'A response to some data source operation such as a database or filesystem read/write.' - - id: http - value: 'http' - brief: 'To provide an answer to an inbound HTTP request' - - id: pubsub - value: 'pubsub' - brief: 'A function is set to be executed when messages are sent to a messaging system.' - - id: timer - value: 'timer' - brief: 'A function is scheduled to be executed regularly.' - - id: other - value: 'other' - - id: execution - type: string - brief: "The execution id of the current function execution." - examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' - - id: faas.datasource - prefix: faas.document - extends: faas - brief: > - Semantic Convention for FaaS triggered as a response to some data - source operation such as a database or filesystem read/write. - attributes: - - id: collection - type: string - required: always - brief: 'The name of the source on which the triggering operation was performed.' - note: > - For example, in Cloud Storage or S3 corresponds to the bucket name, - and in Cosmos DB to the database name. - examples: ['myBucketName', 'myDbName'] - - id: operation - required: always - type: - allow_custom_values: true - members: - - id: insert - value: 'insert' - - id: edit - value: 'edit' - - id: delete - value: 'delete' - brief: 'Describes the type of the operation that was performed on the data.' - - id: time - type: string - required: always - brief: > - A string containing the time when the data was accessed in the - [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) - format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - examples: "2020-01-23T13:47:06Z" - - id: name - type: string - brief: 'The document name/table subjected to the operation.' - note: > - For example, in Cloud Storage or S3 is the name of - the file, and in Cosmos DB the table name. - examples: ["myFile.txt", "myTableName"] - - id: faas.http - extends: faas - brief: > - Semantic Convention for FaaS triggered as a response to some data - source operation such as a database or filesystem read/write. - constraints: - - include: http.server - - id: faas.pubsub - extends: faas - brief: > - Semantic Convention for FaaS set to be executed when messages are - sent to a messaging system. - constraints: - - include: messaging - - id: faas.timer - extends: faas - brief: > - Semantic Convention for FaaS scheduled to be executed regularly. - attributes: - - id: time - type: string - required: always - brief: > - A string containing the function invocation time in the - [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) - format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - examples: "2020-01-23T13:47:06Z" - - id: cron - type: string - brief: > - A string containing the schedule period as - [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). - examples: "0/5 * * * ? *" diff --git a/yaml/span_attribute/rpc.yaml b/yaml/span_attribute/rpc.yaml deleted file mode 100644 index 2c7d2e7fcb2..00000000000 --- a/yaml/span_attribute/rpc.yaml +++ /dev/null @@ -1,30 +0,0 @@ -groups: - - id: rpc - prefix: 'rpc' - brief: 'This document defines semantic conventions for remote procedure calls.' - attributes: - - id: service - type: string - required: always - sampling_relevant: true - brief: 'The service name, must be equal to the $service part in the span name.' - examples: "EchoService" - constraints: - - any_of: - - net.peer.ip - - net.peer.name - - id: grpc.client - extends: rpc - span_kind: client - brief: 'Outgoing gRPC request.' - attributes: - - ref: net.peer.port - required: always - brief: 'It describes the server port the client is connecting to' - - id: grpc.server - extends: rpc - span_kind: server - brief: 'Incoming gRPC request.' - attributes: - - ref: net.peer.port - brief: 'It describes the port the client is connecting from' diff --git a/yaml/span_attribute/general.yaml b/yaml/trace/general.yaml similarity index 98% rename from yaml/span_attribute/general.yaml rename to yaml/trace/general.yaml index b3f61ce73e4..0ba91a50077 100644 --- a/yaml/span_attribute/general.yaml +++ b/yaml/trace/general.yaml @@ -81,4 +81,4 @@ groups: Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an OAuth 2.0 Access Token or an attribute value in a SAML 2.0 Assertion. - examples: 'read:message, write:files' + examples: 'read:message, write:files' \ No newline at end of file diff --git a/yaml/trace/http.yaml b/yaml/trace/http.yaml new file mode 100644 index 00000000000..a275e29fb65 --- /dev/null +++ b/yaml/trace/http.yaml @@ -0,0 +1,150 @@ +groups: + - id: http + prefix: http + brief: 'This document defines semantic conventions for HTTP client and server Spans.' + note: > + These conventions can be used for http and https schemes + and various HTTP versions like 1.1, 2 and SPDY. + attributes: + - id: method + type: string + required: always + sampling_relevant: false + brief: 'HTTP request method.' + examples: ["GET", "POST", "HEAD"] + - id: url + type: string + brief: > + Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. + 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.' + examples: ['/path/12314/?q=ddds#123'] + - id: host + type: string + brief: > + The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). + When the header is empty or not present, this attribute should be the same. + examples: ['www.example.org'] + - id: scheme + type: string + brief: 'The URI scheme identifying the used protocol.' + examples: ["http", "https"] + - id: status_code + type: number + required: + conditional: If and only if one was received/sent. + brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).' + examples: [200] + - id: status_text + type: string + brief: '[HTTP reason phrase](https://tools.ietf.org/html/rfc7230#section-3.1.2).' + examples: ['OK'] + - id: flavor + type: + # Default value: `true`. If false, it helps the code gen tool to + # encode checks that only accept the listed values. + allow_custom_values: true + members: + - id: HTTP_1_0 + value: '1.0' + brief: 'HTTP 1.0' + - id: HTTP_1_1 + value: '1.1' + brief: 'HTTP 1.1' + - id: HTTP_2_0 + value: '2.0' + brief: 'HTTP 2' + - id: SPDY + value: 'SPDY' + brief: 'SPDY protocol.' + - id: QUIC + value: 'QUIC' + brief: 'QUIC protocol.' + brief: 'Kind of HTTP protocol used' + note: > + 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. + examples: ['1.0'] + - id: user_agent + type: string + brief: 'Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client.' + examples: ['CERN-LineMode/2.15 libwww/2.17b3'] + - id: request_content_length + type: number + brief: > + The size of the request 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. + examples: 3495 + - id: request_content_length_uncompressed + type: number + brief: > + The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used. + examples: 5493 + - id: response_content_length + type: number + brief: > + 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. + examples: 3495 + - id: response_content_length_uncompressed + type: number + brief: > + The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. + examples: 5493 + constraints: + - include: network + + - id: http.client + prefix: http + extends: http + span_kind: client + brief: 'Semantic Convention for HTTP Client' + constraints: + - any_of: + - [http.url] + - [http.scheme, http.host, http.target] + - [http.scheme, net.peer.name, net.peer.port, http.target] + - [http.scheme, net.peer.ip, net.peer.port, http.target] + + - id: http.server + prefix: http + extends: http + span_kind: server + brief: 'Semantic Convention for HTTP Server' + attributes: + - id: server_name + type: string + sampling_relevant: false + brief: > + The primary server name of the matched virtual host. This should be obtained via configuration. + If no such configuration can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead). + note: > + http.url is usually not readily available on the server side but would have to be assembled in a cumbersome and + sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). + It is thus preferred to supply the raw data that is available. + examples: ['example.com'] + - id: route + type: string + brief: > + The matched route (path template). + examples: '/users/:userID?' + - id: client_ip + type: string + sampling_relevant: false + brief: > + The IP address of the original client behind all proxies, if + known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + note: > + This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. + examples: '83.164.160.102' + constraints: + - any_of: + - [http.url] + - [http.scheme, http.host, http.target] + - [http.scheme, http.server_name, net.host.port, http.target] + - [http.scheme, net.host.name, net.host.port, http.target] \ No newline at end of file