cockroach: github.com/cockroachdb/cockroach/pkg/sql/stmtdiagnostics Index | Files

package stmtdiagnostics

import "github.com/cockroachdb/cockroach/pkg/sql/stmtdiagnostics"

Index

Package Files

statement_diagnostics.go

type Registry Uses

type Registry struct {
    // contains filtered or unexported fields
}

Registry maintains a view on the statement fingerprints on which data is to be collected (i.e. system.statement_diagnostics_requests) and provides utilities for checking a query against this list and satisfying the requests.

func NewRegistry Uses

func NewRegistry(
    ie sqlutil.InternalExecutor, db *kv.DB, gw gossip.OptionalGossip, st *cluster.Settings,
) *Registry

NewRegistry constructs a new Registry.

func (*Registry) InsertRequest Uses

func (r *Registry) InsertRequest(ctx context.Context, fprint string) error

InsertRequest is part of the StmtDiagnosticsRequester interface.

func (*Registry) InsertStatementDiagnostics Uses

func (r *Registry) InsertStatementDiagnostics(
    ctx context.Context, stmtFingerprint string, stmt string, traceJSON tree.Datum, bundle []byte,
) (int64, error)

InsertStatementDiagnostics inserts a trace into system.statement_diagnostics.

traceJSON is either DNull (when collectionErr should not be nil) or a *DJSON.

func (*Registry) ShouldCollectDiagnostics Uses

func (r *Registry) ShouldCollectDiagnostics(
    ctx context.Context, ast tree.Statement,
) (bool, func(ctx context.Context, traceJSON tree.Datum, bundle []byte, collectionErr error))

ShouldCollectDiagnostics checks whether any data should be collected for the given query, which is the case if the registry has a request for this statement's fingerprint; in this case ShouldCollectDiagnostics will not return true again on this note for the same diagnostics request.

If data is to be collected, Finish() must always be called on the returned stmtDiagnosticsHelper once the data was collected.

func (*Registry) Start Uses

func (r *Registry) Start(ctx context.Context, stopper *stop.Stopper)

Start will start the polling loop for the Registry.

Package stmtdiagnostics imports 19 packages (graph) and is imported by 4 packages. Updated 2020-08-12. Refresh now. Tools for package owners.