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.

Metric Instruments

The following metric instruments MUST be used to describe HTTP operations. They MUST be of the specified type and units.

HTTP Server

Below is a table of HTTP server metric instruments.

NameInstrument Type (*)UnitUnit (UCUM)Description
http.server.durationHistogrammillisecondsmsmeasures the duration inbound HTTP requests
http.server.request.sizeHistogrambytesBymeasures the size of HTTP request messages (compressed)
http.server.response.sizeHistogrambytesBymeasures the size of HTTP response messages (compressed)
http.server.active_requestsUpDownCounterrequests{requests}measures the number of concurrent HTTP requests that are currently in-flight

HTTP Client

Below is a table of HTTP client metric instruments.

NameInstrument Type (*)UnitUnit (UCUM)Description
http.client.durationHistogrammillisecondsmsmeasures the duration outbound HTTP requests
http.client.request.sizeHistogrambytesBymeasures the size of HTTP request messages (compressed)
http.client.response.sizeHistogrambytesBymeasures the size of HTTP response messages (compressed)

Attributes

Below is a table of the attributes that SHOULD be included on duration and size metric events and whether they should be on server, client, or both types of HTTP metric events:

NameTypeRequirement LevelNotes and examples
http.methodclient & serverRequiredThe HTTP request method. E.g. "GET"
http.schemeserverRequiredThe URI scheme identifying the used protocol in lowercase: "http" or "https"
http.routeserverConditionally Required: If and only if it’s availableThe matched route (path template in the format used by the respective server framework). See note below [1]. E.g. "/path/{id}/?q={}".
http.status_codeclient & serverConditionally Required: if and only if one was received/sent.HTTP response status code. E.g. 200 (String)
http.flavorclient & serverRecommendedKind of HTTP protocol used: "1.0", "1.1", "2", "SPDY" or "QUIC".
net.peer.nameclientRequiredHost identifier of the “URI origin” HTTP request is sent to.
net.peer.portclientConditionally Required: If not default (80 for http, 443 for https).Port identifier of the “URI origin” HTTP request is sent to.
net.sock.peer.addrclientRecommendedSee general network connection attributes
net.host.nameserverRequiredHost of the local HTTP server that received the request.
net.host.portserverConditionally Required: If not default (80 for http, 443 for https).Port of the local HTTP server that received the request.

[1]: ‘http.route’ 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.

The following attributes SHOULD be included in the http.server.active_requests observation:

NameRequirement LevelNotes and examples
http.methodRequiredThe HTTP request method. E.g. "GET"
http.schemeRequiredThe URI scheme identifying the used protocol in lowercase: "http" or "https"
http.flavorRecommendedKind of HTTP protocol used: "1.0", "1.1", "2", "SPDY" or "QUIC"
net.host.nameRequiredHost component of the “origin” server HTTP request is sent to.