github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/src/views/cluster/containers/nodeGraphs/dashboards/sql.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 } from "./dashboardUtils";
    18  
    19  export default function (props: GraphDashboardProps) {
    20    const { nodeIDs, nodesSummary, nodeSources, tooltipSelection } = props;
    21  
    22    return [
    23      <LineGraph
    24        title="SQL Connections"
    25        sources={nodeSources}
    26        tooltip={`The total number of active SQL connections ${tooltipSelection}.`}
    27      >
    28        <Axis label="connections">
    29          {
    30            _.map(nodeIDs, (node) => (
    31              <Metric
    32                key={node}
    33                name="cr.node.sql.conns"
    34                title={nodeDisplayName(nodesSummary, node)}
    35                sources={[node]}
    36                downsampleMax
    37              />
    38            ))
    39          }
    40        </Axis>
    41      </LineGraph>,
    42  
    43      <LineGraph
    44        title="SQL Byte Traffic"
    45        sources={nodeSources}
    46        tooltip={
    47          `The total amount of SQL client network traffic in bytes per second ${tooltipSelection}.`
    48        }
    49      >
    50        <Axis units={AxisUnits.Bytes} label="byte traffic">
    51          <Metric name="cr.node.sql.bytesin" title="Bytes In" nonNegativeRate />
    52          <Metric name="cr.node.sql.bytesout" title="Bytes Out" nonNegativeRate />
    53        </Axis>
    54      </LineGraph>,
    55  
    56      <LineGraph
    57        title="SQL Queries"
    58        sources={nodeSources}
    59        tooltip={
    60          `A ten-second moving average of the # of SELECT, INSERT, UPDATE, and DELETE statements
    61          successfully executed per second ${tooltipSelection}.`
    62        }
    63      >
    64        <Axis label="queries">
    65          <Metric name="cr.node.sql.select.count" title="Selects" nonNegativeRate />
    66          <Metric name="cr.node.sql.update.count" title="Updates" nonNegativeRate />
    67          <Metric name="cr.node.sql.insert.count" title="Inserts" nonNegativeRate />
    68          <Metric name="cr.node.sql.delete.count" title="Deletes" nonNegativeRate />
    69        </Axis>
    70      </LineGraph>,
    71  
    72      <LineGraph
    73        title="SQL Query Errors"
    74        sources={nodeSources}
    75        tooltip={"The number of statements which returned a planning or runtime error."}
    76      >
    77        <Axis label="errors">
    78          <Metric name="cr.node.sql.failure.count" title="Errors" nonNegativeRate />
    79        </Axis>
    80      </LineGraph>,
    81  
    82      <LineGraph
    83        title="Active Distributed SQL Queries"
    84        sources={nodeSources}
    85        tooltip={`The total number of distributed SQL queries currently running ${tooltipSelection}.`}
    86      >
    87        <Axis label="queries">
    88          <Metric name="cr.node.sql.distsql.queries.active" title="Active Queries" />
    89        </Axis>
    90      </LineGraph>,
    91  
    92      <LineGraph
    93        title="Active Flows for Distributed SQL Queries"
    94        tooltip="The number of flows on each node contributing to currently running distributed SQL queries."
    95      >
    96        <Axis label="flows">
    97          {
    98            _.map(nodeIDs, (node) => (
    99              <Metric
   100                key={node}
   101                name="cr.node.sql.distsql.flows.active"
   102                title={nodeDisplayName(nodesSummary, node)}
   103                sources={[node]}
   104              />
   105            ))
   106          }
   107        </Axis>
   108      </LineGraph>,
   109  
   110      <LineGraph
   111        title="Service Latency: SQL, 99th percentile"
   112        tooltip={(
   113          <div>
   114            Over the last minute, this node executed 99% of queries within this time.
   115            {" "}
   116            <em>This time does not include network latency between the node and client.</em>
   117          </div>
   118        )}
   119      >
   120        <Axis units={AxisUnits.Duration} label="latency">
   121          {
   122            _.map(nodeIDs, (node) => (
   123              <Metric
   124                key={node}
   125                name="cr.node.sql.service.latency-p99"
   126                title={nodeDisplayName(nodesSummary, node)}
   127                sources={[node]}
   128                downsampleMax
   129              />
   130            ))
   131          }
   132        </Axis>
   133      </LineGraph>,
   134  
   135      <LineGraph
   136        title="Service Latency: SQL, 90th percentile"
   137        tooltip={(
   138          <div>
   139            Over the last minute, this node executed 90% of queries within this time.
   140            {" "}
   141            <em>This time does not include network latency between the node and client.</em>
   142          </div>
   143        )}
   144      >
   145        <Axis units={AxisUnits.Duration} label="latency">
   146          {
   147            _.map(nodeIDs, (node) => (
   148              <Metric
   149                key={node}
   150                name="cr.node.sql.service.latency-p90"
   151                title={nodeDisplayName(nodesSummary, node)}
   152                sources={[node]}
   153                downsampleMax
   154              />
   155            ))
   156          }
   157        </Axis>
   158      </LineGraph>,
   159  
   160      <LineGraph
   161        title="KV Execution Latency: 99th percentile"
   162        tooltip={
   163          `The 99th percentile of latency between query requests and responses over a
   164            1 minute period. Values are displayed individually for each node.`
   165        }
   166      >
   167        <Axis units={AxisUnits.Duration} label="latency">
   168          {
   169            _.map(nodeIDs, (node) => (
   170              <Metric
   171                key={node}
   172                name="cr.node.exec.latency-p99"
   173                title={nodeDisplayName(nodesSummary, node)}
   174                sources={[node]}
   175                downsampleMax
   176              />
   177            ))
   178          }
   179        </Axis>
   180      </LineGraph>,
   181  
   182      <LineGraph
   183        title="KV Execution Latency: 90th percentile"
   184        tooltip={
   185          `The 90th percentile of latency between query requests and responses over a
   186             1 minute period. Values are displayed individually for each node.`
   187        }
   188      >
   189        <Axis units={AxisUnits.Duration} label="latency">
   190          {
   191            _.map(nodeIDs, (node) => (
   192              <Metric
   193                key={node}
   194                name="cr.node.exec.latency-p90"
   195                title={nodeDisplayName(nodesSummary, node)}
   196                sources={[node]}
   197                downsampleMax
   198              />
   199            ))
   200          }
   201        </Axis>
   202      </LineGraph>,
   203  
   204      <LineGraph
   205        title="Transactions"
   206        sources={nodeSources}
   207        tooltip={
   208          `The total number of transactions initiated, committed, rolled back,
   209             or aborted per second ${tooltipSelection}.`
   210        }
   211      >
   212        <Axis label="transactions">
   213          <Metric name="cr.node.sql.txn.begin.count" title="Begin" nonNegativeRate />
   214          <Metric name="cr.node.sql.txn.commit.count" title="Commits" nonNegativeRate />
   215          <Metric name="cr.node.sql.txn.rollback.count" title="Rollbacks" nonNegativeRate />
   216          <Metric name="cr.node.sql.txn.abort.count" title="Aborts" nonNegativeRate />
   217        </Axis>
   218      </LineGraph>,
   219  
   220      <LineGraph
   221        title="Transaction Latency: 99th percentile"
   222        tooltip={
   223          `The 99th percentile of total transaction time over a 1 minute period.
   224          Values are displayed individually for each node.`
   225        }
   226      >
   227        <Axis units={AxisUnits.Duration} label="latency">
   228          {
   229            _.map(nodeIDs, (node) => (
   230              <Metric
   231                key={node}
   232                name="cr.node.sql.txn.latency-p99"
   233                title={nodeDisplayName(nodesSummary, node)}
   234                sources={[node]}
   235                downsampleMax
   236              />
   237            ))
   238          }
   239        </Axis>
   240      </LineGraph>,
   241  
   242      <LineGraph
   243        title="Transaction Latency: 90th percentile"
   244        tooltip={
   245          `The 90th percentile of total transaction time over a 1 minute period.
   246          Values are displayed individually for each node.`
   247        }
   248      >
   249        <Axis units={AxisUnits.Duration} label="latency">
   250          {
   251            _.map(nodeIDs, (node) => (
   252              <Metric
   253                key={node}
   254                name="cr.node.sql.txn.latency-p90"
   255                title={nodeDisplayName(nodesSummary, node)}
   256                sources={[node]}
   257                downsampleMax
   258              />
   259            ))
   260          }
   261        </Axis>
   262      </LineGraph>,
   263  
   264      <LineGraph
   265        title="Schema Changes"
   266        sources={nodeSources}
   267        tooltip={`The total number of DDL statements per second ${tooltipSelection}.`}
   268      >
   269        <Axis label="statements">
   270          <Metric name="cr.node.sql.ddl.count" title="DDL Statements" nonNegativeRate />
   271        </Axis>
   272      </LineGraph>,
   273    ];
   274  }