query.editor.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <div class="editor-row">
  2. <div ng-repeat="target in panel.targets"
  3. class="tight-form"
  4. ng-class="{'tight-form-disabled': target.hide}"
  5. ng-controller="GraphiteQueryCtrl"
  6. ng-init="init()">
  7. <ul class="tight-form-list pull-right">
  8. <li ng-show="parserError" class="tight-form-item">
  9. <a bs-tooltip="parserError" style="color: rgb(229, 189, 28)" role="menuitem">
  10. <i class="fa fa-warning"></i>
  11. </a>
  12. </li>
  13. <li class="tight-form-item">
  14. <a class="pointer" tabindex="1" ng-click="showTextEditor = !showTextEditor">
  15. <i class="fa fa-pencil"></i>
  16. </a>
  17. </li>
  18. <li class="tight-form-item">
  19. <div class="dropdown">
  20. <a class="pointer dropdown-toggle"
  21. data-toggle="dropdown"
  22. tabindex="1">
  23. <i class="fa fa-bars"></i>
  24. </a>
  25. <ul class="dropdown-menu pull-right" role="menu">
  26. <li role="menuitem">
  27. <a tabindex="1"
  28. ng-click="duplicate()">
  29. Duplicate
  30. </a>
  31. </li>
  32. <li role="menuitem">
  33. <a tabindex="1"
  34. ng-click="moveMetricQuery($index, $index-1)">
  35. Move up
  36. </a>
  37. </li>
  38. <li role="menuitem">
  39. <a tabindex="1"
  40. ng-click="moveMetricQuery($index, $index+1)">
  41. Move down
  42. </a>
  43. </li>
  44. </ul>
  45. </div>
  46. </li>
  47. <li class="tight-form-item last">
  48. <a class="pointer" tabindex="1" ng-click="removeDataQuery(target)">
  49. <i class="fa fa-remove"></i>
  50. </a>
  51. </li>
  52. </ul>
  53. <ul class="tight-form-list">
  54. <li class="tight-form-item" style="min-width: 15px; text-align: center">
  55. {{targetLetters[$index]}}
  56. </li>
  57. <li>
  58. <a class="tight-form-item"
  59. ng-click="target.hide = !target.hide; get_data();"
  60. role="menuitem">
  61. <i class="fa fa-eye"></i>
  62. </a>
  63. </li>
  64. </ul>
  65. <input type="text"
  66. class="tight-form-clear-input span10"
  67. ng-model="target.target"
  68. focus-me="showTextEditor"
  69. spellcheck='false'
  70. ng-model-onblur ng-change="targetTextChanged()"
  71. ng-show="showTextEditor" />
  72. <ul class="tight-form-list" role="menu" ng-hide="showTextEditor">
  73. <li ng-repeat="segment in segments" role="menuitem">
  74. <metric-segment segment="segment" get-alt-segments="getAltSegments($index)" on-value-changed="segmentValueChanged(segment, $index)"></metric-segment>
  75. </li>
  76. <li ng-repeat="func in functions">
  77. <span graphite-func-editor class="tight-form-item tight-form-func">
  78. </span>
  79. </li>
  80. <li class="dropdown" graphite-add-func>
  81. </li>
  82. </ul>
  83. <div class="clearfix"></div>
  84. </div>
  85. </div>
  86. <section class="grafana-metric-options">
  87. <div class="tight-form">
  88. <ul class="tight-form-list">
  89. <li class="tight-form-item tight-form-item-icon">
  90. <i class="fa fa-wrench"></i>
  91. </li>
  92. <li class="tight-form-item">
  93. Cache timeout
  94. </li>
  95. <li>
  96. <input type="text"
  97. class="input-mini tight-form-input"
  98. ng-model="panel.cacheTimeout"
  99. bs-tooltip="'Graphite parameter to override memcache default timeout (unit is seconds)'"
  100. data-placement="right"
  101. spellcheck='false'
  102. placeholder="60">
  103. </li>
  104. <li class="tight-form-item">
  105. Max data points
  106. </li>
  107. <li>
  108. <input type="text"
  109. class="input-mini tight-form-input"
  110. ng-model="panel.maxDataPoints"
  111. bs-tooltip="'Override max data points, automatically set to graph width in pixels.'"
  112. data-placement="right"
  113. ng-model-onblur ng-change="get_data()"
  114. spellcheck='false'
  115. placeholder="auto">
  116. </li>
  117. </ul>
  118. <div class="clearfix"></div>
  119. </div>
  120. <div class="tight-form">
  121. <ul class="tight-form-list">
  122. <li class="tight-form-item tight-form-item-icon">
  123. <i class="fa fa-info-circle"></i>
  124. </li>
  125. <li class="tight-form-item">
  126. <a ng-click="toggleEditorHelp(1);" bs-tooltip="'click to show helpful info'" data-placement="bottom">
  127. shorter legend names
  128. </a>
  129. </li>
  130. <li class="tight-form-item">
  131. <a ng-click="toggleEditorHelp(2);" bs-tooltip="'click to show helpful info'" data-placement="bottom">
  132. series as parameters
  133. </a>
  134. </li>
  135. <li class="tight-form-item">
  136. <a ng-click="toggleEditorHelp(3)" bs-tooltip="'click to show helpful info'" data-placement="bottom">
  137. stacking
  138. </a>
  139. </li>
  140. <li class="tight-form-item">
  141. <a ng-click="toggleEditorHelp(4)" bs-tooltip="'click to show helpful info'" data-placement="bottom">
  142. templating
  143. </a>
  144. </li>
  145. <li class="tight-form-item">
  146. <a ng-click="toggleEditorHelp(5)" bs-tooltip="'click to show helpful info'" data-placement="bottom">
  147. max data points
  148. </a>
  149. </li>
  150. </ul>
  151. <div class="clearfix"></div>
  152. </div>
  153. </section>
  154. <div class="editor-row">
  155. <div class="pull-left" style="margin-top: 30px;">
  156. <div class="grafana-info-box span8" ng-if="editorHelpIndex === 1">
  157. <h5>Shorter legend names</h5>
  158. <ul>
  159. <li>alias() function to specify a custom series name</li>
  160. <li>aliasByNode(2) to alias by a specific part of your metric path</li>
  161. <li>aliasByNode(2, -1) you can add multiple segment paths, and use negative index</li>
  162. <li>groupByNode(2, 'sum') is useful if you have 2 wildcards in your metric path and want to sumSeries and group by</li>
  163. </ul>
  164. </div>
  165. <div class="grafana-info-box span8" ng-if="editorHelpIndex === 2">
  166. <h5>Series as parameter</h5>
  167. <ul>
  168. <li>Some graphite functions allow you to have many series arguments</li>
  169. <li>Use #[A-Z] to use a graphite query as parameter to a function</li>
  170. <li>
  171. Examples:
  172. <ul>
  173. <li>asPercent(#A, #B)</li>
  174. <li>prod.srv-01.counters.count - asPercent(#A) : percentage of count in comparison with A query</li>
  175. <li>prod.srv-01.counters.count - sumSeries(#A) : sum count and series A </li>
  176. <li>divideSeries(#A, #B)</li>
  177. </ul>
  178. </li>
  179. <li>If a query is added only to be used as a parameter, hide it from the graph with the eye icon</li>
  180. </ul>
  181. </div>
  182. <div class="grafana-info-box span6" ng-if="editorHelpIndex === 3">
  183. <h5>Stacking</h5>
  184. <ul>
  185. <li>You find the stacking option under Display Styles tab</li>
  186. <li>When stacking is enabled make sure null point mode is set to 'null as zero'</li>
  187. </ul>
  188. </div>
  189. <div class="grafana-info-box span6" ng-if="editorHelpIndex === 4">
  190. <h5>Templating</h5>
  191. <ul>
  192. <li>You can use a template variable in place of metric names</li>
  193. <li>You can use a template variable in place of function parameters</li>
  194. <li>You enable the templating feature in Dashboard settings / Feature toggles </li>
  195. </ul>
  196. </div>
  197. <div class="grafana-info-box span6" ng-if="editorHelpIndex === 5">
  198. <h5>Max data points</h5>
  199. <ul>
  200. <li>Every graphite request is issued with a maxDataPoints parameter</li>
  201. <li>Graphite uses this parameter to consolidate the real number of values down to this number</li>
  202. <li>If there are more real values, then by default they will be consolidated using averages</li>
  203. <li>This could hide real peaks and max values in your series</li>
  204. <li>You can change how point consolidation is made using the consolidateBy graphite function</li>
  205. <li>Point consolidation will effect series legend values (min,max,total,current)</li>
  206. <li>If you override maxDataPoint and set a high value performance can be severely effected</li>
  207. </ul>
  208. </div>
  209. </div>
  210. </div>