Documentation
¶
Index ¶
- type Controller
- type SQLStats
- func (s *SQLStats) AddAppStats(ctx context.Context, appName string, other *ssmemstorage.Container) error
- func (s *SQLStats) GetApplicationStats(appName string) sqlstats.ApplicationStats
- func (s *SQLStats) GetController(server serverpb.SQLStatusServer, db *kv.DB, ie sqlutil.InternalExecutor) *Controller
- func (s *SQLStats) GetLastReset() time.Time
- func (s *SQLStats) GetTotalFingerprintBytes() int64
- func (s *SQLStats) GetTotalFingerprintCount() int64
- func (s *SQLStats) IterateAggregatedTransactionStats(ctx context.Context, options *sqlstats.IteratorOptions, ...) error
- func (s *SQLStats) IterateStatementStats(ctx context.Context, options *sqlstats.IteratorOptions, ...) error
- func (s *SQLStats) IterateTransactionStats(ctx context.Context, options *sqlstats.IteratorOptions, ...) error
- func (s *SQLStats) Reset(ctx context.Context) error
- func (s *SQLStats) Start(ctx context.Context, stopper *stop.Stopper)
- func (s *SQLStats) StmtStatsIterator(options *sqlstats.IteratorOptions) *StmtStatsIterator
- func (s *SQLStats) TxnStatsIterator(options *sqlstats.IteratorOptions) *TxnStatsIterator
- type Sink
- type StatsCollector
- func (s *StatsCollector) EndExplicitTransaction(ctx context.Context, transactionFingerprintID roachpb.TransactionFingerprintID)
- func (s *StatsCollector) PhaseTimes() *sessionphase.Times
- func (s *StatsCollector) PreviousPhaseTimes() *sessionphase.Times
- func (s *StatsCollector) Reset(appStats sqlstats.ApplicationStats, phaseTime *sessionphase.Times)
- func (s *StatsCollector) ShouldSaveLogicalPlanDesc(fingerprint string, implicitTxn bool, database string) bool
- func (s *StatsCollector) StartExplicitTransaction()
- type StmtStatsIterator
- type TxnStatsIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements the SQL Stats subsystem control plane. This exposes administrative interfaces that can be consumed by other parts of the database (e.g. status server, builtins) to control the behavior of the SQL Stats subsystem.
func NewController ¶
func NewController(sqlStats *SQLStats, status serverpb.SQLStatusServer) *Controller
NewController returns a new instance of sqlstats.Controller.
func (*Controller) ResetClusterSQLStats ¶
func (s *Controller) ResetClusterSQLStats(ctx context.Context) error
ResetClusterSQLStats implements the tree.SQLStatsController interface.
func (*Controller) ResetLocalSQLStats ¶
func (s *Controller) ResetLocalSQLStats(ctx context.Context)
ResetLocalSQLStats resets the node-local sql stats.
type SQLStats ¶
type SQLStats struct {
// contains filtered or unexported fields
}
SQLStats carries per-application in-memory statistics for all applications.
func New ¶
func New( settings *cluster.Settings, maxStmtFingerprints *settings.IntSetting, maxTxnFingerprints *settings.IntSetting, curMemoryBytesCount *metric.Gauge, maxMemoryBytesHist *metric.Histogram, pool *mon.BytesMonitor, reportingSink Sink, knobs *sqlstats.TestingKnobs, ) *SQLStats
New returns an instance of SQLStats.
func NewTempSQLStatsFromExistingStmtStats ¶
func NewTempSQLStatsFromExistingStmtStats( statistics []serverpb.StatementsResponse_CollectedStatementStatistics, ) (*SQLStats, error)
NewTempSQLStatsFromExistingStmtStats returns an instance of SQLStats populated from the provided slice of roachpb.CollectedStatementStatistics.
This constructor returns a variant of SQLStats which is used to aggregate RPC-fanout results. This means that, unliked the regular SQLStats, whose lifetime is same as the sql.Server, the lifetime of this variant is only as long as the duration of the RPC request itself. This is why it bypasses the existing memory accounting infrastructure and fingerprint cluster limit.
func NewTempSQLStatsFromExistingTxnStats ¶
func NewTempSQLStatsFromExistingTxnStats( statistics []serverpb.StatementsResponse_ExtendedCollectedTransactionStatistics, ) (*SQLStats, error)
NewTempSQLStatsFromExistingTxnStats returns an instance of SQLStats populated from the provided slice of CollectedTransactionStatistics.
This constructor returns a variant of SQLStats which is used to aggregate RPC-fanout results. This means that, unliked the regular SQLStats, whose lifetime is same as the sql.Server, the lifetime of this variant is only as long as the duration of the RPC request itself. This is why it bypasses the existing memory accounting infrastructure and fingerprint cluster limit.
func (*SQLStats) AddAppStats ¶
func (s *SQLStats) AddAppStats( ctx context.Context, appName string, other *ssmemstorage.Container, ) error
AddAppStats implements the Sink interface.
func (*SQLStats) GetApplicationStats ¶
func (s *SQLStats) GetApplicationStats(appName string) sqlstats.ApplicationStats
GetApplicationStats implements sqlstats.Provider interface.
func (*SQLStats) GetController ¶
func (s *SQLStats) GetController( server serverpb.SQLStatusServer, db *kv.DB, ie sqlutil.InternalExecutor, ) *Controller
GetController returns a sqlstats.Controller responsible for the current SQLStats.
func (*SQLStats) GetLastReset ¶
GetLastReset implements sqlstats.Provider interface.
func (*SQLStats) GetTotalFingerprintBytes ¶
GetTotalFingerprintBytes returns the total amount of bytes currently allocated for storing statistics for both statement and transaction fingerprints.
func (*SQLStats) GetTotalFingerprintCount ¶
GetTotalFingerprintCount returns total number of unique statement and transaction fingerprints stored in the currnet SQLStats.
func (*SQLStats) IterateAggregatedTransactionStats ¶
func (s *SQLStats) IterateAggregatedTransactionStats( ctx context.Context, options *sqlstats.IteratorOptions, visitor sqlstats.AggregatedTransactionVisitor, ) error
IterateAggregatedTransactionStats implements sqlstats.Provider interface.
func (*SQLStats) IterateStatementStats ¶
func (s *SQLStats) IterateStatementStats( ctx context.Context, options *sqlstats.IteratorOptions, visitor sqlstats.StatementVisitor, ) error
IterateStatementStats implements sqlstats.Provider interface.
func (*SQLStats) IterateTransactionStats ¶
func (s *SQLStats) IterateTransactionStats( ctx context.Context, options *sqlstats.IteratorOptions, visitor sqlstats.TransactionVisitor, ) error
IterateTransactionStats implements sqlstats.Provider interface.
func (*SQLStats) StmtStatsIterator ¶
func (s *SQLStats) StmtStatsIterator(options *sqlstats.IteratorOptions) *StmtStatsIterator
StmtStatsIterator returns an instance of sslocal.StmtStatsIterator for the current SQLStats.
func (*SQLStats) TxnStatsIterator ¶
func (s *SQLStats) TxnStatsIterator(options *sqlstats.IteratorOptions) *TxnStatsIterator
TxnStatsIterator returns an instance of sslocal.TxnStatsIterator for the current SQLStats.
type Sink ¶
type Sink interface {
// AddAppStats ingests a single ssmemstorage.Container for a given appName.
AddAppStats(ctx context.Context, appName string, other *ssmemstorage.Container) error
}
Sink provides clients with interfaces to send statistics data into the sink.
type StatsCollector ¶
type StatsCollector struct {
sqlstats.ApplicationStats
// contains filtered or unexported fields
}
StatsCollector is used to collect statement and transaction statistics from connExecutor.
func NewStatsCollector ¶
func NewStatsCollector( st *cluster.Settings, appStats sqlstats.ApplicationStats, phaseTime *sessionphase.Times, knobs *sqlstats.TestingKnobs, ) *StatsCollector
NewStatsCollector returns an instance of sqlstats.StatsCollector.
func (*StatsCollector) EndExplicitTransaction ¶
func (s *StatsCollector) EndExplicitTransaction( ctx context.Context, transactionFingerprintID roachpb.TransactionFingerprintID, )
EndExplicitTransaction implements sqlstats.StatsCollector interface.
func (*StatsCollector) PhaseTimes ¶
func (s *StatsCollector) PhaseTimes() *sessionphase.Times
PhaseTimes implements sqlstats.StatsCollector interface.
func (*StatsCollector) PreviousPhaseTimes ¶
func (s *StatsCollector) PreviousPhaseTimes() *sessionphase.Times
PreviousPhaseTimes implements sqlstats.StatsCollector interface.
func (*StatsCollector) Reset ¶
func (s *StatsCollector) Reset(appStats sqlstats.ApplicationStats, phaseTime *sessionphase.Times)
Reset implements sqlstats.StatsCollector interface.
func (*StatsCollector) ShouldSaveLogicalPlanDesc ¶
func (s *StatsCollector) ShouldSaveLogicalPlanDesc( fingerprint string, implicitTxn bool, database string, ) bool
ShouldSaveLogicalPlanDesc implements sqlstats.StatsCollector interface.
func (*StatsCollector) StartExplicitTransaction ¶
func (s *StatsCollector) StartExplicitTransaction()
StartExplicitTransaction implements sqlstats.StatsCollector interface.
type StmtStatsIterator ¶
type StmtStatsIterator struct {
// contains filtered or unexported fields
}
StmtStatsIterator is an iterator that can be used to iterate over the statement statistics stored in SQLStats.
func NewStmtStatsIterator ¶
func NewStmtStatsIterator(s *SQLStats, options *sqlstats.IteratorOptions) *StmtStatsIterator
NewStmtStatsIterator returns a new instance of the StmtStatsIterator.
func (*StmtStatsIterator) Cur ¶
func (s *StmtStatsIterator) Cur() *roachpb.CollectedStatementStatistics
Cur returns the roachpb.CollectedStatementStatistics at the current internal counter.
func (*StmtStatsIterator) Next ¶
func (s *StmtStatsIterator) Next() bool
Next increments the internal counter of the StmtStatsIterator. It returns true if the following Cur() call is valid, false otherwise.
This iterator iterates through a slice of appNames that it stores. For each appName in the slice, it creates an iterator that iterate through the ssmemstorage.Container for that appName.
type TxnStatsIterator ¶
type TxnStatsIterator struct {
// contains filtered or unexported fields
}
TxnStatsIterator is an iterator that can be used to iterate over the statement statistics stored in SQLStats.
func NewTxnStatsIterator ¶
func NewTxnStatsIterator(s *SQLStats, options *sqlstats.IteratorOptions) *TxnStatsIterator
NewTxnStatsIterator returns a new instance of the TxnStatsIterator.
func (*TxnStatsIterator) Cur ¶
func (t *TxnStatsIterator) Cur() *roachpb.CollectedTransactionStatistics
Cur returns the roachpb.CollectedTransactionStatistics at the current internal counter.
func (*TxnStatsIterator) Next ¶
func (t *TxnStatsIterator) Next() bool
Next increments the internal counter of the TxnStatsIterator. It returns true if the following Cur() call is valid, false otherwise.
This iterator iterates through a slice of appNames that it stores. For each appName in the slice, it creates an iterator that iterate through the ssmemstorage.Container for that appName.