sqltelemetry

package
v0.0.0-...-1b6ad0c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package sqltelemetry contains telemetry counter definitions for various SQL features.

Centralizing the counters in a single place achieves three objectives:

  • the comments that accompany the counters enable non-technical users to comprehend what is being reported without having to read code.
  • the counters are placed side-by-side, grouped by category, so as to enable exploratory discovery of available telemetry.
  • the counters are pre-registered and their unicity is asserted, so that no two features end up using the same counter name.

Index

Constants

View Source
const (
	// Role is used when the syntax used is the ROLE version (ie. CREATE ROLE).
	Role = "role"
	// User is used when the syntax used is the USER version (ie. CREATE USER).
	User = "user"

	// AlterRole is used when an ALTER ROLE / USER is the operation.
	AlterRole = "alter"
	// CreateRole is used when an CREATE ROLE / USER is the operation.
	CreateRole = "create"
	// OnDatabase is used when a GRANT/REVOKE is happening on a database.
	OnDatabase = "on_database"
	// OnTable is used when a GRANT/REVOKE is happening on a table.
	OnTable = "on_table"
)

Variables

View Source
var (
	// CreateInterleavedTableCounter is to be incremented every time an
	// interleaved table is being created.
	CreateInterleavedTableCounter = telemetry.GetCounterOnce("sql.schema.create_interleaved_table")

	// CreateTempTableCounter is to be incremented every time a TEMP TABLE
	// has been created.
	CreateTempTableCounter = telemetry.GetCounterOnce("sql.schema.create_temp_table")

	// CreateTempSequenceCounter is to be incremented every time a TEMP SEQUENCE
	// has been created.
	CreateTempSequenceCounter = telemetry.GetCounterOnce("sql.schema.create_temp_sequence")

	// CreateTempViewCounter is to be incremented every time a TEMP VIEW
	// has been created.
	CreateTempViewCounter = telemetry.GetCounterOnce("sql.schema.create_temp_view")
)
View Source
var (
	// HashShardedIndexCounter is to be incremented every time a hash
	// sharded index is created.
	HashShardedIndexCounter = telemetry.GetCounterOnce("sql.schema.hash_sharded_index")

	// InvertedIndexCounter is to be incremented every time an inverted
	// index is created.
	InvertedIndexCounter = telemetry.GetCounterOnce("sql.schema.inverted_index")

	// GeographyInvertedIndexCounter is to be incremented every time a
	// geography inverted index is created. These are a subset of the
	// indexes counted in InvertedIndexCounter.
	GeographyInvertedIndexCounter = telemetry.GetCounterOnce("sql.schema.geography_inverted_index")

	// GeometryInvertedIndexCounter is to be incremented every time a
	// geometry inverted index is created. These are a subset of the
	// indexes counted in InvertedIndexCounter.
	GeometryInvertedIndexCounter = telemetry.GetCounterOnce("sql.schema.geometry_inverted_index")
)
View Source
var ArrayCastCounter = telemetry.GetCounterOnce("sql.plan.ops.cast.arrays")

ArrayCastCounter is to be incremented when type checking all casts that involve arrays. This separate telemetry counter is needed because an inter-array cast lands on `sql.plan.ops.cast` telemetry counter for the element type.

View Source
var ArrayConstructorCounter = telemetry.GetCounterOnce("sql.plan.ops.array.cons")

ArrayConstructorCounter is to be incremented upon type checking of ARRAY[...] expressions/

View Source
var ArrayFlattenCounter = telemetry.GetCounterOnce("sql.plan.ops.array.flatten")

ArrayFlattenCounter is to be incremented upon type checking of ARRAY(...) expressions.

View Source
var ArraySubscriptCounter = telemetry.GetCounterOnce("sql.plan.ops.array.ind")

ArraySubscriptCounter is to be incremented upon type checking an array subscript expression x[...].

View Source
var BinaryDecimalInfinityCounter = telemetry.GetCounterOnce("pgwire.#32489.binary_decimal_infinity")

BinaryDecimalInfinityCounter is to be incremented every time a client requests the binary encoding for a decimal infinity, which is not well defined in the pg protocol (#32489).

View Source
var CancelQueriesUseCounter = telemetry.GetCounterOnce("sql.session.cancel-queries")

CancelQueriesUseCounter is to be incremented whenever CANCEL QUERY or CANCEL QUERIES is run.

View Source
var CancelRequestCounter = telemetry.GetCounterOnce("pgwire.unimplemented.cancel_request")

CancelRequestCounter is to be incremented every time a pgwire-level cancel request is received from a client.

View Source
var CancelSessionsUseCounter = telemetry.GetCounterOnce("sql.session.cancel-sessions")

CancelSessionsUseCounter is to be incremented whenever CANCEL SESSION or CANCEL SESSIONS is run.

View Source
var CascadesLimitReached = telemetry.GetCounterOnce("sql.exec.cascade-limit-reached")

CascadesLimitReached is to be incremented whenever the limit of foreign key cascade for a single query is exceeded.

View Source
var CorrelatedSubqueryUseCounter = telemetry.GetCounterOnce("sql.plan.subquery.correlated")

CorrelatedSubqueryUseCounter is to be incremented every time a correlated subquery has been processed during planning.

View Source
var CreateStatisticsUseCounter = telemetry.GetCounterOnce("sql.plan.stats.created")

CreateStatisticsUseCounter is to be incremented whenever a non-automatic run of CREATE STATISTICS occurs.

View Source
var CteUseCounter = telemetry.GetCounterOnce("sql.plan.cte")

CteUseCounter is to be incremented every time a CTE (WITH ...) is planned without error in a query (this includes both recursive and non-recursive CTEs).

View Source
var DefaultIntSize4Counter = telemetry.GetCounterOnce("sql.default_int_size.4")

DefaultIntSize4Counter is to be incremented every time a client change the default_int_size variable to its non-default value 4.

View Source
var DistSQLExecCounter = telemetry.GetCounterOnce("sql.exec.query.is-distributed")

DistSQLExecCounter is to be incremented whenever a query is distributed across multiple nodes.

View Source
var EnumCastCounter = telemetry.GetCounterOnce("sql.plan.ops.cast.enums")

EnumCastCounter is to be incremented when typechecking casts that are between enums.

View Source
var ExplainAnalyzeDebugUseCounter = telemetry.GetCounterOnce("sql.plan.explain-analyze-debug")

ExplainAnalyzeDebugUseCounter is to be incremented whenever EXPLAIN ANALYZE (DEBUG) is run.

View Source
var ExplainAnalyzeUseCounter = telemetry.GetCounterOnce("sql.plan.explain-analyze")

ExplainAnalyzeUseCounter is to be incremented whenever EXPLAIN ANALYZE is run.

View Source
var ExplainDistSQLUseCounter = telemetry.GetCounterOnce("sql.plan.explain-distsql")

ExplainDistSQLUseCounter is to be incremented whenever EXPLAIN (DISTSQL) is run.

View Source
var ExplainOptUseCounter = telemetry.GetCounterOnce("sql.plan.explain-opt")

ExplainOptUseCounter is to be incremented whenever EXPLAIN (OPT) is run.

View Source
var ExplainOptVerboseUseCounter = telemetry.GetCounterOnce("sql.plan.explain-opt-verbose")

ExplainOptVerboseUseCounter is to be incremented whenever EXPLAIN (OPT, VERBOSE) is run.

View Source
var ExplainPlanUseCounter = telemetry.GetCounterOnce("sql.plan.explain")

ExplainPlanUseCounter is to be incremented whenever vanilla EXPLAIN is run.

View Source
var ExplainVecUseCounter = telemetry.GetCounterOnce("sql.plan.explain-vec")

ExplainVecUseCounter is to be incremented whenever EXPLAIN (VEC) is run.

View Source
var ForceSavepointRestartCounter = telemetry.GetCounterOnce("sql.force_savepoint_restart")

ForceSavepointRestartCounter is to be incremented every time a client customizes the session variable force_savepoint_restart to a non-empty string.

View Source
var ForeignKeyCascadesUseCounter = telemetry.GetCounterOnce("sql.plan.fk.cascades")

ForeignKeyCascadesUseCounter is to be incremented every time a mutation involves a cascade.

View Source
var ForeignKeyChecksUseCounter = telemetry.GetCounterOnce("sql.plan.fk.checks")

ForeignKeyChecksUseCounter is to be incremented every time a mutation has foreign key checks and the checks are planned by the optimizer.

View Source
var HashJoinHintUseCounter = telemetry.GetCounterOnce("sql.plan.hints.hash-join")

HashJoinHintUseCounter is to be incremented whenever a query specifies a hash join via a query hint.

View Source
var IfErrCounter = telemetry.GetCounterOnce("sql.plan.ops.iferr")

IfErrCounter is to be incremented upon type checking an IFERROR(...) expression or analogous.

View Source
var IndexHintDeleteUseCounter = telemetry.GetCounterOnce("sql.plan.hints.index.delete")

IndexHintDeleteUseCounter is to be incremented whenever a query specifies an index hint in a DELETE.

View Source
var IndexHintSelectUseCounter = telemetry.GetCounterOnce("sql.plan.hints.index.select")

IndexHintSelectUseCounter is to be incremented whenever a query specifies an index hint in a SELECT.

View Source
var IndexHintUpdateUseCounter = telemetry.GetCounterOnce("sql.plan.hints.index.update")

IndexHintUpdateUseCounter is to be incremented whenever a query specifies an index hint in an UPDATE.

View Source
var IndexHintUseCounter = telemetry.GetCounterOnce("sql.plan.hints.index")

IndexHintUseCounter is to be incremented whenever a query specifies an index hint. Incremented whenever one of the more specific variants below is incremented.

View Source
var InterleavedPortalRequestCounter = telemetry.GetCounterOnce("pgwire.#40195.interleaved_portal")

InterleavedPortalRequestCounter is to be incremented every time an open portal attempts to interleave work with another portal.

View Source
var InterleavedTableJoinCounter = telemetry.GetCounterOnce("sql.plan.interleaved-table-join")

InterleavedTableJoinCounter is to be incremented whenever an InterleavedTableJoin is planned.

View Source
var JoinAlgoCrossUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.algo.cross")

JoinAlgoCrossUseCounter is to be incremented whenever a cross join node is planned.

View Source
var JoinAlgoHashUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.algo.hash")

JoinAlgoHashUseCounter is to be incremented whenever a hash join node is planned.

View Source
var JoinAlgoLookupUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.algo.lookup")

JoinAlgoLookupUseCounter is to be incremented whenever a lookup join node is planned.

View Source
var JoinAlgoMergeUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.algo.merge")

JoinAlgoMergeUseCounter is to be incremented whenever a merge join node is planned.

View Source
var JoinTypeAntiUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.anti")

JoinTypeAntiUseCounter is to be incremented whenever an anti-join node is planned.

View Source
var JoinTypeFullUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.full-outer")

JoinTypeFullUseCounter is to be incremented whenever a full outer join node is planned.

View Source
var JoinTypeInnerUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.inner")

JoinTypeInnerUseCounter is to be incremented whenever an inner join node is planned.

View Source
var JoinTypeLeftUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.left-outer")

JoinTypeLeftUseCounter is to be incremented whenever a left or right outer join node is planned.

View Source
var JoinTypeSemiUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.semi")

JoinTypeSemiUseCounter is to be incremented whenever a semi-join node is planned.

View Source
var LargeLShiftArgumentCounter = telemetry.GetCounterOnce("sql.large_lshift_argument")

LargeLShiftArgumentCounter is to be incremented upon evaluating a scalar expressions a << b when b is larger than 64 or negative.

View Source
var LargeRShiftArgumentCounter = telemetry.GetCounterOnce("sql.large_rshift_argument")

LargeRShiftArgumentCounter is to be incremented upon evaluating a scalar expressions a >> b when b is larger than 64 or negative.

View Source
var LateralJoinUseCounter = telemetry.GetCounterOnce("sql.plan.lateral-join")

LateralJoinUseCounter is to be incremented whenever a query uses the LATERAL keyword.

View Source
var LookupJoinHintUseCounter = telemetry.GetCounterOnce("sql.plan.hints.lookup-join")

LookupJoinHintUseCounter is to be incremented whenever a query specifies a lookup join via a query hint.

View Source
var MergeJoinHintUseCounter = telemetry.GetCounterOnce("sql.plan.hints.merge-join")

MergeJoinHintUseCounter is to be incremented whenever a query specifies a merge join via a query hint.

View Source
var PortalWithLimitRequestCounter = telemetry.GetCounterOnce("pgwire.portal_with_limit_request")

PortalWithLimitRequestCounter is to be incremented every time a portal request is made.

View Source
var RecursiveCteUseCounter = telemetry.GetCounterOnce("sql.plan.cte.recursive")

RecursiveCteUseCounter is to be incremented every time a recursive CTE (WITH RECURSIVE...) is planned without error in a query.

View Source
var SchemaChangeInExplicitTxnCounter = telemetry.GetCounterOnce("sql.schema.change_in_explicit_txn")

SchemaChangeInExplicitTxnCounter is to be incremented every time a schema change is scheduled using an explicit transaction.

View Source
var SecondaryIndexColumnFamiliesCounter = telemetry.GetCounterOnce("sql.schema.secondary_index_column_families")

SecondaryIndexColumnFamiliesCounter is a counter that is incremented every time a secondary index that is separated into different column families is created.

View Source
var StatementDiagnosticsCollectedCounter = telemetry.GetCounterOnce("sql.diagnostics.collected")

StatementDiagnosticsCollectedCounter is to be incremented whenever a query is run with diagnostic collection (as a result of a user request through the UI). This does not include diagnostics collected through EXPLAIN ANALYZE (DEBUG), which has a separate counter. distributed across multiple nodes.

View Source
var StatsHistogramOOMCounter = telemetry.GetCounterOnce("sql.plan.stats.histogram-oom")

StatsHistogramOOMCounter is to be incremented whenever statistics histogram generation is disabled due to an out of memory error.

View Source
var SubqueryUseCounter = telemetry.GetCounterOnce("sql.plan.subquery")

SubqueryUseCounter is to be incremented every time a subquery is planned.

View Source
var (
	// TempObjectCleanerDeletionCounter is to be incremented every time a temporary schema
	// has been deleted by the temporary object cleaner.
	TempObjectCleanerDeletionCounter = telemetry.GetCounterOnce("sql.schema.temp_object_cleaner.num_cleaned")
)
View Source
var TurnAuthAuditingOffUseCounter = telemetry.GetCounterOnce("auditing.authentication.disabled")

TurnAuthAuditingOffUseCounter counts how many time connection audit logs were disabled.

View Source
var TurnAuthAuditingOnUseCounter = telemetry.GetCounterOnce("auditing.authentication.enabled")

TurnAuthAuditingOnUseCounter counts how many time connection audit logs were enabled.

View Source
var TurnAutoStatsOffUseCounter = telemetry.GetCounterOnce("sql.plan.automatic-stats.disabled")

TurnAutoStatsOffUseCounter is to be incremented whenever automatic stats collection is explicitly disabled.

View Source
var TurnAutoStatsOnUseCounter = telemetry.GetCounterOnce("sql.plan.automatic-stats.enabled")

TurnAutoStatsOnUseCounter is to be incremented whenever automatic stats collection is explicitly enabled.

View Source
var TurnConnAuditingOffUseCounter = telemetry.GetCounterOnce("auditing.connection.disabled")

TurnConnAuditingOffUseCounter counts how many time connection audit logs were disabled.

View Source
var TurnConnAuditingOnUseCounter = telemetry.GetCounterOnce("auditing.connection.enabled")

TurnConnAuditingOnUseCounter counts how many time connection audit logs were enabled.

View Source
var UncategorizedErrorCounter = telemetry.GetCounterOnce("othererror." + pgcode.Uncategorized.String())

UncategorizedErrorCounter is to be incremented every time an error flows to the client without having been decorated with a pg error.

View Source
var VecExecCounter = telemetry.GetCounterOnce("sql.exec.query.is-vectorized")

VecExecCounter is to be incremented whenever a query runs with the vectorized execution engine.

Functions

func BinOpCounter

func BinOpCounter(op, ltyp, rtyp string) telemetry.Counter

BinOpCounter creates a telemetry counter for a scalar binary operator. This is to be incremented upon type checking of this type of scalar operation.

func BuiltinCounter

func BuiltinCounter(name, signature string) telemetry.Counter

BuiltinCounter creates a telemetry counter for a built-in function. This is to be incremented upon type checking of a function application.

func CastOpCounter

func CastOpCounter(ftyp, ttyp string) telemetry.Counter

CastOpCounter creates a telemetry counter for a scalar cast operator. This is to be incremented upon type checking of this type of scalar operation.

func CmpOpCounter

func CmpOpCounter(op, ltyp, rtyp string) telemetry.Counter

CmpOpCounter creates a telemetry counter for a scalar comparison operator. This is to be incremented upon type checking of this type of scalar operation.

func IncIAMAlterCounter

func IncIAMAlterCounter(typ string)

IncIAMAlterCounter is to be incremented every time an ALTER ROLE happens.

func IncIAMCreateCounter

func IncIAMCreateCounter(typ string)

IncIAMCreateCounter is to be incremented every time a CREATE ROLE happens.

func IncIAMDropCounter

func IncIAMDropCounter(typ string)

IncIAMDropCounter is to be incremented every time a DROP ROLE happens.

func IncIAMGrantCounter

func IncIAMGrantCounter(withAdmin bool)

IncIAMGrantCounter is to be incremented every time a GRANT ROLE happens.

func IncIAMGrantPrivilegesCounter

func IncIAMGrantPrivilegesCounter(on string)

IncIAMGrantPrivilegesCounter is to be incremented every time a GRANT <privileges> happens.

func IncIAMOptionCounter

func IncIAMOptionCounter(opName string, option string)

IncIAMOptionCounter is to be incremented every time a CREATE/ALTER role with an OPTION (ie. NOLOGIN) happens.

func IncIAMRevokeCounter

func IncIAMRevokeCounter(withAdmin bool)

IncIAMRevokeCounter is to be incremented every time a REVOKE ROLE happens.

func IncIAMRevokePrivilegesCounter

func IncIAMRevokePrivilegesCounter(on string)

IncIAMRevokePrivilegesCounter is to be incremented every time a REVOKE <privileges> happens.

func IncrementPartitioningCounter

func IncrementPartitioningCounter(partitioningType PartitioningTelemetryType)

IncrementPartitioningCounter is used to increment the telemetry counter for a particular partitioning operation.

func IncrementShowCounter

func IncrementShowCounter(showType ShowTelemetryType)

IncrementShowCounter is used to increment the telemetry counter for a particular show command.

func OptNodeCounter

func OptNodeCounter(nodeType string) telemetry.Counter

OptNodeCounter should be incremented every time a node of the given type is encountered at the end of the query optimization (i.e. it counts the nodes actually used for physical planning).

func RecordError

func RecordError(ctx context.Context, err error, sv *settings.Values)

RecordError processes a SQL error. This includes both incrementing telemetry counters, and sending a sentry report for internal (assertion) errors.

func ReportJoinReorderLimit

func ReportJoinReorderLimit(value int)

ReportJoinReorderLimit is to be called whenever the reorder joins session variable is set.

func SchemaChangeAlterCounter

func SchemaChangeAlterCounter(typ string) telemetry.Counter

SchemaChangeAlterCounter behaves the same as SchemaChangeAlterCounterWithExtra but with no extra metadata.

func SchemaChangeAlterCounterWithExtra

func SchemaChangeAlterCounterWithExtra(typ string, extra string) telemetry.Counter

SchemaChangeAlterCounterWithExtra is to be incremented for ALTER schema changes. `typ` is for declaring which type was altered, e.g. TABLE, DATABASE. `extra` can be used for extra trailing useful metadata.

func SchemaChangeCreateCounter

func SchemaChangeCreateCounter(typ string) telemetry.Counter

SchemaChangeCreateCounter is to be incremented every time a CREATE schema change was made.

func SchemaChangeDropCounter

func SchemaChangeDropCounter(typ string) telemetry.Counter

SchemaChangeDropCounter is to be incremented every time a DROP schema change was made.

func SchemaJobControlCounter

func SchemaJobControlCounter(desiredStatus string) telemetry.Counter

SchemaJobControlCounter is to be incremented every time a job control action is taken.

func SchemaNewColumnTypeQualificationCounter

func SchemaNewColumnTypeQualificationCounter(qual string) telemetry.Counter

SchemaNewColumnTypeQualificationCounter is to be incremented every time a new qualification is used for a newly created column.

func SchemaNewTypeCounter

func SchemaNewTypeCounter(t string) telemetry.Counter

SchemaNewTypeCounter is to be incremented every time a new data type is used in a schema, i.e. by CREATE TABLE or ALTER TABLE ADD COLUMN.

func SchemaSetAuditModeCounter

func SchemaSetAuditModeCounter(mode string) telemetry.Counter

SchemaSetAuditModeCounter is to be incremented every time an audit mode is set.

func SchemaSetZoneConfigCounter

func SchemaSetZoneConfigCounter(configName, keyChange string) telemetry.Counter

SchemaSetZoneConfigCounter is to be incremented every time a ZoneConfig argument is parsed.

func SerialColumnNormalizationCounter

func SerialColumnNormalizationCounter(inputType, normType string) telemetry.Counter

SerialColumnNormalizationCounter is to be incremented every time a SERIAL type is processed in a column definition. It includes the normalization type, so we can estimate usage of the various normalization strategies.

func UnaryOpCounter

func UnaryOpCounter(op, typ string) telemetry.Counter

UnaryOpCounter creates a telemetry counter for a scalar unary operator. This is to be incremented upon type checking of this type of scalar operation.

func UnimplementedClientStatusParameterCounter

func UnimplementedClientStatusParameterCounter(key string) telemetry.Counter

UnimplementedClientStatusParameterCounter is to be incremented every time a client attempts to configure a status parameter that's not supported upon session initialization.

func UnimplementedSessionVarValueCounter

func UnimplementedSessionVarValueCounter(varName, val string) telemetry.Counter

UnimplementedSessionVarValueCounter is to be incremented every time a client attempts to set a compatitibility session var to an unsupported value.

func VecModeCounter

func VecModeCounter(mode string) telemetry.Counter

VecModeCounter is to be incremented every time the vectorized execution mode is changed (including turned off).

func WindowFunctionCounter

func WindowFunctionCounter(wf string) telemetry.Counter

WindowFunctionCounter is to be incremented every time a window function is being planned.

Types

type PartitioningTelemetryType

type PartitioningTelemetryType int

PartitioningTelemetryType is an enum used to represent the different partitioning related operations that we are recording telemetry for.

const (

	// AlterAllPartitions represents an ALTER ALL PARTITIONS
	// statement (ALTER PARTITION OF INDEX t@*)
	AlterAllPartitions PartitioningTelemetryType
	// PartitionConstrainedScan represents when the optimizer was
	// able to use partitioning to constrain a scan.
	PartitionConstrainedScan
)

func (PartitioningTelemetryType) String

func (p PartitioningTelemetryType) String() string

type ShowTelemetryType

type ShowTelemetryType int

ShowTelemetryType is an enum used to represent the different show commands that we are recording telemetry for.

const (

	// Ranges represents the SHOW RANGES command.
	Ranges ShowTelemetryType
	// Partitions represents the SHOW PARTITIONS command.
	Partitions
	// Locality represents the SHOW LOCALITY command.
	Locality
	// Create represents the SHOW CREATE command.
	Create
	// RangeForRow represents the SHOW RANGE FOR ROW command.
	RangeForRow
	// Queries represents the SHOW QUERIES command.
	Queries
	// Indexes represents the SHOW INDEXES command.
	Indexes
	// Constraints represents the SHOW CONSTRAINTS command.
	Constraints
	// Jobs represents the SHOW JOBS command.
	Jobs
	// Roles represents the SHOW ROLES command.
	Roles
)

func (ShowTelemetryType) String

func (s ShowTelemetryType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL