github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/src/views/reports/containers/debug/index.tsx (about) 1 // Copyright 2018 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 import _ from "lodash"; 12 import React from "react"; 13 import { Helmet } from "react-helmet"; 14 15 import { getDataFromServer } from "src/util/dataFromServer"; 16 import DebugAnnotation from "src/views/shared/components/debugAnnotation"; 17 import InfoBox from "src/views/shared/components/infoBox"; 18 import LicenseType from "src/views/shared/components/licenseType"; 19 import { PanelSection, PanelTitle, PanelPair, Panel } from "src/views/shared/components/panelSection"; 20 21 import "./debug.styl"; 22 23 const COMMUNITY_URL = "https://www.cockroachlabs.com/community/"; 24 25 const NODE_ID = getDataFromServer().NodeID; 26 27 function DebugTableLink(props: { name: string, url: string, note?: string }) { 28 return ( 29 <tr className="debug-inner-table__row"> 30 <td className="debug-inner-table__cell"> 31 <a className="debug-link" href={props.url}>{props.name}</a> 32 </td> 33 <td className="debug-inner-table__cell--notes"> 34 {_.isNil(props.note) ? props.url : props.note} 35 </td> 36 </tr> 37 ); 38 } 39 40 function DebugTableRow(props: { title: string, children?: React.ReactNode }) { 41 return ( 42 <tr className="debug-table__row"> 43 <th className="debug-table__cell debug-table__cell--header">{props.title}</th> 44 <td className="debug-table__cell"> 45 <table className="debug-inner-table"> 46 <tbody> 47 {props.children} 48 </tbody> 49 </table> 50 </td> 51 </tr> 52 ); 53 } 54 55 function DebugTable(props: { heading: string, children?: React.ReactNode }) { 56 return ( 57 <div> 58 <h2 className="base-heading">{props.heading}</h2> 59 <table className="debug-table"> 60 <tbody> 61 {props.children} 62 </tbody> 63 </table> 64 </div> 65 ); 66 } 67 68 function DebugPanelLink(props: { name: string, url: string, note: string }) { 69 return ( 70 <PanelPair> 71 <Panel> 72 <a href={ props.url }>{ props.name }</a> 73 <p>{ props.note }</p> 74 </Panel> 75 <Panel> 76 <div className="debug-url"><div>{ props.url }</div></div> 77 </Panel> 78 </PanelPair> 79 ); 80 } 81 82 export default function Debug() { 83 return ( 84 <div className="section"> 85 <Helmet title="Debug" /> 86 <h1 className="base-heading">Advanced Debugging</h1> 87 <div className="debug-header"> 88 <InfoBox> 89 <p> 90 The following pages are meant for advanced monitoring and troubleshooting. 91 Note that these pages are experimental and undocumented. If you find an issue, 92 let us know through{" "} 93 <a href={ COMMUNITY_URL }>these channels.</a> 94 </p> 95 </InfoBox> 96 97 <div className="debug-header__annotations"> 98 <LicenseType /> 99 <DebugAnnotation label="Web server" value={ `n${NODE_ID}` } /> 100 </div> 101 </div> 102 <PanelSection> 103 <PanelTitle>Reports</PanelTitle> 104 <DebugPanelLink 105 name="Custom Time Series Chart" 106 url="#/debug/chart" 107 note="Create a custom chart of time series data." 108 /> 109 <DebugPanelLink 110 name="Problem Ranges" 111 url="#/reports/problemranges" 112 note="View ranges in your cluster that are unavailable, underreplicated, slow, or have other problems." 113 /> 114 <DebugPanelLink 115 name="Data Distribution and Zone Configs" 116 url="#/data-distribution" 117 note="View the distribution of table data across nodes and verify zone configuration." 118 /> 119 <DebugPanelLink 120 name="Statement Diagnostics History" 121 url="#/reports/statements/diagnosticshistory" 122 note="View the history of statement diagnostics requests" 123 /> 124 <PanelTitle>Configuration</PanelTitle> 125 <DebugPanelLink 126 name="Cluster Settings" 127 url="#/reports/settings" 128 note="View all cluster settings." 129 /> 130 <DebugPanelLink 131 name="Localities" 132 url="#/reports/localities" 133 note="Check node localities and locations for your cluster." 134 /> 135 </PanelSection> 136 <DebugTable heading="Even More Advanced Debugging"> 137 <DebugTableRow title="Node Diagnostics"> 138 <DebugTableLink name="All Nodes" url="#/reports/nodes" /> 139 <DebugTableLink 140 name="Nodes filtered by node IDs" 141 url="#/reports/nodes?node_ids=1,2" 142 note="#/reports/nodes?node_ids=[node_id{,node_id...}]" 143 /> 144 <DebugTableLink 145 name="Nodes filtered by locality (regex)" 146 url="#/reports/nodes?locality=region=us-east" 147 note="#/reports/nodes?locality=[regex]" 148 /> 149 <DebugTableLink 150 name="Decommissioned node history" 151 url="#/reports/nodes/history" 152 note="#/reports/nodes/history" 153 /> 154 </DebugTableRow> 155 <DebugTableRow title="Stores"> 156 <DebugTableLink name="Stores on this node" url="#/reports/stores/local" /> 157 <DebugTableLink 158 name="Stores on a specific node" 159 url="#/reports/stores/1" 160 note="#/reports/stores/[node_id]" 161 /> 162 </DebugTableRow> 163 <DebugTableRow title="Security"> 164 <DebugTableLink name="Certificates on this node" url="#/reports/certificates/local" /> 165 <DebugTableLink 166 name="Certificates on a specific node" 167 url="#/reports/certificates/1" 168 note="#/reports/certificates/[node_id]" 169 /> 170 </DebugTableRow> 171 <DebugTableRow title="Problem Ranges"> 172 <DebugTableLink 173 name="Problem Ranges on a specific node" 174 url="#/reports/problemranges/local" 175 note="#/reports/problemranges/[node_id]" 176 /> 177 </DebugTableRow> 178 <DebugTableRow title="Ranges"> 179 <DebugTableLink 180 name="Range Status" 181 url="#/reports/range/1" 182 note="#/reports/range/[range_id]" 183 /> 184 <DebugTableLink name="Raft Messages" url="#/raft/messages/all" /> 185 <DebugTableLink name="Raft for all ranges" url="#/raft/ranges" /> 186 </DebugTableRow> 187 </DebugTable> 188 <DebugTable heading="Tracing and Profiling Endpoints (local node only)"> 189 <DebugTableRow title="Tracing"> 190 <DebugTableLink name="Requests" url="/debug/requests" /> 191 <DebugTableLink name="Events" url="/debug/events" /> 192 <DebugTableLink 193 name="Logs" 194 url="/debug/logspy?count=1&duration=10s&grep=." 195 note="/debug/logspy?count=[count]&duration=[duration]&grep=[regexp]" 196 /> 197 </DebugTableRow> 198 <DebugTableRow title="Enqueue Range"> 199 <DebugTableLink 200 name="Run a range through an internal queue" 201 url="#/debug/enqueue_range" 202 note="#/debug/enqueue_range" 203 /> 204 </DebugTableRow> 205 <DebugTableRow title="Stopper"> 206 <DebugTableLink name="Active Tasks" url="/debug/stopper" /> 207 </DebugTableRow> 208 <DebugTableRow title="Profiling UI/pprof"> 209 <DebugTableLink name="Heap" url="/debug/pprof/ui/heap/" /> 210 <DebugTableLink name="Profile" url="/debug/pprof/ui/profile/?seconds=5" /> 211 <DebugTableLink name="Profile (w/ Labels)" url="/debug/pprof/ui/profile/?seconds=5&labels=true" /> 212 <DebugTableLink name="Block" url="/debug/pprof/ui/block/" /> 213 <DebugTableLink name="Mutex" url="/debug/pprof/ui/mutex/" /> 214 <DebugTableLink name="Thread Create" url="/debug/pprof/ui/threadcreate/" /> 215 <DebugTableLink name="Goroutines" url="/debug/pprof/ui/goroutine/" /> 216 </DebugTableRow> 217 <DebugTableRow title="Goroutines"> 218 <DebugTableLink name="UI" url="/debug/pprof/goroutineui" /> 219 <DebugTableLink name="UI (count)" url="/debug/pprof/goroutineui?sort=count" /> 220 <DebugTableLink name="UI (wait)" url="/debug/pprof/goroutineui?sort=wait" /> 221 <DebugTableLink name="Raw" url="/debug/pprof/goroutine?debug=2" /> 222 </DebugTableRow> 223 <DebugTableRow title="Threads"> 224 <DebugTableLink name="Raw" url="/debug/threads" /> 225 </DebugTableRow> 226 <DebugTableRow title="Runtime Trace"> 227 <DebugTableLink name="Trace" url="/debug/pprof/trace?debug=1" /> 228 </DebugTableRow> 229 </DebugTable> 230 <DebugTable heading="Raw Status Endpoints (JSON)"> 231 <DebugTableRow title="Logs (single node only)"> 232 <DebugTableLink 233 name="On a Specific Node" 234 url="/_status/logs/local" 235 note="/_status/logs/[node_id]" 236 /> 237 <DebugTableLink 238 name="Log Files" 239 url="/_status/logfiles/local" 240 note="/_status/logfiles/[node_id]" 241 /> 242 <DebugTableLink 243 name="Specific Log File" 244 url="/_status/logfiles/local/cockroach.log" 245 note="/_status/logfiles/[node_id]/[filename]" 246 /> 247 </DebugTableRow> 248 <DebugTableRow title="Metrics"> 249 <DebugTableLink name="Variables" url="/debug/metrics" /> 250 <DebugTableLink name="Prometheus" url="/_status/vars" /> 251 </DebugTableRow> 252 <DebugTableRow title="Node Status"> 253 <DebugTableLink 254 name="All Nodes" 255 url="/_status/nodes" 256 note="/_status/nodes" 257 /> 258 <DebugTableLink 259 name="Single node status" 260 url="/_status/nodes/local" 261 note="/_status/nodes/[node_id]" 262 /> 263 </DebugTableRow> 264 <DebugTableRow title="Hot Ranges"> 265 <DebugTableLink 266 name="All Nodes" 267 url="/_status/hotranges" 268 note="/_status/hotranges" 269 /> 270 <DebugTableLink 271 name="Single node's ranges" 272 url="/_status/hotranges?node_id=local" 273 note="/_status/hotranges?node_id=[node_id]" 274 /> 275 </DebugTableRow> 276 <DebugTableRow title="Single Node Specific"> 277 <DebugTableLink 278 name="Stores" 279 url="/_status/stores/local" 280 note="/_status/stores/[node_id]" 281 /> 282 <DebugTableLink 283 name="Gossip" 284 url="/_status/gossip/local" 285 note="/_status/gossip/[node_id]" 286 /> 287 <DebugTableLink 288 name="Ranges" 289 url="/_status/ranges/local" 290 note="/_status/ranges/[node_id]" 291 /> 292 <DebugTableLink 293 name="Stacks" 294 url="/_status/stacks/local" 295 note="/_status/stacks/[node_id]" 296 /> 297 <DebugTableLink 298 name="Engine Stats" 299 url="/_status/enginestats/local" 300 note="/_status/enginestats/[node_id]" 301 /> 302 <DebugTableLink 303 name="Certificates" 304 url="/_status/certificates/local" 305 note="/_status/certificates/[node_id]" 306 /> 307 <DebugTableLink 308 name="Diagnostics Reporting Data" 309 url="/_status/diagnostics/local" 310 note="/_status/diagnostics/[node_id]" 311 /> 312 </DebugTableRow> 313 <DebugTableRow title="Sessions"> 314 <DebugTableLink name="Local Sessions" url="/_status/local_sessions" /> 315 <DebugTableLink name="All Sessions" url="/_status/sessions" /> 316 </DebugTableRow> 317 <DebugTableRow title="Cluster Wide"> 318 <DebugTableLink name="Raft" url="/_status/raft" /> 319 <DebugTableLink 320 name="Range" 321 url="/_status/range/1" 322 note="/_status/range/[range_id]" 323 /> 324 <DebugTableLink name="Range Log" url="/_admin/v1/rangelog?limit=100" /> 325 <DebugTableLink 326 name="Range Log for Specific Range" 327 url="/_admin/v1/rangelog/1?limit=100" 328 note="/_admin/v1/rangelog/[range_id]?limit=100" 329 /> 330 </DebugTableRow> 331 <DebugTableRow title="Allocator"> 332 <DebugTableLink 333 name="Simulated Allocator Runs on a Specific Node" 334 url="/_status/allocator/node/local" 335 note="/_status/allocator/node/[node_id]" 336 /> 337 <DebugTableLink 338 name="Simulated Allocator Runs on a Specific Range" 339 url="/_status/allocator/range/1" 340 note="/_status/allocator/range/[range_id]" 341 /> 342 </DebugTableRow> 343 </DebugTable> 344 <DebugTable heading="UI Debugging"> 345 <DebugTableRow title="Redux State"> 346 <DebugTableLink 347 name="Export the Redux State of the UI" 348 url="#/debug/redux" 349 /> 350 </DebugTableRow> 351 </DebugTable> 352 </div> 353 ); 354 }