github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/src/views/cluster/containers/nodeGraphs/dashboards/replication.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  import {
    19    LogicalBytesGraphTooltip,
    20  } from "src/views/cluster/containers/nodeGraphs/dashboards/graphTooltips";
    21  
    22  export default function (props: GraphDashboardProps) {
    23    const { nodeIDs, nodesSummary, storeSources } = props;
    24  
    25    return [
    26      <LineGraph title="Ranges" sources={storeSources}>
    27        <Axis label="ranges">
    28          <Metric name="cr.store.ranges" title="Ranges" />
    29          <Metric name="cr.store.replicas.leaders" title="Leaders" />
    30          <Metric name="cr.store.replicas.leaseholders" title="Lease Holders" />
    31          <Metric name="cr.store.replicas.leaders_not_leaseholders" title="Leaders w/o Lease" />
    32          <Metric name="cr.store.ranges.unavailable" title="Unavailable" />
    33          <Metric name="cr.store.ranges.underreplicated" title="Under-replicated" />
    34          <Metric name="cr.store.ranges.overreplicated" title="Over-replicated" />
    35        </Axis>
    36      </LineGraph>,
    37  
    38      <LineGraph title="Replicas per Store" tooltip={`The number of replicas on each store.`}>
    39        <Axis label="replicas">
    40          {
    41            _.map(nodeIDs, (nid) => (
    42              <Metric
    43                key={nid}
    44                name="cr.store.replicas"
    45                title={nodeDisplayName(nodesSummary, nid)}
    46                sources={storeIDsForNode(nodesSummary, nid)}
    47              />
    48            ))
    49          }
    50        </Axis>
    51      </LineGraph>,
    52  
    53      <LineGraph
    54        title="Leaseholders per Store"
    55        tooltip={
    56            `The number of leaseholder replicas on each store. A leaseholder replica is the one that
    57            receives and coordinates all read and write requests for its range.`
    58        }
    59      >
    60        <Axis label="leaseholders">
    61          {
    62            _.map(nodeIDs, (nid) => (
    63              <Metric
    64                key={nid}
    65                name="cr.store.replicas.leaseholders"
    66                title={nodeDisplayName(nodesSummary, nid)}
    67                sources={storeIDsForNode(nodesSummary, nid)}
    68              />
    69            ))
    70          }
    71        </Axis>
    72      </LineGraph>,
    73  
    74      <LineGraph title="Average Queries per Store" tooltip={`Exponentially weighted moving average of the number of KV batch requests processed by leaseholder replicas on each store per second. Tracks roughly the last 30 minutes of requests. Used for load-based rebalancing decisions.`}>
    75        <Axis label="queries">
    76          {
    77            _.map(nodeIDs, (nid) => (
    78              <Metric
    79                key={nid}
    80                name="cr.store.rebalancing.queriespersecond"
    81                title={nodeDisplayName(nodesSummary, nid)}
    82                sources={storeIDsForNode(nodesSummary, nid)}
    83              />
    84            ))
    85          }
    86        </Axis>
    87      </LineGraph>,
    88  
    89      <LineGraph title="Logical Bytes per Store" tooltip={<LogicalBytesGraphTooltip />}>
    90        <Axis units={AxisUnits.Bytes} label="logical store size">
    91          {
    92            _.map(nodeIDs, (nid) => (
    93              <Metric
    94                key={nid}
    95                name="cr.store.totalbytes"
    96                title={nodeDisplayName(nodesSummary, nid)}
    97                sources={storeIDsForNode(nodesSummary, nid)}
    98              />
    99            ))
   100          }
   101        </Axis>
   102      </LineGraph>,
   103  
   104      <LineGraph title="Replica Quiescence" sources={storeSources}>
   105        <Axis label="replicas">
   106          <Metric name="cr.store.replicas" title="Replicas" />
   107          <Metric name="cr.store.replicas.quiescent" title="Quiescent" />
   108        </Axis>
   109      </LineGraph>,
   110  
   111      <LineGraph title="Range Operations" sources={storeSources}>
   112        <Axis label="ranges">
   113          <Metric name="cr.store.range.splits" title="Splits" nonNegativeRate />
   114          <Metric name="cr.store.range.merges" title="Merges" nonNegativeRate />
   115          <Metric name="cr.store.range.adds" title="Adds" nonNegativeRate />
   116          <Metric name="cr.store.range.removes" title="Removes" nonNegativeRate />
   117          <Metric name="cr.store.leases.transfers.success" title="Lease Transfers" nonNegativeRate />
   118          <Metric name="cr.store.rebalancing.lease.transfers" title="Load-based Lease Transfers" nonNegativeRate />
   119          <Metric name="cr.store.rebalancing.range.rebalances" title="Load-based Range Rebalances" nonNegativeRate />
   120        </Axis>
   121      </LineGraph>,
   122  
   123      <LineGraph title="Snapshots" sources={storeSources}>
   124        <Axis label="snapshots">
   125          <Metric name="cr.store.range.snapshots.generated" title="Generated" nonNegativeRate />
   126          <Metric name="cr.store.range.snapshots.normal-applied" title="Applied (Raft-initiated)" nonNegativeRate />
   127          <Metric name="cr.store.range.snapshots.learner-applied" title="Applied (Learner)" nonNegativeRate />
   128          <Metric name="cr.store.range.snapshots.preemptive-applied" title="Applied (Preemptive)" nonNegativeRate />
   129          <Metric name="cr.store.replicas.reserved" title="Reserved" nonNegativeRate />
   130        </Axis>
   131      </LineGraph>,
   132    ];
   133  }