system_metrics.h 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339
  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_metrics-h.j2
  8. */
  9. #pragma once
  10. #include "opentelemetry/common/macros.h"
  11. #include "opentelemetry/metrics/meter.h"
  12. #include "opentelemetry/version.h"
  13. OPENTELEMETRY_BEGIN_NAMESPACE
  14. namespace semconv
  15. {
  16. namespace system
  17. {
  18. /**
  19. * Deprecated. Use @code cpu.frequency @endcode instead.
  20. *
  21. * @deprecated
  22. * {"note": "Replaced by @code cpu.frequency @endcode.", "reason": "uncategorized"}
  23. * <p>
  24. * gauge
  25. */
  26. OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricSystemCpuFrequency =
  27. "system.cpu.frequency";
  28. OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricSystemCpuFrequency =
  29. "Deprecated. Use `cpu.frequency` instead.";
  30. OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricSystemCpuFrequency = "{Hz}";
  31. #if OPENTELEMETRY_ABI_VERSION_NO >= 2
  32. OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr<metrics::Gauge<int64_t>>
  33. CreateSyncInt64MetricSystemCpuFrequency(metrics::Meter *meter)
  34. {
  35. return meter->CreateInt64Gauge(kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency,
  36. unitMetricSystemCpuFrequency);
  37. }
  38. OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr<metrics::Gauge<double>>
  39. CreateSyncDoubleMetricSystemCpuFrequency(metrics::Meter *meter)
  40. {
  41. return meter->CreateDoubleGauge(kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency,
  42. unitMetricSystemCpuFrequency);
  43. }
  44. #endif /* OPENTELEMETRY_ABI_VERSION_NO */
  45. OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr<metrics::ObservableInstrument>
  46. CreateAsyncInt64MetricSystemCpuFrequency(metrics::Meter *meter)
  47. {
  48. return meter->CreateInt64ObservableGauge(kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency,
  49. unitMetricSystemCpuFrequency);
  50. }
  51. OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr<metrics::ObservableInstrument>
  52. CreateAsyncDoubleMetricSystemCpuFrequency(metrics::Meter *meter)
  53. {
  54. return meter->CreateDoubleObservableGauge(
  55. kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency, unitMetricSystemCpuFrequency);
  56. }
  57. /**
  58. * Reports the number of logical (virtual) processor cores created by the operating system to manage
  59. * multitasking <p> Calculated by multiplying the number of sockets by the number of cores per
  60. * socket, and then by the number of threads per core <p> updowncounter
  61. */
  62. static constexpr const char *kMetricSystemCpuLogicalCount = "system.cpu.logical.count";
  63. static constexpr const char *descrMetricSystemCpuLogicalCount =
  64. "Reports the number of logical (virtual) processor cores created by the operating system to "
  65. "manage multitasking";
  66. static constexpr const char *unitMetricSystemCpuLogicalCount = "{cpu}";
  67. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  68. CreateSyncInt64MetricSystemCpuLogicalCount(metrics::Meter *meter)
  69. {
  70. return meter->CreateInt64UpDownCounter(kMetricSystemCpuLogicalCount,
  71. descrMetricSystemCpuLogicalCount,
  72. unitMetricSystemCpuLogicalCount);
  73. }
  74. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  75. CreateSyncDoubleMetricSystemCpuLogicalCount(metrics::Meter *meter)
  76. {
  77. return meter->CreateDoubleUpDownCounter(kMetricSystemCpuLogicalCount,
  78. descrMetricSystemCpuLogicalCount,
  79. unitMetricSystemCpuLogicalCount);
  80. }
  81. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  82. CreateAsyncInt64MetricSystemCpuLogicalCount(metrics::Meter *meter)
  83. {
  84. return meter->CreateInt64ObservableUpDownCounter(kMetricSystemCpuLogicalCount,
  85. descrMetricSystemCpuLogicalCount,
  86. unitMetricSystemCpuLogicalCount);
  87. }
  88. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  89. CreateAsyncDoubleMetricSystemCpuLogicalCount(metrics::Meter *meter)
  90. {
  91. return meter->CreateDoubleObservableUpDownCounter(kMetricSystemCpuLogicalCount,
  92. descrMetricSystemCpuLogicalCount,
  93. unitMetricSystemCpuLogicalCount);
  94. }
  95. /**
  96. * Reports the number of actual physical processor cores on the hardware
  97. * <p>
  98. * Calculated by multiplying the number of sockets by the number of cores per socket
  99. * <p>
  100. * updowncounter
  101. */
  102. static constexpr const char *kMetricSystemCpuPhysicalCount = "system.cpu.physical.count";
  103. static constexpr const char *descrMetricSystemCpuPhysicalCount =
  104. "Reports the number of actual physical processor cores on the hardware";
  105. static constexpr const char *unitMetricSystemCpuPhysicalCount = "{cpu}";
  106. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  107. CreateSyncInt64MetricSystemCpuPhysicalCount(metrics::Meter *meter)
  108. {
  109. return meter->CreateInt64UpDownCounter(kMetricSystemCpuPhysicalCount,
  110. descrMetricSystemCpuPhysicalCount,
  111. unitMetricSystemCpuPhysicalCount);
  112. }
  113. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  114. CreateSyncDoubleMetricSystemCpuPhysicalCount(metrics::Meter *meter)
  115. {
  116. return meter->CreateDoubleUpDownCounter(kMetricSystemCpuPhysicalCount,
  117. descrMetricSystemCpuPhysicalCount,
  118. unitMetricSystemCpuPhysicalCount);
  119. }
  120. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  121. CreateAsyncInt64MetricSystemCpuPhysicalCount(metrics::Meter *meter)
  122. {
  123. return meter->CreateInt64ObservableUpDownCounter(kMetricSystemCpuPhysicalCount,
  124. descrMetricSystemCpuPhysicalCount,
  125. unitMetricSystemCpuPhysicalCount);
  126. }
  127. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  128. CreateAsyncDoubleMetricSystemCpuPhysicalCount(metrics::Meter *meter)
  129. {
  130. return meter->CreateDoubleObservableUpDownCounter(kMetricSystemCpuPhysicalCount,
  131. descrMetricSystemCpuPhysicalCount,
  132. unitMetricSystemCpuPhysicalCount);
  133. }
  134. /**
  135. * Deprecated. Use @code cpu.time @endcode instead.
  136. *
  137. * @deprecated
  138. * {"note": "Replaced by @code cpu.time @endcode.", "reason": "uncategorized"}
  139. * <p>
  140. * counter
  141. */
  142. OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricSystemCpuTime = "system.cpu.time";
  143. OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricSystemCpuTime =
  144. "Deprecated. Use `cpu.time` instead.";
  145. OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricSystemCpuTime = "s";
  146. OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
  147. CreateSyncInt64MetricSystemCpuTime(metrics::Meter *meter)
  148. {
  149. return meter->CreateUInt64Counter(kMetricSystemCpuTime, descrMetricSystemCpuTime,
  150. unitMetricSystemCpuTime);
  151. }
  152. OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr<metrics::Counter<double>>
  153. CreateSyncDoubleMetricSystemCpuTime(metrics::Meter *meter)
  154. {
  155. return meter->CreateDoubleCounter(kMetricSystemCpuTime, descrMetricSystemCpuTime,
  156. unitMetricSystemCpuTime);
  157. }
  158. OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr<metrics::ObservableInstrument>
  159. CreateAsyncInt64MetricSystemCpuTime(metrics::Meter *meter)
  160. {
  161. return meter->CreateInt64ObservableCounter(kMetricSystemCpuTime, descrMetricSystemCpuTime,
  162. unitMetricSystemCpuTime);
  163. }
  164. OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr<metrics::ObservableInstrument>
  165. CreateAsyncDoubleMetricSystemCpuTime(metrics::Meter *meter)
  166. {
  167. return meter->CreateDoubleObservableCounter(kMetricSystemCpuTime, descrMetricSystemCpuTime,
  168. unitMetricSystemCpuTime);
  169. }
  170. /**
  171. * Deprecated. Use @code cpu.utilization @endcode instead.
  172. *
  173. * @deprecated
  174. * {"note": "Replaced by @code cpu.utilization @endcode.", "reason": "uncategorized"}
  175. * <p>
  176. * gauge
  177. */
  178. OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricSystemCpuUtilization =
  179. "system.cpu.utilization";
  180. OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricSystemCpuUtilization =
  181. "Deprecated. Use `cpu.utilization` instead.";
  182. OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricSystemCpuUtilization = "1";
  183. #if OPENTELEMETRY_ABI_VERSION_NO >= 2
  184. OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr<metrics::Gauge<int64_t>>
  185. CreateSyncInt64MetricSystemCpuUtilization(metrics::Meter *meter)
  186. {
  187. return meter->CreateInt64Gauge(kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization,
  188. unitMetricSystemCpuUtilization);
  189. }
  190. OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr<metrics::Gauge<double>>
  191. CreateSyncDoubleMetricSystemCpuUtilization(metrics::Meter *meter)
  192. {
  193. return meter->CreateDoubleGauge(kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization,
  194. unitMetricSystemCpuUtilization);
  195. }
  196. #endif /* OPENTELEMETRY_ABI_VERSION_NO */
  197. OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr<metrics::ObservableInstrument>
  198. CreateAsyncInt64MetricSystemCpuUtilization(metrics::Meter *meter)
  199. {
  200. return meter->CreateInt64ObservableGauge(
  201. kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization, unitMetricSystemCpuUtilization);
  202. }
  203. OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr<metrics::ObservableInstrument>
  204. CreateAsyncDoubleMetricSystemCpuUtilization(metrics::Meter *meter)
  205. {
  206. return meter->CreateDoubleObservableGauge(
  207. kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization, unitMetricSystemCpuUtilization);
  208. }
  209. /**
  210. * counter
  211. */
  212. static constexpr const char *kMetricSystemDiskIo = "system.disk.io";
  213. static constexpr const char *descrMetricSystemDiskIo = "";
  214. static constexpr const char *unitMetricSystemDiskIo = "By";
  215. static inline nostd::unique_ptr<metrics::Counter<uint64_t>> CreateSyncInt64MetricSystemDiskIo(
  216. metrics::Meter *meter)
  217. {
  218. return meter->CreateUInt64Counter(kMetricSystemDiskIo, descrMetricSystemDiskIo,
  219. unitMetricSystemDiskIo);
  220. }
  221. static inline nostd::unique_ptr<metrics::Counter<double>> CreateSyncDoubleMetricSystemDiskIo(
  222. metrics::Meter *meter)
  223. {
  224. return meter->CreateDoubleCounter(kMetricSystemDiskIo, descrMetricSystemDiskIo,
  225. unitMetricSystemDiskIo);
  226. }
  227. static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncInt64MetricSystemDiskIo(
  228. metrics::Meter *meter)
  229. {
  230. return meter->CreateInt64ObservableCounter(kMetricSystemDiskIo, descrMetricSystemDiskIo,
  231. unitMetricSystemDiskIo);
  232. }
  233. static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncDoubleMetricSystemDiskIo(
  234. metrics::Meter *meter)
  235. {
  236. return meter->CreateDoubleObservableCounter(kMetricSystemDiskIo, descrMetricSystemDiskIo,
  237. unitMetricSystemDiskIo);
  238. }
  239. /**
  240. * Time disk spent activated
  241. * <p>
  242. * The real elapsed time ("wall clock") used in the I/O path (time from operations running in
  243. * parallel are not counted). Measured as: <ul> <li>Linux: Field 13 from <a
  244. * href="https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats">procfs-diskstats</a></li>
  245. * <li>Windows: The complement of
  246. * <a
  247. * href="https://learn.microsoft.com/archive/blogs/askcore/windows-performance-monitor-disk-counters-explained#windows-performance-monitor-disk-counters-explained">"Disk%
  248. * Idle Time"</a> performance counter: @code uptime * (100 - "Disk\% Idle Time") / 100 @endcode</li>
  249. * </ul>
  250. * <p>
  251. * counter
  252. */
  253. static constexpr const char *kMetricSystemDiskIoTime = "system.disk.io_time";
  254. static constexpr const char *descrMetricSystemDiskIoTime = "Time disk spent activated";
  255. static constexpr const char *unitMetricSystemDiskIoTime = "s";
  256. static inline nostd::unique_ptr<metrics::Counter<uint64_t>> CreateSyncInt64MetricSystemDiskIoTime(
  257. metrics::Meter *meter)
  258. {
  259. return meter->CreateUInt64Counter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime,
  260. unitMetricSystemDiskIoTime);
  261. }
  262. static inline nostd::unique_ptr<metrics::Counter<double>> CreateSyncDoubleMetricSystemDiskIoTime(
  263. metrics::Meter *meter)
  264. {
  265. return meter->CreateDoubleCounter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime,
  266. unitMetricSystemDiskIoTime);
  267. }
  268. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  269. CreateAsyncInt64MetricSystemDiskIoTime(metrics::Meter *meter)
  270. {
  271. return meter->CreateInt64ObservableCounter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime,
  272. unitMetricSystemDiskIoTime);
  273. }
  274. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  275. CreateAsyncDoubleMetricSystemDiskIoTime(metrics::Meter *meter)
  276. {
  277. return meter->CreateDoubleObservableCounter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime,
  278. unitMetricSystemDiskIoTime);
  279. }
  280. /**
  281. * The total storage capacity of the disk
  282. * <p>
  283. * updowncounter
  284. */
  285. static constexpr const char *kMetricSystemDiskLimit = "system.disk.limit";
  286. static constexpr const char *descrMetricSystemDiskLimit = "The total storage capacity of the disk";
  287. static constexpr const char *unitMetricSystemDiskLimit = "By";
  288. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  289. CreateSyncInt64MetricSystemDiskLimit(metrics::Meter *meter)
  290. {
  291. return meter->CreateInt64UpDownCounter(kMetricSystemDiskLimit, descrMetricSystemDiskLimit,
  292. unitMetricSystemDiskLimit);
  293. }
  294. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  295. CreateSyncDoubleMetricSystemDiskLimit(metrics::Meter *meter)
  296. {
  297. return meter->CreateDoubleUpDownCounter(kMetricSystemDiskLimit, descrMetricSystemDiskLimit,
  298. unitMetricSystemDiskLimit);
  299. }
  300. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  301. CreateAsyncInt64MetricSystemDiskLimit(metrics::Meter *meter)
  302. {
  303. return meter->CreateInt64ObservableUpDownCounter(
  304. kMetricSystemDiskLimit, descrMetricSystemDiskLimit, unitMetricSystemDiskLimit);
  305. }
  306. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  307. CreateAsyncDoubleMetricSystemDiskLimit(metrics::Meter *meter)
  308. {
  309. return meter->CreateDoubleObservableUpDownCounter(
  310. kMetricSystemDiskLimit, descrMetricSystemDiskLimit, unitMetricSystemDiskLimit);
  311. }
  312. /**
  313. * counter
  314. */
  315. static constexpr const char *kMetricSystemDiskMerged = "system.disk.merged";
  316. static constexpr const char *descrMetricSystemDiskMerged = "";
  317. static constexpr const char *unitMetricSystemDiskMerged = "{operation}";
  318. static inline nostd::unique_ptr<metrics::Counter<uint64_t>> CreateSyncInt64MetricSystemDiskMerged(
  319. metrics::Meter *meter)
  320. {
  321. return meter->CreateUInt64Counter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged,
  322. unitMetricSystemDiskMerged);
  323. }
  324. static inline nostd::unique_ptr<metrics::Counter<double>> CreateSyncDoubleMetricSystemDiskMerged(
  325. metrics::Meter *meter)
  326. {
  327. return meter->CreateDoubleCounter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged,
  328. unitMetricSystemDiskMerged);
  329. }
  330. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  331. CreateAsyncInt64MetricSystemDiskMerged(metrics::Meter *meter)
  332. {
  333. return meter->CreateInt64ObservableCounter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged,
  334. unitMetricSystemDiskMerged);
  335. }
  336. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  337. CreateAsyncDoubleMetricSystemDiskMerged(metrics::Meter *meter)
  338. {
  339. return meter->CreateDoubleObservableCounter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged,
  340. unitMetricSystemDiskMerged);
  341. }
  342. /**
  343. * Sum of the time each operation took to complete
  344. * <p>
  345. * Because it is the sum of time each request took, parallel-issued requests each contribute to make
  346. * the count grow. Measured as: <ul> <li>Linux: Fields 7 & 11 from <a
  347. * href="https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats">procfs-diskstats</a></li>
  348. * <li>Windows: "Avg. Disk sec/Read" perf counter multiplied by "Disk Reads/sec" perf counter
  349. * (similar for Writes)</li>
  350. * </ul>
  351. * <p>
  352. * counter
  353. */
  354. static constexpr const char *kMetricSystemDiskOperationTime = "system.disk.operation_time";
  355. static constexpr const char *descrMetricSystemDiskOperationTime =
  356. "Sum of the time each operation took to complete";
  357. static constexpr const char *unitMetricSystemDiskOperationTime = "s";
  358. static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
  359. CreateSyncInt64MetricSystemDiskOperationTime(metrics::Meter *meter)
  360. {
  361. return meter->CreateUInt64Counter(kMetricSystemDiskOperationTime,
  362. descrMetricSystemDiskOperationTime,
  363. unitMetricSystemDiskOperationTime);
  364. }
  365. static inline nostd::unique_ptr<metrics::Counter<double>>
  366. CreateSyncDoubleMetricSystemDiskOperationTime(metrics::Meter *meter)
  367. {
  368. return meter->CreateDoubleCounter(kMetricSystemDiskOperationTime,
  369. descrMetricSystemDiskOperationTime,
  370. unitMetricSystemDiskOperationTime);
  371. }
  372. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  373. CreateAsyncInt64MetricSystemDiskOperationTime(metrics::Meter *meter)
  374. {
  375. return meter->CreateInt64ObservableCounter(kMetricSystemDiskOperationTime,
  376. descrMetricSystemDiskOperationTime,
  377. unitMetricSystemDiskOperationTime);
  378. }
  379. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  380. CreateAsyncDoubleMetricSystemDiskOperationTime(metrics::Meter *meter)
  381. {
  382. return meter->CreateDoubleObservableCounter(kMetricSystemDiskOperationTime,
  383. descrMetricSystemDiskOperationTime,
  384. unitMetricSystemDiskOperationTime);
  385. }
  386. /**
  387. * counter
  388. */
  389. static constexpr const char *kMetricSystemDiskOperations = "system.disk.operations";
  390. static constexpr const char *descrMetricSystemDiskOperations = "";
  391. static constexpr const char *unitMetricSystemDiskOperations = "{operation}";
  392. static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
  393. CreateSyncInt64MetricSystemDiskOperations(metrics::Meter *meter)
  394. {
  395. return meter->CreateUInt64Counter(kMetricSystemDiskOperations, descrMetricSystemDiskOperations,
  396. unitMetricSystemDiskOperations);
  397. }
  398. static inline nostd::unique_ptr<metrics::Counter<double>>
  399. CreateSyncDoubleMetricSystemDiskOperations(metrics::Meter *meter)
  400. {
  401. return meter->CreateDoubleCounter(kMetricSystemDiskOperations, descrMetricSystemDiskOperations,
  402. unitMetricSystemDiskOperations);
  403. }
  404. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  405. CreateAsyncInt64MetricSystemDiskOperations(metrics::Meter *meter)
  406. {
  407. return meter->CreateInt64ObservableCounter(
  408. kMetricSystemDiskOperations, descrMetricSystemDiskOperations, unitMetricSystemDiskOperations);
  409. }
  410. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  411. CreateAsyncDoubleMetricSystemDiskOperations(metrics::Meter *meter)
  412. {
  413. return meter->CreateDoubleObservableCounter(
  414. kMetricSystemDiskOperations, descrMetricSystemDiskOperations, unitMetricSystemDiskOperations);
  415. }
  416. /**
  417. * The total storage capacity of the filesystem
  418. * <p>
  419. * updowncounter
  420. */
  421. static constexpr const char *kMetricSystemFilesystemLimit = "system.filesystem.limit";
  422. static constexpr const char *descrMetricSystemFilesystemLimit =
  423. "The total storage capacity of the filesystem";
  424. static constexpr const char *unitMetricSystemFilesystemLimit = "By";
  425. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  426. CreateSyncInt64MetricSystemFilesystemLimit(metrics::Meter *meter)
  427. {
  428. return meter->CreateInt64UpDownCounter(kMetricSystemFilesystemLimit,
  429. descrMetricSystemFilesystemLimit,
  430. unitMetricSystemFilesystemLimit);
  431. }
  432. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  433. CreateSyncDoubleMetricSystemFilesystemLimit(metrics::Meter *meter)
  434. {
  435. return meter->CreateDoubleUpDownCounter(kMetricSystemFilesystemLimit,
  436. descrMetricSystemFilesystemLimit,
  437. unitMetricSystemFilesystemLimit);
  438. }
  439. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  440. CreateAsyncInt64MetricSystemFilesystemLimit(metrics::Meter *meter)
  441. {
  442. return meter->CreateInt64ObservableUpDownCounter(kMetricSystemFilesystemLimit,
  443. descrMetricSystemFilesystemLimit,
  444. unitMetricSystemFilesystemLimit);
  445. }
  446. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  447. CreateAsyncDoubleMetricSystemFilesystemLimit(metrics::Meter *meter)
  448. {
  449. return meter->CreateDoubleObservableUpDownCounter(kMetricSystemFilesystemLimit,
  450. descrMetricSystemFilesystemLimit,
  451. unitMetricSystemFilesystemLimit);
  452. }
  453. /**
  454. * Reports a filesystem's space usage across different states.
  455. * <p>
  456. * The sum of all @code system.filesystem.usage @endcode values over the different @code
  457. * system.filesystem.state @endcode attributes SHOULD equal the total storage capacity of the
  458. * filesystem, that is @code system.filesystem.limit @endcode. <p> updowncounter
  459. */
  460. static constexpr const char *kMetricSystemFilesystemUsage = "system.filesystem.usage";
  461. static constexpr const char *descrMetricSystemFilesystemUsage =
  462. "Reports a filesystem's space usage across different states.";
  463. static constexpr const char *unitMetricSystemFilesystemUsage = "By";
  464. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  465. CreateSyncInt64MetricSystemFilesystemUsage(metrics::Meter *meter)
  466. {
  467. return meter->CreateInt64UpDownCounter(kMetricSystemFilesystemUsage,
  468. descrMetricSystemFilesystemUsage,
  469. unitMetricSystemFilesystemUsage);
  470. }
  471. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  472. CreateSyncDoubleMetricSystemFilesystemUsage(metrics::Meter *meter)
  473. {
  474. return meter->CreateDoubleUpDownCounter(kMetricSystemFilesystemUsage,
  475. descrMetricSystemFilesystemUsage,
  476. unitMetricSystemFilesystemUsage);
  477. }
  478. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  479. CreateAsyncInt64MetricSystemFilesystemUsage(metrics::Meter *meter)
  480. {
  481. return meter->CreateInt64ObservableUpDownCounter(kMetricSystemFilesystemUsage,
  482. descrMetricSystemFilesystemUsage,
  483. unitMetricSystemFilesystemUsage);
  484. }
  485. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  486. CreateAsyncDoubleMetricSystemFilesystemUsage(metrics::Meter *meter)
  487. {
  488. return meter->CreateDoubleObservableUpDownCounter(kMetricSystemFilesystemUsage,
  489. descrMetricSystemFilesystemUsage,
  490. unitMetricSystemFilesystemUsage);
  491. }
  492. /**
  493. * gauge
  494. */
  495. static constexpr const char *kMetricSystemFilesystemUtilization = "system.filesystem.utilization";
  496. static constexpr const char *descrMetricSystemFilesystemUtilization = "";
  497. static constexpr const char *unitMetricSystemFilesystemUtilization = "1";
  498. #if OPENTELEMETRY_ABI_VERSION_NO >= 2
  499. static inline nostd::unique_ptr<metrics::Gauge<int64_t>>
  500. CreateSyncInt64MetricSystemFilesystemUtilization(metrics::Meter *meter)
  501. {
  502. return meter->CreateInt64Gauge(kMetricSystemFilesystemUtilization,
  503. descrMetricSystemFilesystemUtilization,
  504. unitMetricSystemFilesystemUtilization);
  505. }
  506. static inline nostd::unique_ptr<metrics::Gauge<double>>
  507. CreateSyncDoubleMetricSystemFilesystemUtilization(metrics::Meter *meter)
  508. {
  509. return meter->CreateDoubleGauge(kMetricSystemFilesystemUtilization,
  510. descrMetricSystemFilesystemUtilization,
  511. unitMetricSystemFilesystemUtilization);
  512. }
  513. #endif /* OPENTELEMETRY_ABI_VERSION_NO */
  514. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  515. CreateAsyncInt64MetricSystemFilesystemUtilization(metrics::Meter *meter)
  516. {
  517. return meter->CreateInt64ObservableGauge(kMetricSystemFilesystemUtilization,
  518. descrMetricSystemFilesystemUtilization,
  519. unitMetricSystemFilesystemUtilization);
  520. }
  521. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  522. CreateAsyncDoubleMetricSystemFilesystemUtilization(metrics::Meter *meter)
  523. {
  524. return meter->CreateDoubleObservableGauge(kMetricSystemFilesystemUtilization,
  525. descrMetricSystemFilesystemUtilization,
  526. unitMetricSystemFilesystemUtilization);
  527. }
  528. /**
  529. * An estimate of how much memory is available for starting new applications, without causing
  530. * swapping <p> This is an alternative to @code system.memory.usage @endcode metric with @code
  531. * state=free @endcode. Linux starting from 3.14 exports "available" memory. It takes "free" memory
  532. * as a baseline, and then factors in kernel-specific values. This is supposed to be more accurate
  533. * than just "free" memory. For reference, see the calculations <a
  534. * href="https://superuser.com/a/980821">here</a>. See also @code MemAvailable @endcode in <a
  535. * href="https://man7.org/linux/man-pages/man5/proc.5.html">/proc/meminfo</a>. <p> updowncounter
  536. */
  537. static constexpr const char *kMetricSystemLinuxMemoryAvailable = "system.linux.memory.available";
  538. static constexpr const char *descrMetricSystemLinuxMemoryAvailable =
  539. "An estimate of how much memory is available for starting new applications, without causing "
  540. "swapping";
  541. static constexpr const char *unitMetricSystemLinuxMemoryAvailable = "By";
  542. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  543. CreateSyncInt64MetricSystemLinuxMemoryAvailable(metrics::Meter *meter)
  544. {
  545. return meter->CreateInt64UpDownCounter(kMetricSystemLinuxMemoryAvailable,
  546. descrMetricSystemLinuxMemoryAvailable,
  547. unitMetricSystemLinuxMemoryAvailable);
  548. }
  549. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  550. CreateSyncDoubleMetricSystemLinuxMemoryAvailable(metrics::Meter *meter)
  551. {
  552. return meter->CreateDoubleUpDownCounter(kMetricSystemLinuxMemoryAvailable,
  553. descrMetricSystemLinuxMemoryAvailable,
  554. unitMetricSystemLinuxMemoryAvailable);
  555. }
  556. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  557. CreateAsyncInt64MetricSystemLinuxMemoryAvailable(metrics::Meter *meter)
  558. {
  559. return meter->CreateInt64ObservableUpDownCounter(kMetricSystemLinuxMemoryAvailable,
  560. descrMetricSystemLinuxMemoryAvailable,
  561. unitMetricSystemLinuxMemoryAvailable);
  562. }
  563. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  564. CreateAsyncDoubleMetricSystemLinuxMemoryAvailable(metrics::Meter *meter)
  565. {
  566. return meter->CreateDoubleObservableUpDownCounter(kMetricSystemLinuxMemoryAvailable,
  567. descrMetricSystemLinuxMemoryAvailable,
  568. unitMetricSystemLinuxMemoryAvailable);
  569. }
  570. /**
  571. * Reports the memory used by the Linux kernel for managing caches of frequently used objects.
  572. * <p>
  573. * The sum over the @code reclaimable @endcode and @code unreclaimable @endcode state values in
  574. * @code linux.memory.slab.usage @endcode SHOULD be equal to the total slab memory available on the
  575. * system. Note that the total slab memory is not constant and may vary over time. See also the <a
  576. * href="https://blogs.oracle.com/linux/post/understanding-linux-kernel-memory-statistics">Slab
  577. * allocator</a> and @code Slab @endcode in <a
  578. * href="https://man7.org/linux/man-pages/man5/proc.5.html">/proc/meminfo</a>. <p> updowncounter
  579. */
  580. static constexpr const char *kMetricSystemLinuxMemorySlabUsage = "system.linux.memory.slab.usage";
  581. static constexpr const char *descrMetricSystemLinuxMemorySlabUsage =
  582. "Reports the memory used by the Linux kernel for managing caches of frequently used objects.";
  583. static constexpr const char *unitMetricSystemLinuxMemorySlabUsage = "By";
  584. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  585. CreateSyncInt64MetricSystemLinuxMemorySlabUsage(metrics::Meter *meter)
  586. {
  587. return meter->CreateInt64UpDownCounter(kMetricSystemLinuxMemorySlabUsage,
  588. descrMetricSystemLinuxMemorySlabUsage,
  589. unitMetricSystemLinuxMemorySlabUsage);
  590. }
  591. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  592. CreateSyncDoubleMetricSystemLinuxMemorySlabUsage(metrics::Meter *meter)
  593. {
  594. return meter->CreateDoubleUpDownCounter(kMetricSystemLinuxMemorySlabUsage,
  595. descrMetricSystemLinuxMemorySlabUsage,
  596. unitMetricSystemLinuxMemorySlabUsage);
  597. }
  598. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  599. CreateAsyncInt64MetricSystemLinuxMemorySlabUsage(metrics::Meter *meter)
  600. {
  601. return meter->CreateInt64ObservableUpDownCounter(kMetricSystemLinuxMemorySlabUsage,
  602. descrMetricSystemLinuxMemorySlabUsage,
  603. unitMetricSystemLinuxMemorySlabUsage);
  604. }
  605. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  606. CreateAsyncDoubleMetricSystemLinuxMemorySlabUsage(metrics::Meter *meter)
  607. {
  608. return meter->CreateDoubleObservableUpDownCounter(kMetricSystemLinuxMemorySlabUsage,
  609. descrMetricSystemLinuxMemorySlabUsage,
  610. unitMetricSystemLinuxMemorySlabUsage);
  611. }
  612. /**
  613. * Total memory available in the system.
  614. * <p>
  615. * Its value SHOULD equal the sum of @code system.memory.state @endcode over all states.
  616. * <p>
  617. * updowncounter
  618. */
  619. static constexpr const char *kMetricSystemMemoryLimit = "system.memory.limit";
  620. static constexpr const char *descrMetricSystemMemoryLimit = "Total memory available in the system.";
  621. static constexpr const char *unitMetricSystemMemoryLimit = "By";
  622. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  623. CreateSyncInt64MetricSystemMemoryLimit(metrics::Meter *meter)
  624. {
  625. return meter->CreateInt64UpDownCounter(kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit,
  626. unitMetricSystemMemoryLimit);
  627. }
  628. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  629. CreateSyncDoubleMetricSystemMemoryLimit(metrics::Meter *meter)
  630. {
  631. return meter->CreateDoubleUpDownCounter(kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit,
  632. unitMetricSystemMemoryLimit);
  633. }
  634. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  635. CreateAsyncInt64MetricSystemMemoryLimit(metrics::Meter *meter)
  636. {
  637. return meter->CreateInt64ObservableUpDownCounter(
  638. kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit, unitMetricSystemMemoryLimit);
  639. }
  640. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  641. CreateAsyncDoubleMetricSystemMemoryLimit(metrics::Meter *meter)
  642. {
  643. return meter->CreateDoubleObservableUpDownCounter(
  644. kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit, unitMetricSystemMemoryLimit);
  645. }
  646. /**
  647. * Shared memory used (mostly by tmpfs).
  648. * <p>
  649. * Equivalent of @code shared @endcode from <a
  650. * href="https://man7.org/linux/man-pages/man1/free.1.html">@code free @endcode command</a> or
  651. * @code Shmem @endcode from <a href="https://man7.org/linux/man-pages/man5/proc.5.html">@code
  652. * /proc/meminfo @endcode</a>" <p> updowncounter
  653. */
  654. static constexpr const char *kMetricSystemMemoryShared = "system.memory.shared";
  655. static constexpr const char *descrMetricSystemMemoryShared =
  656. "Shared memory used (mostly by tmpfs).";
  657. static constexpr const char *unitMetricSystemMemoryShared = "By";
  658. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  659. CreateSyncInt64MetricSystemMemoryShared(metrics::Meter *meter)
  660. {
  661. return meter->CreateInt64UpDownCounter(kMetricSystemMemoryShared, descrMetricSystemMemoryShared,
  662. unitMetricSystemMemoryShared);
  663. }
  664. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  665. CreateSyncDoubleMetricSystemMemoryShared(metrics::Meter *meter)
  666. {
  667. return meter->CreateDoubleUpDownCounter(kMetricSystemMemoryShared, descrMetricSystemMemoryShared,
  668. unitMetricSystemMemoryShared);
  669. }
  670. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  671. CreateAsyncInt64MetricSystemMemoryShared(metrics::Meter *meter)
  672. {
  673. return meter->CreateInt64ObservableUpDownCounter(
  674. kMetricSystemMemoryShared, descrMetricSystemMemoryShared, unitMetricSystemMemoryShared);
  675. }
  676. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  677. CreateAsyncDoubleMetricSystemMemoryShared(metrics::Meter *meter)
  678. {
  679. return meter->CreateDoubleObservableUpDownCounter(
  680. kMetricSystemMemoryShared, descrMetricSystemMemoryShared, unitMetricSystemMemoryShared);
  681. }
  682. /**
  683. * Reports memory in use by state.
  684. * <p>
  685. * The sum over all @code system.memory.state @endcode values SHOULD equal the total memory
  686. * available on the system, that is @code system.memory.limit @endcode.
  687. * <p>
  688. * updowncounter
  689. */
  690. static constexpr const char *kMetricSystemMemoryUsage = "system.memory.usage";
  691. static constexpr const char *descrMetricSystemMemoryUsage = "Reports memory in use by state.";
  692. static constexpr const char *unitMetricSystemMemoryUsage = "By";
  693. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  694. CreateSyncInt64MetricSystemMemoryUsage(metrics::Meter *meter)
  695. {
  696. return meter->CreateInt64UpDownCounter(kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage,
  697. unitMetricSystemMemoryUsage);
  698. }
  699. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  700. CreateSyncDoubleMetricSystemMemoryUsage(metrics::Meter *meter)
  701. {
  702. return meter->CreateDoubleUpDownCounter(kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage,
  703. unitMetricSystemMemoryUsage);
  704. }
  705. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  706. CreateAsyncInt64MetricSystemMemoryUsage(metrics::Meter *meter)
  707. {
  708. return meter->CreateInt64ObservableUpDownCounter(
  709. kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage, unitMetricSystemMemoryUsage);
  710. }
  711. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  712. CreateAsyncDoubleMetricSystemMemoryUsage(metrics::Meter *meter)
  713. {
  714. return meter->CreateDoubleObservableUpDownCounter(
  715. kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage, unitMetricSystemMemoryUsage);
  716. }
  717. /**
  718. * gauge
  719. */
  720. static constexpr const char *kMetricSystemMemoryUtilization = "system.memory.utilization";
  721. static constexpr const char *descrMetricSystemMemoryUtilization = "";
  722. static constexpr const char *unitMetricSystemMemoryUtilization = "1";
  723. #if OPENTELEMETRY_ABI_VERSION_NO >= 2
  724. static inline nostd::unique_ptr<metrics::Gauge<int64_t>>
  725. CreateSyncInt64MetricSystemMemoryUtilization(metrics::Meter *meter)
  726. {
  727. return meter->CreateInt64Gauge(kMetricSystemMemoryUtilization, descrMetricSystemMemoryUtilization,
  728. unitMetricSystemMemoryUtilization);
  729. }
  730. static inline nostd::unique_ptr<metrics::Gauge<double>>
  731. CreateSyncDoubleMetricSystemMemoryUtilization(metrics::Meter *meter)
  732. {
  733. return meter->CreateDoubleGauge(kMetricSystemMemoryUtilization,
  734. descrMetricSystemMemoryUtilization,
  735. unitMetricSystemMemoryUtilization);
  736. }
  737. #endif /* OPENTELEMETRY_ABI_VERSION_NO */
  738. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  739. CreateAsyncInt64MetricSystemMemoryUtilization(metrics::Meter *meter)
  740. {
  741. return meter->CreateInt64ObservableGauge(kMetricSystemMemoryUtilization,
  742. descrMetricSystemMemoryUtilization,
  743. unitMetricSystemMemoryUtilization);
  744. }
  745. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  746. CreateAsyncDoubleMetricSystemMemoryUtilization(metrics::Meter *meter)
  747. {
  748. return meter->CreateDoubleObservableGauge(kMetricSystemMemoryUtilization,
  749. descrMetricSystemMemoryUtilization,
  750. unitMetricSystemMemoryUtilization);
  751. }
  752. /**
  753. * updowncounter
  754. */
  755. static constexpr const char *kMetricSystemNetworkConnections = "system.network.connections";
  756. static constexpr const char *descrMetricSystemNetworkConnections = "";
  757. static constexpr const char *unitMetricSystemNetworkConnections = "{connection}";
  758. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  759. CreateSyncInt64MetricSystemNetworkConnections(metrics::Meter *meter)
  760. {
  761. return meter->CreateInt64UpDownCounter(kMetricSystemNetworkConnections,
  762. descrMetricSystemNetworkConnections,
  763. unitMetricSystemNetworkConnections);
  764. }
  765. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  766. CreateSyncDoubleMetricSystemNetworkConnections(metrics::Meter *meter)
  767. {
  768. return meter->CreateDoubleUpDownCounter(kMetricSystemNetworkConnections,
  769. descrMetricSystemNetworkConnections,
  770. unitMetricSystemNetworkConnections);
  771. }
  772. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  773. CreateAsyncInt64MetricSystemNetworkConnections(metrics::Meter *meter)
  774. {
  775. return meter->CreateInt64ObservableUpDownCounter(kMetricSystemNetworkConnections,
  776. descrMetricSystemNetworkConnections,
  777. unitMetricSystemNetworkConnections);
  778. }
  779. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  780. CreateAsyncDoubleMetricSystemNetworkConnections(metrics::Meter *meter)
  781. {
  782. return meter->CreateDoubleObservableUpDownCounter(kMetricSystemNetworkConnections,
  783. descrMetricSystemNetworkConnections,
  784. unitMetricSystemNetworkConnections);
  785. }
  786. /**
  787. * Count of packets that are dropped or discarded even though there was no error
  788. * <p>
  789. * Measured as:
  790. * <ul>
  791. * <li>Linux: the @code drop @endcode column in @code /proc/dev/net @endcode (<a
  792. * href="https://web.archive.org/web/20180321091318/http://www.onlamp.com/pub/a/linux/2000/11/16/LinuxAdmin.html">source</a>)</li>
  793. * <li>Windows: <a
  794. * href="https://docs.microsoft.com/windows/win32/api/netioapi/ns-netioapi-mib_if_row2">@code
  795. * InDiscards @endcode/@code OutDiscards @endcode</a> from <a
  796. * href="https://docs.microsoft.com/windows/win32/api/netioapi/nf-netioapi-getifentry2">@code
  797. * GetIfEntry2 @endcode</a></li>
  798. * </ul>
  799. * <p>
  800. * counter
  801. */
  802. static constexpr const char *kMetricSystemNetworkDropped = "system.network.dropped";
  803. static constexpr const char *descrMetricSystemNetworkDropped =
  804. "Count of packets that are dropped or discarded even though there was no error";
  805. static constexpr const char *unitMetricSystemNetworkDropped = "{packet}";
  806. static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
  807. CreateSyncInt64MetricSystemNetworkDropped(metrics::Meter *meter)
  808. {
  809. return meter->CreateUInt64Counter(kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped,
  810. unitMetricSystemNetworkDropped);
  811. }
  812. static inline nostd::unique_ptr<metrics::Counter<double>>
  813. CreateSyncDoubleMetricSystemNetworkDropped(metrics::Meter *meter)
  814. {
  815. return meter->CreateDoubleCounter(kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped,
  816. unitMetricSystemNetworkDropped);
  817. }
  818. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  819. CreateAsyncInt64MetricSystemNetworkDropped(metrics::Meter *meter)
  820. {
  821. return meter->CreateInt64ObservableCounter(
  822. kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, unitMetricSystemNetworkDropped);
  823. }
  824. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  825. CreateAsyncDoubleMetricSystemNetworkDropped(metrics::Meter *meter)
  826. {
  827. return meter->CreateDoubleObservableCounter(
  828. kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, unitMetricSystemNetworkDropped);
  829. }
  830. /**
  831. * Count of network errors detected
  832. * <p>
  833. * Measured as:
  834. * <ul>
  835. * <li>Linux: the @code errs @endcode column in @code /proc/dev/net @endcode (<a
  836. * href="https://web.archive.org/web/20180321091318/http://www.onlamp.com/pub/a/linux/2000/11/16/LinuxAdmin.html">source</a>).</li>
  837. * <li>Windows: <a
  838. * href="https://docs.microsoft.com/windows/win32/api/netioapi/ns-netioapi-mib_if_row2">@code
  839. * InErrors @endcode/@code OutErrors @endcode</a> from <a
  840. * href="https://docs.microsoft.com/windows/win32/api/netioapi/nf-netioapi-getifentry2">@code
  841. * GetIfEntry2 @endcode</a>.</li>
  842. * </ul>
  843. * <p>
  844. * counter
  845. */
  846. static constexpr const char *kMetricSystemNetworkErrors = "system.network.errors";
  847. static constexpr const char *descrMetricSystemNetworkErrors = "Count of network errors detected";
  848. static constexpr const char *unitMetricSystemNetworkErrors = "{error}";
  849. static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
  850. CreateSyncInt64MetricSystemNetworkErrors(metrics::Meter *meter)
  851. {
  852. return meter->CreateUInt64Counter(kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors,
  853. unitMetricSystemNetworkErrors);
  854. }
  855. static inline nostd::unique_ptr<metrics::Counter<double>> CreateSyncDoubleMetricSystemNetworkErrors(
  856. metrics::Meter *meter)
  857. {
  858. return meter->CreateDoubleCounter(kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors,
  859. unitMetricSystemNetworkErrors);
  860. }
  861. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  862. CreateAsyncInt64MetricSystemNetworkErrors(metrics::Meter *meter)
  863. {
  864. return meter->CreateInt64ObservableCounter(
  865. kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors, unitMetricSystemNetworkErrors);
  866. }
  867. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  868. CreateAsyncDoubleMetricSystemNetworkErrors(metrics::Meter *meter)
  869. {
  870. return meter->CreateDoubleObservableCounter(
  871. kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors, unitMetricSystemNetworkErrors);
  872. }
  873. /**
  874. * counter
  875. */
  876. static constexpr const char *kMetricSystemNetworkIo = "system.network.io";
  877. static constexpr const char *descrMetricSystemNetworkIo = "";
  878. static constexpr const char *unitMetricSystemNetworkIo = "By";
  879. static inline nostd::unique_ptr<metrics::Counter<uint64_t>> CreateSyncInt64MetricSystemNetworkIo(
  880. metrics::Meter *meter)
  881. {
  882. return meter->CreateUInt64Counter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo,
  883. unitMetricSystemNetworkIo);
  884. }
  885. static inline nostd::unique_ptr<metrics::Counter<double>> CreateSyncDoubleMetricSystemNetworkIo(
  886. metrics::Meter *meter)
  887. {
  888. return meter->CreateDoubleCounter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo,
  889. unitMetricSystemNetworkIo);
  890. }
  891. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  892. CreateAsyncInt64MetricSystemNetworkIo(metrics::Meter *meter)
  893. {
  894. return meter->CreateInt64ObservableCounter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo,
  895. unitMetricSystemNetworkIo);
  896. }
  897. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  898. CreateAsyncDoubleMetricSystemNetworkIo(metrics::Meter *meter)
  899. {
  900. return meter->CreateDoubleObservableCounter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo,
  901. unitMetricSystemNetworkIo);
  902. }
  903. /**
  904. * counter
  905. */
  906. static constexpr const char *kMetricSystemNetworkPackets = "system.network.packets";
  907. static constexpr const char *descrMetricSystemNetworkPackets = "";
  908. static constexpr const char *unitMetricSystemNetworkPackets = "{packet}";
  909. static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
  910. CreateSyncInt64MetricSystemNetworkPackets(metrics::Meter *meter)
  911. {
  912. return meter->CreateUInt64Counter(kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets,
  913. unitMetricSystemNetworkPackets);
  914. }
  915. static inline nostd::unique_ptr<metrics::Counter<double>>
  916. CreateSyncDoubleMetricSystemNetworkPackets(metrics::Meter *meter)
  917. {
  918. return meter->CreateDoubleCounter(kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets,
  919. unitMetricSystemNetworkPackets);
  920. }
  921. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  922. CreateAsyncInt64MetricSystemNetworkPackets(metrics::Meter *meter)
  923. {
  924. return meter->CreateInt64ObservableCounter(
  925. kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, unitMetricSystemNetworkPackets);
  926. }
  927. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  928. CreateAsyncDoubleMetricSystemNetworkPackets(metrics::Meter *meter)
  929. {
  930. return meter->CreateDoubleObservableCounter(
  931. kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, unitMetricSystemNetworkPackets);
  932. }
  933. /**
  934. * counter
  935. */
  936. static constexpr const char *kMetricSystemPagingFaults = "system.paging.faults";
  937. static constexpr const char *descrMetricSystemPagingFaults = "";
  938. static constexpr const char *unitMetricSystemPagingFaults = "{fault}";
  939. static inline nostd::unique_ptr<metrics::Counter<uint64_t>> CreateSyncInt64MetricSystemPagingFaults(
  940. metrics::Meter *meter)
  941. {
  942. return meter->CreateUInt64Counter(kMetricSystemPagingFaults, descrMetricSystemPagingFaults,
  943. unitMetricSystemPagingFaults);
  944. }
  945. static inline nostd::unique_ptr<metrics::Counter<double>> CreateSyncDoubleMetricSystemPagingFaults(
  946. metrics::Meter *meter)
  947. {
  948. return meter->CreateDoubleCounter(kMetricSystemPagingFaults, descrMetricSystemPagingFaults,
  949. unitMetricSystemPagingFaults);
  950. }
  951. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  952. CreateAsyncInt64MetricSystemPagingFaults(metrics::Meter *meter)
  953. {
  954. return meter->CreateInt64ObservableCounter(
  955. kMetricSystemPagingFaults, descrMetricSystemPagingFaults, unitMetricSystemPagingFaults);
  956. }
  957. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  958. CreateAsyncDoubleMetricSystemPagingFaults(metrics::Meter *meter)
  959. {
  960. return meter->CreateDoubleObservableCounter(
  961. kMetricSystemPagingFaults, descrMetricSystemPagingFaults, unitMetricSystemPagingFaults);
  962. }
  963. /**
  964. * counter
  965. */
  966. static constexpr const char *kMetricSystemPagingOperations = "system.paging.operations";
  967. static constexpr const char *descrMetricSystemPagingOperations = "";
  968. static constexpr const char *unitMetricSystemPagingOperations = "{operation}";
  969. static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
  970. CreateSyncInt64MetricSystemPagingOperations(metrics::Meter *meter)
  971. {
  972. return meter->CreateUInt64Counter(kMetricSystemPagingOperations,
  973. descrMetricSystemPagingOperations,
  974. unitMetricSystemPagingOperations);
  975. }
  976. static inline nostd::unique_ptr<metrics::Counter<double>>
  977. CreateSyncDoubleMetricSystemPagingOperations(metrics::Meter *meter)
  978. {
  979. return meter->CreateDoubleCounter(kMetricSystemPagingOperations,
  980. descrMetricSystemPagingOperations,
  981. unitMetricSystemPagingOperations);
  982. }
  983. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  984. CreateAsyncInt64MetricSystemPagingOperations(metrics::Meter *meter)
  985. {
  986. return meter->CreateInt64ObservableCounter(kMetricSystemPagingOperations,
  987. descrMetricSystemPagingOperations,
  988. unitMetricSystemPagingOperations);
  989. }
  990. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  991. CreateAsyncDoubleMetricSystemPagingOperations(metrics::Meter *meter)
  992. {
  993. return meter->CreateDoubleObservableCounter(kMetricSystemPagingOperations,
  994. descrMetricSystemPagingOperations,
  995. unitMetricSystemPagingOperations);
  996. }
  997. /**
  998. * Unix swap or windows pagefile usage
  999. * <p>
  1000. * updowncounter
  1001. */
  1002. static constexpr const char *kMetricSystemPagingUsage = "system.paging.usage";
  1003. static constexpr const char *descrMetricSystemPagingUsage = "Unix swap or windows pagefile usage";
  1004. static constexpr const char *unitMetricSystemPagingUsage = "By";
  1005. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  1006. CreateSyncInt64MetricSystemPagingUsage(metrics::Meter *meter)
  1007. {
  1008. return meter->CreateInt64UpDownCounter(kMetricSystemPagingUsage, descrMetricSystemPagingUsage,
  1009. unitMetricSystemPagingUsage);
  1010. }
  1011. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  1012. CreateSyncDoubleMetricSystemPagingUsage(metrics::Meter *meter)
  1013. {
  1014. return meter->CreateDoubleUpDownCounter(kMetricSystemPagingUsage, descrMetricSystemPagingUsage,
  1015. unitMetricSystemPagingUsage);
  1016. }
  1017. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  1018. CreateAsyncInt64MetricSystemPagingUsage(metrics::Meter *meter)
  1019. {
  1020. return meter->CreateInt64ObservableUpDownCounter(
  1021. kMetricSystemPagingUsage, descrMetricSystemPagingUsage, unitMetricSystemPagingUsage);
  1022. }
  1023. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  1024. CreateAsyncDoubleMetricSystemPagingUsage(metrics::Meter *meter)
  1025. {
  1026. return meter->CreateDoubleObservableUpDownCounter(
  1027. kMetricSystemPagingUsage, descrMetricSystemPagingUsage, unitMetricSystemPagingUsage);
  1028. }
  1029. /**
  1030. * gauge
  1031. */
  1032. static constexpr const char *kMetricSystemPagingUtilization = "system.paging.utilization";
  1033. static constexpr const char *descrMetricSystemPagingUtilization = "";
  1034. static constexpr const char *unitMetricSystemPagingUtilization = "1";
  1035. #if OPENTELEMETRY_ABI_VERSION_NO >= 2
  1036. static inline nostd::unique_ptr<metrics::Gauge<int64_t>>
  1037. CreateSyncInt64MetricSystemPagingUtilization(metrics::Meter *meter)
  1038. {
  1039. return meter->CreateInt64Gauge(kMetricSystemPagingUtilization, descrMetricSystemPagingUtilization,
  1040. unitMetricSystemPagingUtilization);
  1041. }
  1042. static inline nostd::unique_ptr<metrics::Gauge<double>>
  1043. CreateSyncDoubleMetricSystemPagingUtilization(metrics::Meter *meter)
  1044. {
  1045. return meter->CreateDoubleGauge(kMetricSystemPagingUtilization,
  1046. descrMetricSystemPagingUtilization,
  1047. unitMetricSystemPagingUtilization);
  1048. }
  1049. #endif /* OPENTELEMETRY_ABI_VERSION_NO */
  1050. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  1051. CreateAsyncInt64MetricSystemPagingUtilization(metrics::Meter *meter)
  1052. {
  1053. return meter->CreateInt64ObservableGauge(kMetricSystemPagingUtilization,
  1054. descrMetricSystemPagingUtilization,
  1055. unitMetricSystemPagingUtilization);
  1056. }
  1057. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  1058. CreateAsyncDoubleMetricSystemPagingUtilization(metrics::Meter *meter)
  1059. {
  1060. return meter->CreateDoubleObservableGauge(kMetricSystemPagingUtilization,
  1061. descrMetricSystemPagingUtilization,
  1062. unitMetricSystemPagingUtilization);
  1063. }
  1064. /**
  1065. * Total number of processes in each state
  1066. * <p>
  1067. * updowncounter
  1068. */
  1069. static constexpr const char *kMetricSystemProcessCount = "system.process.count";
  1070. static constexpr const char *descrMetricSystemProcessCount =
  1071. "Total number of processes in each state";
  1072. static constexpr const char *unitMetricSystemProcessCount = "{process}";
  1073. static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
  1074. CreateSyncInt64MetricSystemProcessCount(metrics::Meter *meter)
  1075. {
  1076. return meter->CreateInt64UpDownCounter(kMetricSystemProcessCount, descrMetricSystemProcessCount,
  1077. unitMetricSystemProcessCount);
  1078. }
  1079. static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
  1080. CreateSyncDoubleMetricSystemProcessCount(metrics::Meter *meter)
  1081. {
  1082. return meter->CreateDoubleUpDownCounter(kMetricSystemProcessCount, descrMetricSystemProcessCount,
  1083. unitMetricSystemProcessCount);
  1084. }
  1085. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  1086. CreateAsyncInt64MetricSystemProcessCount(metrics::Meter *meter)
  1087. {
  1088. return meter->CreateInt64ObservableUpDownCounter(
  1089. kMetricSystemProcessCount, descrMetricSystemProcessCount, unitMetricSystemProcessCount);
  1090. }
  1091. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  1092. CreateAsyncDoubleMetricSystemProcessCount(metrics::Meter *meter)
  1093. {
  1094. return meter->CreateDoubleObservableUpDownCounter(
  1095. kMetricSystemProcessCount, descrMetricSystemProcessCount, unitMetricSystemProcessCount);
  1096. }
  1097. /**
  1098. * Total number of processes created over uptime of the host
  1099. * <p>
  1100. * counter
  1101. */
  1102. static constexpr const char *kMetricSystemProcessCreated = "system.process.created";
  1103. static constexpr const char *descrMetricSystemProcessCreated =
  1104. "Total number of processes created over uptime of the host";
  1105. static constexpr const char *unitMetricSystemProcessCreated = "{process}";
  1106. static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
  1107. CreateSyncInt64MetricSystemProcessCreated(metrics::Meter *meter)
  1108. {
  1109. return meter->CreateUInt64Counter(kMetricSystemProcessCreated, descrMetricSystemProcessCreated,
  1110. unitMetricSystemProcessCreated);
  1111. }
  1112. static inline nostd::unique_ptr<metrics::Counter<double>>
  1113. CreateSyncDoubleMetricSystemProcessCreated(metrics::Meter *meter)
  1114. {
  1115. return meter->CreateDoubleCounter(kMetricSystemProcessCreated, descrMetricSystemProcessCreated,
  1116. unitMetricSystemProcessCreated);
  1117. }
  1118. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  1119. CreateAsyncInt64MetricSystemProcessCreated(metrics::Meter *meter)
  1120. {
  1121. return meter->CreateInt64ObservableCounter(
  1122. kMetricSystemProcessCreated, descrMetricSystemProcessCreated, unitMetricSystemProcessCreated);
  1123. }
  1124. static inline nostd::shared_ptr<metrics::ObservableInstrument>
  1125. CreateAsyncDoubleMetricSystemProcessCreated(metrics::Meter *meter)
  1126. {
  1127. return meter->CreateDoubleObservableCounter(
  1128. kMetricSystemProcessCreated, descrMetricSystemProcessCreated, unitMetricSystemProcessCreated);
  1129. }
  1130. /**
  1131. * The time the system has been running
  1132. * <p>
  1133. * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds
  1134. * as a floating point number with the highest precision available. The actual accuracy would depend
  1135. * on the instrumentation and operating system. <p> gauge
  1136. */
  1137. static constexpr const char *kMetricSystemUptime = "system.uptime";
  1138. static constexpr const char *descrMetricSystemUptime = "The time the system has been running";
  1139. static constexpr const char *unitMetricSystemUptime = "s";
  1140. #if OPENTELEMETRY_ABI_VERSION_NO >= 2
  1141. static inline nostd::unique_ptr<metrics::Gauge<int64_t>> CreateSyncInt64MetricSystemUptime(
  1142. metrics::Meter *meter)
  1143. {
  1144. return meter->CreateInt64Gauge(kMetricSystemUptime, descrMetricSystemUptime,
  1145. unitMetricSystemUptime);
  1146. }
  1147. static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricSystemUptime(
  1148. metrics::Meter *meter)
  1149. {
  1150. return meter->CreateDoubleGauge(kMetricSystemUptime, descrMetricSystemUptime,
  1151. unitMetricSystemUptime);
  1152. }
  1153. #endif /* OPENTELEMETRY_ABI_VERSION_NO */
  1154. static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncInt64MetricSystemUptime(
  1155. metrics::Meter *meter)
  1156. {
  1157. return meter->CreateInt64ObservableGauge(kMetricSystemUptime, descrMetricSystemUptime,
  1158. unitMetricSystemUptime);
  1159. }
  1160. static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncDoubleMetricSystemUptime(
  1161. metrics::Meter *meter)
  1162. {
  1163. return meter->CreateDoubleObservableGauge(kMetricSystemUptime, descrMetricSystemUptime,
  1164. unitMetricSystemUptime);
  1165. }
  1166. } // namespace system
  1167. } // namespace semconv
  1168. OPENTELEMETRY_END_NAMESPACE