metrics_private.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. // This file was generated by:
  5. // tools/json_schema_compiler/compiler.py.
  6. // NOTE: The format of types has changed. 'FooType' is now
  7. // 'chrome.metricsPrivate.FooType'.
  8. // Please run the closure compiler before committing changes.
  9. // See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_compilation.md
  10. /** @fileoverview Externs generated from namespace: metricsPrivate */
  11. /** @const */
  12. chrome.metricsPrivate = {};
  13. /**
  14. * @enum {string}
  15. */
  16. chrome.metricsPrivate.MetricTypeType = {
  17. HISTOGRAM_LOG: 'histogram-log',
  18. HISTOGRAM_LINEAR: 'histogram-linear',
  19. };
  20. /**
  21. * Describes the type of metric that is to be collected.
  22. * @typedef {{
  23. * metricName: string,
  24. * type: !chrome.metricsPrivate.MetricTypeType,
  25. * min: number,
  26. * max: number,
  27. * buckets: number
  28. * }}
  29. */
  30. chrome.metricsPrivate.MetricType;
  31. /**
  32. * @typedef {{
  33. * min: number,
  34. * max: number,
  35. * count: number
  36. * }}
  37. */
  38. chrome.metricsPrivate.HistogramBucket;
  39. /**
  40. * @typedef {{
  41. * sum: number,
  42. * buckets: !Array<!chrome.metricsPrivate.HistogramBucket>
  43. * }}
  44. */
  45. chrome.metricsPrivate.Histogram;
  46. /**
  47. * Get details about a histogram displayed at chrome://histogram.
  48. * @param {string} name Histogram name, e.g. 'Accessibility.CrosAutoclick'.
  49. * @param {function(!chrome.metricsPrivate.Histogram): void} callback Invoked
  50. * with details.
  51. */
  52. chrome.metricsPrivate.getHistogram = function(name, callback) {};
  53. /**
  54. * Returns true if the user opted in to sending crash reports.
  55. * @param {function(boolean): void} callback
  56. */
  57. chrome.metricsPrivate.getIsCrashReportingEnabled = function(callback) {};
  58. /**
  59. * Returns the group name chosen for the named trial, or the empty string if the
  60. * trial does not exist or is not enabled.
  61. * @param {string} name
  62. * @param {function(string): void} callback
  63. */
  64. chrome.metricsPrivate.getFieldTrial = function(name, callback) {};
  65. /**
  66. * Returns variation parameters for the named trial if available, or undefined
  67. * otherwise.
  68. * @param {string} name
  69. * @param {function((Object|undefined)): void} callback
  70. */
  71. chrome.metricsPrivate.getVariationParams = function(name, callback) {};
  72. /**
  73. * Records an action performed by the user.
  74. * @param {string} name
  75. */
  76. chrome.metricsPrivate.recordUserAction = function(name) {};
  77. /**
  78. * Records a percentage value from 1 to 100.
  79. * @param {string} metricName
  80. * @param {number} value
  81. */
  82. chrome.metricsPrivate.recordPercentage = function(metricName, value) {};
  83. /**
  84. * Records a value than can range from 1 to 1,000,000.
  85. * @param {string} metricName
  86. * @param {number} value
  87. */
  88. chrome.metricsPrivate.recordCount = function(metricName, value) {};
  89. /**
  90. * Records a value than can range from 1 to 100.
  91. * @param {string} metricName
  92. * @param {number} value
  93. */
  94. chrome.metricsPrivate.recordSmallCount = function(metricName, value) {};
  95. /**
  96. * Records a value than can range from 1 to 10,000.
  97. * @param {string} metricName
  98. * @param {number} value
  99. */
  100. chrome.metricsPrivate.recordMediumCount = function(metricName, value) {};
  101. /**
  102. * Records an elapsed time of no more than 10 seconds. The sample value is
  103. * specified in milliseconds.
  104. * @param {string} metricName
  105. * @param {number} value
  106. */
  107. chrome.metricsPrivate.recordTime = function(metricName, value) {};
  108. /**
  109. * Records an elapsed time of no more than 3 minutes. The sample value is
  110. * specified in milliseconds.
  111. * @param {string} metricName
  112. * @param {number} value
  113. */
  114. chrome.metricsPrivate.recordMediumTime = function(metricName, value) {};
  115. /**
  116. * Records an elapsed time of no more than 1 hour. The sample value is
  117. * specified in milliseconds.
  118. * @param {string} metricName
  119. * @param {number} value
  120. */
  121. chrome.metricsPrivate.recordLongTime = function(metricName, value) {};
  122. /**
  123. * Increments the count associated with the hash of |value| in the sparse
  124. * histogram defined by the |metricName| using base::PersistentHash(value).
  125. * @param {string} metricName
  126. * @param {string} value
  127. */
  128. chrome.metricsPrivate.recordSparseHashable = function(metricName, value) {};
  129. /**
  130. * Increments the count associated with the hash of |value| in the sparse
  131. * histogram defined by the |metricName| using base::HashMetricName(value).
  132. * @param {string} metricName
  133. * @param {string} value
  134. */
  135. chrome.metricsPrivate.recordSparseValueWithHashMetricName = function(metricName, value) {};
  136. /**
  137. * Increments the count associated with the hash of |value| in the sparse
  138. * histogram defined by the |metricName| using base::PersistentHash(value).
  139. * @param {string} metricName
  140. * @param {string} value
  141. */
  142. chrome.metricsPrivate.recordSparseValueWithPersistentHash = function(metricName, value) {};
  143. /**
  144. * Increments the count associated with |value| in the sparse histogram defined
  145. * by the |metricName|.
  146. * @param {string} metricName
  147. * @param {number} value
  148. */
  149. chrome.metricsPrivate.recordSparseValue = function(metricName, value) {};
  150. /**
  151. * Adds a value to the given metric.
  152. * @param {!chrome.metricsPrivate.MetricType} metric
  153. * @param {number} value
  154. */
  155. chrome.metricsPrivate.recordValue = function(metric, value) {};
  156. /**
  157. * Records a boolean value to the given metric. Analogous to
  158. * base::UmaHistogramBoolean().
  159. * @param {string} metricName
  160. * @param {boolean} value
  161. */
  162. chrome.metricsPrivate.recordBoolean = function(metricName, value) {};
  163. /**
  164. * Records an enumeration value to the given metric. Analogous to
  165. * base::UmaHistogramEnumeration(). Use recordSparseValue for sparse enums or
  166. * enums not starting at 0.
  167. * @param {string} metricName
  168. * @param {number} value
  169. * @param {number} enumSize
  170. */
  171. chrome.metricsPrivate.recordEnumerationValue = function(metricName, value, enumSize) {};