Skip to content

Latest commit

 

History

History
318 lines (233 loc) · 21.7 KB

File metadata and controls

318 lines (233 loc) · 21.7 KB

Semantic Conventions for HTTP Metrics

Status: Experimental

The conventions described in this section are HTTP specific. When HTTP operations occur, metric events about those operations will be generated and reported to provide insight into the operations. By adding HTTP attributes to metric events it allows for finely tuned filtering.

Disclaimer: These are initial HTTP metric instruments and attributes but more may be added in the future.

HTTP Server

Metric: http.server.duration

This metric is required.

Name Instrument Type Unit (UCUM) Description
http.server.duration Histogram ms Measures the duration of inbound HTTP requests.
Attribute Type Description Examples Requirement Level
http.scheme string The URI scheme identifying the used protocol. http; https Required
http.route string The matched route (path template in the format used by the respective server framework). See note below [1] /users/:userID?; {controller}/{action}/{id?} Conditionally Required: If and only if it's available
http.method string HTTP request method. GET; POST; HEAD Required
http.status_code int HTTP response status code. 200 Conditionally Required: If and only if one was received/sent.
net.host.name string Name of the local HTTP server that received the request. [2] localhost Required
net.host.port int Port of the local HTTP server that received the request. [3] 8080 Conditionally Required: [4]
net.protocol.name string Application layer protocol used. The value SHOULD be normalized to lowercase. amqp; http; mqtt Recommended
net.protocol.version string Version of the application layer protocol used. See note below. [5] 3.1.1 Recommended

[1]: MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include the application root if there is one.

[2]: Determined by using the first of the following that applies

  • The primary server name of the matched virtual host. MUST only include host identifier.
  • Host identifier of the request target if it's sent in absolute-form.
  • Host identifier of the Host header

SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.

[3]: Determined by using the first of the following that applies

  • Port identifier of the primary server host of the matched virtual host.
  • Port identifier of the request target if it's sent in absolute-form.
  • Port identifier of the Host header

[4]: If not default (80 for http scheme, 443 for https).

[5]: net.protocol.version refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client used has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

Metric: http.server.active_requests

This metric is optional.

Name Instrument Type Unit (UCUM) Description
http.server.active_requests UpDownCounter {request} Measures the number of concurrent HTTP requests that are currently in-flight.
Attribute Type Description Examples Requirement Level
http.method string HTTP request method. GET; POST; HEAD Required
http.scheme string The URI scheme identifying the used protocol. http; https Required
net.host.name string Name of the local HTTP server that received the request. [1] localhost Required
net.host.port int Port of the local HTTP server that received the request. [2] 8080 Conditionally Required: [3]

[1]: Determined by using the first of the following that applies

  • The primary server name of the matched virtual host. MUST only include host identifier.
  • Host identifier of the request target if it's sent in absolute-form.
  • Host identifier of the Host header

SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.

[2]: Determined by using the first of the following that applies

  • Port identifier of the primary server host of the matched virtual host.
  • Port identifier of the request target if it's sent in absolute-form.
  • Port identifier of the Host header

[3]: If not default (80 for http scheme, 443 for https).

Metric: http.server.request.size

This metric is optional.

Name Instrument Type Unit (UCUM) Description
http.server.request.size Histogram By Measures the size of HTTP request messages (compressed).
Attribute Type Description Examples Requirement Level
http.scheme string The URI scheme identifying the used protocol. http; https Required
http.route string The matched route (path template in the format used by the respective server framework). See note below [1] /users/:userID?; {controller}/{action}/{id?} Conditionally Required: If and only if it's available
http.method string HTTP request method. GET; POST; HEAD Required
http.status_code int HTTP response status code. 200 Conditionally Required: If and only if one was received/sent.
net.host.name string Name of the local HTTP server that received the request. [2] localhost Required
net.host.port int Port of the local HTTP server that received the request. [3] 8080 Conditionally Required: [4]
net.protocol.name string Application layer protocol used. The value SHOULD be normalized to lowercase. amqp; http; mqtt Recommended
net.protocol.version string Version of the application layer protocol used. See note below. [5] 3.1.1 Recommended

[1]: MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include the application root if there is one.

[2]: Determined by using the first of the following that applies

  • The primary server name of the matched virtual host. MUST only include host identifier.
  • Host identifier of the request target if it's sent in absolute-form.
  • Host identifier of the Host header

SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.

[3]: Determined by using the first of the following that applies

  • Port identifier of the primary server host of the matched virtual host.
  • Port identifier of the request target if it's sent in absolute-form.
  • Port identifier of the Host header

[4]: If not default (80 for http scheme, 443 for https).

[5]: net.protocol.version refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client used has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

Metric: http.server.response.size

This metric is optional.

Name Instrument Type Unit (UCUM) Description
http.server.response.size Histogram By Measures the size of HTTP response messages (compressed).
Attribute Type Description Examples Requirement Level
http.scheme string The URI scheme identifying the used protocol. http; https Required
http.route string The matched route (path template in the format used by the respective server framework). See note below [1] /users/:userID?; {controller}/{action}/{id?} Conditionally Required: If and only if it's available
http.method string HTTP request method. GET; POST; HEAD Required
http.status_code int HTTP response status code. 200 Conditionally Required: If and only if one was received/sent.
net.host.name string Name of the local HTTP server that received the request. [2] localhost Required
net.host.port int Port of the local HTTP server that received the request. [3] 8080 Conditionally Required: [4]
net.protocol.name string Application layer protocol used. The value SHOULD be normalized to lowercase. amqp; http; mqtt Recommended
net.protocol.version string Version of the application layer protocol used. See note below. [5] 3.1.1 Recommended

[1]: MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include the application root if there is one.

[2]: Determined by using the first of the following that applies

  • The primary server name of the matched virtual host. MUST only include host identifier.
  • Host identifier of the request target if it's sent in absolute-form.
  • Host identifier of the Host header

SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.

[3]: Determined by using the first of the following that applies

  • Port identifier of the primary server host of the matched virtual host.
  • Port identifier of the request target if it's sent in absolute-form.
  • Port identifier of the Host header

[4]: If not default (80 for http scheme, 443 for https).

[5]: net.protocol.version refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client used has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

HTTP Client

Metric: http.client.duration

This metric is required.

Name Instrument Type Unit (UCUM) Description
http.client.duration Histogram ms Measures the duration of outbound HTTP requests.
Attribute Type Description Examples Requirement Level
http.method string HTTP request method. GET; POST; HEAD Required
http.status_code int HTTP response status code. 200 Conditionally Required: If and only if one was received/sent.
net.peer.name string Host identifier of the "URI origin" HTTP request is sent to. [1] example.com Required
net.peer.port int Port identifier of the "URI origin" HTTP request is sent to. [2] 80; 8080; 443 Conditionally Required: [3]
net.protocol.name string Application layer protocol used. The value SHOULD be normalized to lowercase. amqp; http; mqtt Recommended
net.protocol.version string Version of the application layer protocol used. See note below. [4] 3.1.1 Recommended
net.sock.peer.addr string Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, etc. 127.0.0.1; /tmp/mysql.sock Recommended

[1]: Determined by using the first of the following that applies

  • Host identifier of the request target if it's sent in absolute-form
  • Host identifier of the Host header

SHOULD NOT be set if capturing it would require an extra DNS lookup.

[2]: When request target is absolute URI, net.peer.name MUST match URI port identifier, otherwise it MUST match Host header port identifier.

[3]: If not default (80 for http scheme, 443 for https).

[4]: net.protocol.version refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client used has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

Metric: http.client.request.size

This metric is optional.

Name Instrument Type Unit (UCUM) Description
http.client.request.size Histogram By Measures the size of HTTP request messages (compressed).
Attribute Type Description Examples Requirement Level
http.method string HTTP request method. GET; POST; HEAD Required
http.status_code int HTTP response status code. 200 Conditionally Required: If and only if one was received/sent.
net.peer.name string Host identifier of the "URI origin" HTTP request is sent to. [1] example.com Required
net.peer.port int Port identifier of the "URI origin" HTTP request is sent to. [2] 80; 8080; 443 Conditionally Required: [3]
net.protocol.name string Application layer protocol used. The value SHOULD be normalized to lowercase. amqp; http; mqtt Recommended
net.protocol.version string Version of the application layer protocol used. See note below. [4] 3.1.1 Recommended
net.sock.peer.addr string Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, etc. 127.0.0.1; /tmp/mysql.sock Recommended

[1]: Determined by using the first of the following that applies

  • Host identifier of the request target if it's sent in absolute-form
  • Host identifier of the Host header

SHOULD NOT be set if capturing it would require an extra DNS lookup.

[2]: When request target is absolute URI, net.peer.name MUST match URI port identifier, otherwise it MUST match Host header port identifier.

[3]: If not default (80 for http scheme, 443 for https).

[4]: net.protocol.version refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client used has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

Metric: http.client.response.size

This metric is optional.

Name Instrument Type Unit (UCUM) Description
http.client.response.size Histogram By Measures the size of HTTP response messages (compressed).
Attribute Type Description Examples Requirement Level
http.method string HTTP request method. GET; POST; HEAD Required
http.status_code int HTTP response status code. 200 Conditionally Required: If and only if one was received/sent.
net.peer.name string Host identifier of the "URI origin" HTTP request is sent to. [1] example.com Required
net.peer.port int Port identifier of the "URI origin" HTTP request is sent to. [2] 80; 8080; 443 Conditionally Required: [3]
net.protocol.name string Application layer protocol used. The value SHOULD be normalized to lowercase. amqp; http; mqtt Recommended
net.protocol.version string Version of the application layer protocol used. See note below. [4] 3.1.1 Recommended
net.sock.peer.addr string Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, etc. 127.0.0.1; /tmp/mysql.sock Recommended

[1]: Determined by using the first of the following that applies

  • Host identifier of the request target if it's sent in absolute-form
  • Host identifier of the Host header

SHOULD NOT be set if capturing it would require an extra DNS lookup.

[2]: When request target is absolute URI, net.peer.name MUST match URI port identifier, otherwise it MUST match Host header port identifier.

[3]: If not default (80 for http scheme, 443 for https).

[4]: net.protocol.version refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client used has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.