http_attributes.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. /*
  2. * Copyright The OpenTelemetry Authors
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. /*
  6. * DO NOT EDIT, this is an Auto-generated file from:
  7. * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
  8. */
  9. #pragma once
  10. #include "opentelemetry/common/macros.h"
  11. #include "opentelemetry/version.h"
  12. OPENTELEMETRY_BEGIN_NAMESPACE
  13. namespace semconv
  14. {
  15. namespace http
  16. {
  17. /**
  18. Deprecated, use @code client.address @endcode instead.
  19. @deprecated
  20. {"note": "Replaced by @code client.address @endcode.", "reason": "renamed", "renamed_to":
  21. "client.address"}
  22. */
  23. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpClientIp = "http.client_ip";
  24. /**
  25. State of the HTTP connection in the HTTP connection pool.
  26. */
  27. static constexpr const char *kHttpConnectionState = "http.connection.state";
  28. /**
  29. Deprecated, use @code network.protocol.name @endcode instead.
  30. @deprecated
  31. {"note": "Replaced by @code network.protocol.name @endcode.", "reason": "renamed", "renamed_to":
  32. "network.protocol.name"}
  33. */
  34. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpFlavor = "http.flavor";
  35. /**
  36. Deprecated, use one of @code server.address @endcode, @code client.address @endcode or @code
  37. http.request.header.host @endcode instead, depending on the usage.
  38. @deprecated
  39. {"note": "Replaced by one of @code server.address @endcode, @code client.address @endcode or @code
  40. http.request.header.host @endcode, depending on the usage.\n", "reason": "uncategorized"}
  41. */
  42. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpHost = "http.host";
  43. /**
  44. Deprecated, use @code http.request.method @endcode instead.
  45. @deprecated
  46. {"note": "Replaced by @code http.request.method @endcode.", "reason": "renamed", "renamed_to":
  47. "http.request.method"}
  48. */
  49. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpMethod = "http.method";
  50. /**
  51. The size of the request payload body in bytes. This is the number of bytes transferred excluding
  52. headers and is often, but not always, present as the <a
  53. href="https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length">Content-Length</a> header.
  54. For requests using transport encoding, this should be the compressed size.
  55. */
  56. static constexpr const char *kHttpRequestBodySize = "http.request.body.size";
  57. /**
  58. HTTP request headers, @code <key> @endcode being the normalized HTTP Header name (lowercase), the
  59. value being the header values. <p> Instrumentations SHOULD require an explicit configuration of
  60. which headers are to be captured. Including all request headers can be a security risk - explicit
  61. configuration helps avoid leaking sensitive information. <p> The @code User-Agent @endcode header
  62. is already captured in the @code user_agent.original @endcode attribute. Users MAY explicitly
  63. configure instrumentations to capture them even though it is not recommended. <p> The attribute
  64. value MUST consist of either multiple header values as an array of strings or a single-item array
  65. containing a possibly comma-concatenated string, depending on the way the HTTP library provides
  66. access to headers. <p> Examples: <ul> <li>A header @code Content-Type: application/json @endcode
  67. SHOULD be recorded as the @code http.request.header.content-type @endcode attribute with value
  68. @code ["application/json"] @endcode.</li> <li>A header @code X-Forwarded-For: 1.2.3.4, 1.2.3.5
  69. @endcode SHOULD be recorded as the @code http.request.header.x-forwarded-for @endcode attribute
  70. with value @code ["1.2.3.4", "1.2.3.5"] @endcode or @code ["1.2.3.4, 1.2.3.5"] @endcode depending
  71. on the HTTP library.</li>
  72. </ul>
  73. */
  74. static constexpr const char *kHttpRequestHeader = "http.request.header";
  75. /**
  76. HTTP request method.
  77. <p>
  78. HTTP request method value SHOULD be "known" to the instrumentation.
  79. By default, this convention defines "known" methods as the ones listed in <a
  80. href="https://www.rfc-editor.org/rfc/rfc9110.html#name-methods">RFC9110</a> and the PATCH method
  81. defined in <a href="https://www.rfc-editor.org/rfc/rfc5789.html">RFC5789</a>. <p> If the HTTP
  82. request method is not known to instrumentation, it MUST set the @code http.request.method @endcode
  83. attribute to @code _OTHER @endcode. <p> If the HTTP instrumentation could end up converting valid
  84. HTTP request methods to @code _OTHER @endcode, then it MUST provide a way to override the list of
  85. known HTTP methods. If this override is done via environment variable, then the environment
  86. variable MUST be named OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list
  87. of case-sensitive known HTTP methods (this list MUST be a full override of the default known
  88. method, it is not a list of known methods in addition to the defaults). <p> HTTP method names are
  89. case-sensitive and @code http.request.method @endcode attribute value MUST match a known HTTP
  90. method name exactly. Instrumentations for specific web frameworks that consider HTTP methods to be
  91. case insensitive, SHOULD populate a canonical equivalent. Tracing instrumentations that do so,
  92. MUST also set @code http.request.method_original @endcode to the original value.
  93. */
  94. static constexpr const char *kHttpRequestMethod = "http.request.method";
  95. /**
  96. Original HTTP method sent by the client in the request line.
  97. */
  98. static constexpr const char *kHttpRequestMethodOriginal = "http.request.method_original";
  99. /**
  100. The ordinal number of request resending attempt (for any reason, including redirects).
  101. <p>
  102. The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless
  103. of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server
  104. Unavailable, network issues, or any other).
  105. */
  106. static constexpr const char *kHttpRequestResendCount = "http.request.resend_count";
  107. /**
  108. The total size of the request in bytes. This should be the total number of bytes sent over the
  109. wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request
  110. body if any.
  111. */
  112. static constexpr const char *kHttpRequestSize = "http.request.size";
  113. /**
  114. Deprecated, use @code http.request.header.content-length @endcode instead.
  115. @deprecated
  116. {"note": "Replaced by @code http.request.header.content-length @endcode.", "reason":
  117. "uncategorized"}
  118. */
  119. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpRequestContentLength =
  120. "http.request_content_length";
  121. /**
  122. Deprecated, use @code http.request.body.size @endcode instead.
  123. @deprecated
  124. {"note": "Replaced by @code http.request.body.size @endcode.", "reason": "renamed", "renamed_to":
  125. "http.request.body.size"}
  126. */
  127. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpRequestContentLengthUncompressed =
  128. "http.request_content_length_uncompressed";
  129. /**
  130. The size of the response payload body in bytes. This is the number of bytes transferred excluding
  131. headers and is often, but not always, present as the <a
  132. href="https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length">Content-Length</a> header.
  133. For requests using transport encoding, this should be the compressed size.
  134. */
  135. static constexpr const char *kHttpResponseBodySize = "http.response.body.size";
  136. /**
  137. HTTP response headers, @code <key> @endcode being the normalized HTTP Header name (lowercase), the
  138. value being the header values. <p> Instrumentations SHOULD require an explicit configuration of
  139. which headers are to be captured. Including all response headers can be a security risk - explicit
  140. configuration helps avoid leaking sensitive information. <p> Users MAY explicitly configure
  141. instrumentations to capture them even though it is not recommended. <p> The attribute value MUST
  142. consist of either multiple header values as an array of strings or a single-item array containing
  143. a possibly comma-concatenated string, depending on the way the HTTP library provides access to
  144. headers. <p> Examples: <ul> <li>A header @code Content-Type: application/json @endcode header
  145. SHOULD be recorded as the @code http.request.response.content-type @endcode attribute with value
  146. @code ["application/json"] @endcode.</li> <li>A header @code My-custom-header: abc, def @endcode
  147. header SHOULD be recorded as the @code http.response.header.my-custom-header @endcode attribute
  148. with value @code ["abc", "def"] @endcode or @code ["abc, def"] @endcode depending on the HTTP
  149. library.</li>
  150. </ul>
  151. */
  152. static constexpr const char *kHttpResponseHeader = "http.response.header";
  153. /**
  154. The total size of the response in bytes. This should be the total number of bytes sent over the
  155. wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response
  156. body and trailers if any.
  157. */
  158. static constexpr const char *kHttpResponseSize = "http.response.size";
  159. /**
  160. <a href="https://tools.ietf.org/html/rfc7231#section-6">HTTP response status code</a>.
  161. */
  162. static constexpr const char *kHttpResponseStatusCode = "http.response.status_code";
  163. /**
  164. Deprecated, use @code http.response.header.content-length @endcode instead.
  165. @deprecated
  166. {"note": "hp.response.header.content-length", "reason": "uncategorized"}
  167. */
  168. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpResponseContentLength =
  169. "http.response_content_length";
  170. /**
  171. Deprecated, use @code http.response.body.size @endcode instead.
  172. @deprecated
  173. {"note": "Replaced by @code http.response.body.size @endcode.", "reason": "renamed", "renamed_to":
  174. "http.response.body.size"}
  175. */
  176. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpResponseContentLengthUncompressed =
  177. "http.response_content_length_uncompressed";
  178. /**
  179. The matched route, that is, the path template in the format used by the respective server
  180. framework. <p> MUST NOT be populated when this is not supported by the HTTP server framework as
  181. the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD
  182. include the <a href="/docs/http/http-spans.md#http-server-definitions">application root</a> if
  183. there is one.
  184. */
  185. static constexpr const char *kHttpRoute = "http.route";
  186. /**
  187. Deprecated, use @code url.scheme @endcode instead.
  188. @deprecated
  189. {"note": "Replaced by @code url.scheme @endcode.", "reason": "renamed", "renamed_to":
  190. "url.scheme"}
  191. */
  192. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpScheme = "http.scheme";
  193. /**
  194. Deprecated, use @code server.address @endcode instead.
  195. @deprecated
  196. {"note": "Replaced by @code server.address @endcode.", "reason": "renamed", "renamed_to":
  197. "server.address"}
  198. */
  199. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpServerName = "http.server_name";
  200. /**
  201. Deprecated, use @code http.response.status_code @endcode instead.
  202. @deprecated
  203. {"note": "Replaced by @code http.response.status_code @endcode.", "reason": "renamed",
  204. "renamed_to": "http.response.status_code"}
  205. */
  206. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpStatusCode = "http.status_code";
  207. /**
  208. Deprecated, use @code url.path @endcode and @code url.query @endcode instead.
  209. @deprecated
  210. {"note": "Split to @code url.path @endcode and @code url.query @endcode.", "reason": "obsoleted"}
  211. */
  212. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpTarget = "http.target";
  213. /**
  214. Deprecated, use @code url.full @endcode instead.
  215. @deprecated
  216. {"note": "Replaced by @code url.full @endcode.", "reason": "renamed", "renamed_to": "url.full"}
  217. */
  218. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpUrl = "http.url";
  219. /**
  220. Deprecated, use @code user_agent.original @endcode instead.
  221. @deprecated
  222. {"note": "Replaced by @code user_agent.original @endcode.", "reason": "renamed", "renamed_to":
  223. "user_agent.original"}
  224. */
  225. OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpUserAgent = "http.user_agent";
  226. namespace HttpConnectionStateValues
  227. {
  228. /**
  229. active state.
  230. */
  231. static constexpr const char *kActive = "active";
  232. /**
  233. idle state.
  234. */
  235. static constexpr const char *kIdle = "idle";
  236. } // namespace HttpConnectionStateValues
  237. namespace HttpFlavorValues
  238. {
  239. /**
  240. HTTP/1.0
  241. */
  242. static constexpr const char *kHttp10 = "1.0";
  243. /**
  244. HTTP/1.1
  245. */
  246. static constexpr const char *kHttp11 = "1.1";
  247. /**
  248. HTTP/2
  249. */
  250. static constexpr const char *kHttp20 = "2.0";
  251. /**
  252. HTTP/3
  253. */
  254. static constexpr const char *kHttp30 = "3.0";
  255. /**
  256. SPDY protocol.
  257. */
  258. static constexpr const char *kSpdy = "SPDY";
  259. /**
  260. QUIC protocol.
  261. */
  262. static constexpr const char *kQuic = "QUIC";
  263. } // namespace HttpFlavorValues
  264. namespace HttpRequestMethodValues
  265. {
  266. /**
  267. CONNECT method.
  268. */
  269. static constexpr const char *kConnect = "CONNECT";
  270. /**
  271. DELETE method.
  272. */
  273. static constexpr const char *kDelete = "DELETE";
  274. /**
  275. GET method.
  276. */
  277. static constexpr const char *kGet = "GET";
  278. /**
  279. HEAD method.
  280. */
  281. static constexpr const char *kHead = "HEAD";
  282. /**
  283. OPTIONS method.
  284. */
  285. static constexpr const char *kOptions = "OPTIONS";
  286. /**
  287. PATCH method.
  288. */
  289. static constexpr const char *kPatch = "PATCH";
  290. /**
  291. POST method.
  292. */
  293. static constexpr const char *kPost = "POST";
  294. /**
  295. PUT method.
  296. */
  297. static constexpr const char *kPut = "PUT";
  298. /**
  299. TRACE method.
  300. */
  301. static constexpr const char *kTrace = "TRACE";
  302. /**
  303. Any HTTP method that the instrumentation has no prior knowledge of.
  304. */
  305. static constexpr const char *kOther = "_OTHER";
  306. } // namespace HttpRequestMethodValues
  307. } // namespace http
  308. } // namespace semconv
  309. OPENTELEMETRY_END_NAMESPACE