system_metrics.h 56 KB

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