github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/src/views/cluster/containers/nodeGraphs/dashboards/runtime.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 React from "react";
    12  import _ from "lodash";
    13  
    14  import { LineGraph } from "src/views/cluster/components/linegraph";
    15  import { Metric, Axis, AxisUnits } from "src/views/shared/components/metricQuery";
    16  
    17  import { GraphDashboardProps, nodeDisplayName, storeIDsForNode } from "./dashboardUtils";
    18  
    19  export default function (props: GraphDashboardProps) {
    20    const { nodeIDs, nodesSummary, nodeSources, tooltipSelection } = props;
    21  
    22    return [
    23      <LineGraph title="Live Node Count" tooltip="The number of live nodes in the cluster.">
    24        <Axis label="nodes">
    25          <Metric name="cr.node.liveness.livenodes" title="Live Nodes" aggregateMax />
    26        </Axis>
    27      </LineGraph>,
    28  
    29      <LineGraph
    30        title="Memory Usage"
    31        sources={nodeSources}
    32        tooltip={(
    33          <div>
    34            {`Memory in use ${tooltipSelection}:`}
    35            <dl>
    36              <dt>RSS</dt>
    37              <dd>Total memory in use by CockroachDB</dd>
    38              <dt>Go Allocated</dt>
    39              <dd>Memory allocated by the Go layer</dd>
    40              <dt>Go Total</dt>
    41              <dd>Total memory managed by the Go layer</dd>
    42              <dt>C Allocated</dt>
    43              <dd>Memory allocated by the C layer</dd>
    44              <dt>C Total</dt>
    45              <dd>Total memory managed by the C layer</dd>
    46            </dl>
    47          </div>
    48        )}
    49      >
    50        <Axis units={AxisUnits.Bytes} label="memory usage">
    51          <Metric name="cr.node.sys.rss" title="Total memory (RSS)" />
    52          <Metric name="cr.node.sys.go.allocbytes" title="Go Allocated" />
    53          <Metric name="cr.node.sys.go.totalbytes" title="Go Total" />
    54          <Metric name="cr.node.sys.cgo.allocbytes" title="CGo Allocated" />
    55          <Metric name="cr.node.sys.cgo.totalbytes" title="CGo Total" />
    56        </Axis>
    57      </LineGraph>,
    58  
    59      <LineGraph
    60        title="Goroutine Count"
    61        sources={nodeSources}
    62        tooltip={
    63          `The number of Goroutines ${tooltipSelection}.
    64             This count should rise and fall based on load.`
    65        }
    66      >
    67        <Axis label="goroutines">
    68          <Metric name="cr.node.sys.goroutines" title="Goroutine Count" />
    69        </Axis>
    70      </LineGraph>,
    71  
    72      // TODO(mrtracy): The following two graphs are a good first example of a graph with
    73      // two axes; the two series should be highly correlated, but have different units.
    74      <LineGraph
    75        title="GC Runs"
    76        sources={nodeSources}
    77        tooltip={
    78          `The number of times that Go’s garbage collector was invoked per second ${tooltipSelection}.`
    79        }
    80      >
    81        <Axis label="runs">
    82          <Metric name="cr.node.sys.gc.count" title="GC Runs" nonNegativeRate />
    83        </Axis>
    84      </LineGraph>,
    85  
    86      <LineGraph
    87        title="GC Pause Time"
    88        sources={nodeSources}
    89        tooltip={
    90          `The amount of processor time used by Go’s garbage collector
    91             per second ${tooltipSelection}.
    92             During garbage collection, application code execution is paused.`
    93        }
    94      >
    95        <Axis units={AxisUnits.Duration} label="pause time">
    96          <Metric name="cr.node.sys.gc.pause.ns" title="GC Pause Time" nonNegativeRate />
    97        </Axis>
    98      </LineGraph>,
    99  
   100      <LineGraph
   101        title="CPU Time"
   102        sources={nodeSources}
   103        tooltip={
   104          `The amount of CPU time used by CockroachDB (User)
   105             and system-level operations (Sys) ${tooltipSelection}.`
   106        }
   107      >
   108        <Axis units={AxisUnits.Duration} label="cpu time">
   109          <Metric name="cr.node.sys.cpu.user.ns" title="User CPU Time" nonNegativeRate />
   110          <Metric name="cr.node.sys.cpu.sys.ns" title="Sys CPU Time" nonNegativeRate />
   111        </Axis>
   112      </LineGraph>,
   113  
   114      <LineGraph
   115        title="Clock Offset"
   116        sources={nodeSources}
   117        tooltip={`Mean clock offset of each node against the rest of the cluster.`}
   118      >
   119        <Axis label="offset" units={AxisUnits.Duration}>
   120          {
   121            _.map(nodeIDs, (nid) => (
   122              <Metric
   123                key={nid}
   124                name="cr.node.clock-offset.meannanos"
   125                title={nodeDisplayName(nodesSummary, nid)}
   126                sources={storeIDsForNode(nodesSummary, nid)}
   127              />
   128            ))
   129          }
   130        </Axis>
   131      </LineGraph>,
   132    ];
   133  }