k8s_attributes.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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 k8s
  16. {
  17. /**
  18. The name of the cluster.
  19. */
  20. static constexpr const char *kK8sClusterName = "k8s.cluster.name";
  21. /**
  22. A pseudo-ID for the cluster, set to the UID of the @code kube-system @endcode namespace.
  23. <p>
  24. K8s doesn't have support for obtaining a cluster ID. If this is ever
  25. added, we will recommend collecting the @code k8s.cluster.uid @endcode through the
  26. official APIs. In the meantime, we are able to use the @code uid @endcode of the
  27. @code kube-system @endcode namespace as a proxy for cluster ID. Read on for the
  28. rationale.
  29. <p>
  30. Every object created in a K8s cluster is assigned a distinct UID. The
  31. @code kube-system @endcode namespace is used by Kubernetes itself and will exist
  32. for the lifetime of the cluster. Using the @code uid @endcode of the @code kube-system @endcode
  33. namespace is a reasonable proxy for the K8s ClusterID as it will only
  34. change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are
  35. UUIDs as standardized by
  36. <a href="https://www.itu.int/ITU-T/studygroups/com17/oid.html">ISO/IEC 9834-8 and ITU-T X.667</a>.
  37. Which states:
  38. <blockquote>
  39. If generated according to one of the mechanisms defined in Rec.
  40. ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be
  41. different from all other UUIDs generated before 3603 A.D., or is
  42. extremely likely to be different (depending on the mechanism chosen).</blockquote>
  43. <p>
  44. Therefore, UIDs between clusters should be extremely unlikely to
  45. conflict.
  46. */
  47. static constexpr const char *kK8sClusterUid = "k8s.cluster.uid";
  48. /**
  49. The name of the Container from Pod specification, must be unique within a Pod. Container runtime
  50. usually uses different globally unique name (@code container.name @endcode).
  51. */
  52. static constexpr const char *kK8sContainerName = "k8s.container.name";
  53. /**
  54. Number of times the container was restarted. This attribute can be used to identify a particular
  55. container (running or stopped) within a container spec.
  56. */
  57. static constexpr const char *kK8sContainerRestartCount = "k8s.container.restart_count";
  58. /**
  59. Last terminated reason of the Container.
  60. */
  61. static constexpr const char *kK8sContainerStatusLastTerminatedReason =
  62. "k8s.container.status.last_terminated_reason";
  63. /**
  64. The cronjob annotation placed on the CronJob, the @code <key> @endcode being the annotation name,
  65. the value being the annotation value. <p> Examples: <ul> <li>An annotation @code retries @endcode
  66. with value @code 4 @endcode SHOULD be recorded as the
  67. @code k8s.cronjob.annotation.retries @endcode attribute with value @code "4" @endcode.</li>
  68. <li>An annotation @code data @endcode with empty string value SHOULD be recorded as
  69. the @code k8s.cronjob.annotation.data @endcode attribute with value @code "" @endcode.</li>
  70. </ul>
  71. */
  72. static constexpr const char *kK8sCronjobAnnotation = "k8s.cronjob.annotation";
  73. /**
  74. The label placed on the CronJob, the @code <key> @endcode being the label name, the value being
  75. the label value. <p> Examples: <ul> <li>A label @code type @endcode with value @code weekly
  76. @endcode SHOULD be recorded as the
  77. @code k8s.cronjob.label.type @endcode attribute with value @code "weekly" @endcode.</li>
  78. <li>A label @code automated @endcode with empty string value SHOULD be recorded as
  79. the @code k8s.cronjob.label.automated @endcode attribute with value @code "" @endcode.</li>
  80. </ul>
  81. */
  82. static constexpr const char *kK8sCronjobLabel = "k8s.cronjob.label";
  83. /**
  84. The name of the CronJob.
  85. */
  86. static constexpr const char *kK8sCronjobName = "k8s.cronjob.name";
  87. /**
  88. The UID of the CronJob.
  89. */
  90. static constexpr const char *kK8sCronjobUid = "k8s.cronjob.uid";
  91. /**
  92. The annotation key-value pairs placed on the DaemonSet.
  93. <p>
  94. The @code <key> @endcode being the annotation name, the value being the annotation value, even if
  95. the value is empty.
  96. */
  97. static constexpr const char *kK8sDaemonsetAnnotation = "k8s.daemonset.annotation";
  98. /**
  99. The label key-value pairs placed on the DaemonSet.
  100. <p>
  101. The @code <key> @endcode being the label name, the value being the label value, even if the value
  102. is empty.
  103. */
  104. static constexpr const char *kK8sDaemonsetLabel = "k8s.daemonset.label";
  105. /**
  106. The name of the DaemonSet.
  107. */
  108. static constexpr const char *kK8sDaemonsetName = "k8s.daemonset.name";
  109. /**
  110. The UID of the DaemonSet.
  111. */
  112. static constexpr const char *kK8sDaemonsetUid = "k8s.daemonset.uid";
  113. /**
  114. The annotation key-value pairs placed on the Deployment.
  115. <p>
  116. The @code <key> @endcode being the annotation name, the value being the annotation value, even if
  117. the value is empty.
  118. */
  119. static constexpr const char *kK8sDeploymentAnnotation = "k8s.deployment.annotation";
  120. /**
  121. The label key-value pairs placed on the Deployment.
  122. <p>
  123. The @code <key> @endcode being the label name, the value being the label value, even if the value
  124. is empty.
  125. */
  126. static constexpr const char *kK8sDeploymentLabel = "k8s.deployment.label";
  127. /**
  128. The name of the Deployment.
  129. */
  130. static constexpr const char *kK8sDeploymentName = "k8s.deployment.name";
  131. /**
  132. The UID of the Deployment.
  133. */
  134. static constexpr const char *kK8sDeploymentUid = "k8s.deployment.uid";
  135. /**
  136. The name of the horizontal pod autoscaler.
  137. */
  138. static constexpr const char *kK8sHpaName = "k8s.hpa.name";
  139. /**
  140. The UID of the horizontal pod autoscaler.
  141. */
  142. static constexpr const char *kK8sHpaUid = "k8s.hpa.uid";
  143. /**
  144. The annotation key-value pairs placed on the Job.
  145. <p>
  146. The @code <key> @endcode being the annotation name, the value being the annotation value, even if
  147. the value is empty.
  148. */
  149. static constexpr const char *kK8sJobAnnotation = "k8s.job.annotation";
  150. /**
  151. The label key-value pairs placed on the Job.
  152. <p>
  153. The @code <key> @endcode being the label name, the value being the label value, even if the value
  154. is empty.
  155. */
  156. static constexpr const char *kK8sJobLabel = "k8s.job.label";
  157. /**
  158. The name of the Job.
  159. */
  160. static constexpr const char *kK8sJobName = "k8s.job.name";
  161. /**
  162. The UID of the Job.
  163. */
  164. static constexpr const char *kK8sJobUid = "k8s.job.uid";
  165. /**
  166. The annotation key-value pairs placed on the Namespace.
  167. <p>
  168. The @code <key> @endcode being the annotation name, the value being the annotation value, even if
  169. the value is empty.
  170. */
  171. static constexpr const char *kK8sNamespaceAnnotation = "k8s.namespace.annotation";
  172. /**
  173. The label key-value pairs placed on the Namespace.
  174. <p>
  175. The @code <key> @endcode being the label name, the value being the label value, even if the value
  176. is empty.
  177. */
  178. static constexpr const char *kK8sNamespaceLabel = "k8s.namespace.label";
  179. /**
  180. The name of the namespace that the pod is running in.
  181. */
  182. static constexpr const char *kK8sNamespaceName = "k8s.namespace.name";
  183. /**
  184. The phase of the K8s namespace.
  185. <p>
  186. This attribute aligns with the @code phase @endcode field of the
  187. <a
  188. href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#namespacestatus-v1-core">K8s
  189. NamespaceStatus</a>
  190. */
  191. static constexpr const char *kK8sNamespacePhase = "k8s.namespace.phase";
  192. /**
  193. The annotation placed on the Node, the @code <key> @endcode being the annotation name, the value
  194. being the annotation value, even if the value is empty. <p> Examples: <ul> <li>An annotation @code
  195. node.alpha.kubernetes.io/ttl @endcode with value @code 0 @endcode SHOULD be recorded as the @code
  196. k8s.node.annotation.node.alpha.kubernetes.io/ttl @endcode attribute with value @code "0"
  197. @endcode.</li> <li>An annotation @code data @endcode with empty string value SHOULD be recorded as
  198. the @code k8s.node.annotation.data @endcode attribute with value @code "" @endcode.</li>
  199. </ul>
  200. */
  201. static constexpr const char *kK8sNodeAnnotation = "k8s.node.annotation";
  202. /**
  203. The label placed on the Node, the @code <key> @endcode being the label name, the value being the
  204. label value, even if the value is empty. <p> Examples: <ul> <li>A label @code kubernetes.io/arch
  205. @endcode with value @code arm64 @endcode SHOULD be recorded as the @code
  206. k8s.node.label.kubernetes.io/arch @endcode attribute with value @code "arm64" @endcode.</li> <li>A
  207. label @code data @endcode with empty string value SHOULD be recorded as the @code
  208. k8s.node.label.data @endcode attribute with value @code "" @endcode.</li>
  209. </ul>
  210. */
  211. static constexpr const char *kK8sNodeLabel = "k8s.node.label";
  212. /**
  213. The name of the Node.
  214. */
  215. static constexpr const char *kK8sNodeName = "k8s.node.name";
  216. /**
  217. The UID of the Node.
  218. */
  219. static constexpr const char *kK8sNodeUid = "k8s.node.uid";
  220. /**
  221. The annotation placed on the Pod, the @code <key> @endcode being the annotation name, the value
  222. being the annotation value. <p> Examples: <ul> <li>An annotation @code
  223. kubernetes.io/enforce-mountable-secrets @endcode with value @code true @endcode SHOULD be recorded
  224. as the @code k8s.pod.annotation.kubernetes.io/enforce-mountable-secrets @endcode attribute with
  225. value @code "true" @endcode.</li> <li>An annotation @code mycompany.io/arch @endcode with value
  226. @code x64 @endcode SHOULD be recorded as the @code k8s.pod.annotation.mycompany.io/arch @endcode
  227. attribute with value @code "x64" @endcode.</li> <li>An annotation @code data @endcode with empty
  228. string value SHOULD be recorded as the @code k8s.pod.annotation.data @endcode attribute with value
  229. @code "" @endcode.</li>
  230. </ul>
  231. */
  232. static constexpr const char *kK8sPodAnnotation = "k8s.pod.annotation";
  233. /**
  234. The label placed on the Pod, the @code <key> @endcode being the label name, the value being the
  235. label value. <p> Examples: <ul> <li>A label @code app @endcode with value @code my-app @endcode
  236. SHOULD be recorded as the @code k8s.pod.label.app @endcode attribute with value @code "my-app"
  237. @endcode.</li> <li>A label @code mycompany.io/arch @endcode with value @code x64 @endcode SHOULD
  238. be recorded as the @code k8s.pod.label.mycompany.io/arch @endcode attribute with value @code "x64"
  239. @endcode.</li> <li>A label @code data @endcode with empty string value SHOULD be recorded as the
  240. @code k8s.pod.label.data @endcode attribute with value @code "" @endcode.</li>
  241. </ul>
  242. */
  243. static constexpr const char *kK8sPodLabel = "k8s.pod.label";
  244. /**
  245. Deprecated, use @code k8s.pod.label @endcode instead.
  246. @deprecated
  247. {"note": "Replaced by @code k8s.pod.label @endcode.", "reason": "renamed", "renamed_to":
  248. "k8s.pod.label"}
  249. */
  250. OPENTELEMETRY_DEPRECATED static constexpr const char *kK8sPodLabels = "k8s.pod.labels";
  251. /**
  252. The name of the Pod.
  253. */
  254. static constexpr const char *kK8sPodName = "k8s.pod.name";
  255. /**
  256. The UID of the Pod.
  257. */
  258. static constexpr const char *kK8sPodUid = "k8s.pod.uid";
  259. /**
  260. The annotation key-value pairs placed on the ReplicaSet.
  261. <p>
  262. The @code <key> @endcode being the annotation name, the value being the annotation value, even if
  263. the value is empty.
  264. */
  265. static constexpr const char *kK8sReplicasetAnnotation = "k8s.replicaset.annotation";
  266. /**
  267. The label key-value pairs placed on the ReplicaSet.
  268. <p>
  269. The @code <key> @endcode being the label name, the value being the label value, even if the value
  270. is empty.
  271. */
  272. static constexpr const char *kK8sReplicasetLabel = "k8s.replicaset.label";
  273. /**
  274. The name of the ReplicaSet.
  275. */
  276. static constexpr const char *kK8sReplicasetName = "k8s.replicaset.name";
  277. /**
  278. The UID of the ReplicaSet.
  279. */
  280. static constexpr const char *kK8sReplicasetUid = "k8s.replicaset.uid";
  281. /**
  282. The name of the replication controller.
  283. */
  284. static constexpr const char *kK8sReplicationcontrollerName = "k8s.replicationcontroller.name";
  285. /**
  286. The UID of the replication controller.
  287. */
  288. static constexpr const char *kK8sReplicationcontrollerUid = "k8s.replicationcontroller.uid";
  289. /**
  290. The name of the resource quota.
  291. */
  292. static constexpr const char *kK8sResourcequotaName = "k8s.resourcequota.name";
  293. /**
  294. The UID of the resource quota.
  295. */
  296. static constexpr const char *kK8sResourcequotaUid = "k8s.resourcequota.uid";
  297. /**
  298. The annotation key-value pairs placed on the StatefulSet.
  299. <p>
  300. The @code <key> @endcode being the annotation name, the value being the annotation value, even if
  301. the value is empty.
  302. */
  303. static constexpr const char *kK8sStatefulsetAnnotation = "k8s.statefulset.annotation";
  304. /**
  305. The label key-value pairs placed on the StatefulSet.
  306. <p>
  307. The @code <key> @endcode being the label name, the value being the label value, even if the value
  308. is empty.
  309. */
  310. static constexpr const char *kK8sStatefulsetLabel = "k8s.statefulset.label";
  311. /**
  312. The name of the StatefulSet.
  313. */
  314. static constexpr const char *kK8sStatefulsetName = "k8s.statefulset.name";
  315. /**
  316. The UID of the StatefulSet.
  317. */
  318. static constexpr const char *kK8sStatefulsetUid = "k8s.statefulset.uid";
  319. /**
  320. The name of the K8s volume.
  321. */
  322. static constexpr const char *kK8sVolumeName = "k8s.volume.name";
  323. /**
  324. The type of the K8s volume.
  325. */
  326. static constexpr const char *kK8sVolumeType = "k8s.volume.type";
  327. namespace K8sNamespacePhaseValues
  328. {
  329. /**
  330. Active namespace phase as described by <a
  331. href="https://pkg.go.dev/k8s.io/[email protected]/core/v1#NamespacePhase">K8s API</a>
  332. */
  333. static constexpr const char *kActive = "active";
  334. /**
  335. Terminating namespace phase as described by <a
  336. href="https://pkg.go.dev/k8s.io/[email protected]/core/v1#NamespacePhase">K8s API</a>
  337. */
  338. static constexpr const char *kTerminating = "terminating";
  339. } // namespace K8sNamespacePhaseValues
  340. namespace K8sVolumeTypeValues
  341. {
  342. /**
  343. A <a
  344. href="https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim">persistentVolumeClaim</a>
  345. volume
  346. */
  347. static constexpr const char *kPersistentVolumeClaim = "persistentVolumeClaim";
  348. /**
  349. A <a
  350. href="https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap">configMap</a>
  351. volume
  352. */
  353. static constexpr const char *kConfigMap = "configMap";
  354. /**
  355. A <a
  356. href="https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi">downwardAPI</a>
  357. volume
  358. */
  359. static constexpr const char *kDownwardApi = "downwardAPI";
  360. /**
  361. An <a href="https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir">emptyDir</a>
  362. volume
  363. */
  364. static constexpr const char *kEmptyDir = "emptyDir";
  365. /**
  366. A <a href="https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret">secret</a>
  367. volume
  368. */
  369. static constexpr const char *kSecret = "secret";
  370. /**
  371. A <a href="https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local">local</a> volume
  372. */
  373. static constexpr const char *kLocal = "local";
  374. } // namespace K8sVolumeTypeValues
  375. } // namespace k8s
  376. } // namespace semconv
  377. OPENTELEMETRY_END_NAMESPACE