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
- Variables
- func BinOpCounter(op, ltyp, rtyp string) telemetry.Counter
- func BuiltinCounter(name, signature string) telemetry.Counter
- func CastOpCounter(ftyp, ttyp string) telemetry.Counter
- func CmpOpCounter(op, ltyp, rtyp string) telemetry.Counter
- func IncIAMAlterCounter(typ string)
- func IncIAMCreateCounter(typ string)
- func IncIAMDropCounter(typ string)
- func IncIAMGrantCounter(withAdmin bool)
- func IncIAMGrantPrivilegesCounter(on string)
- func IncIAMOptionCounter(opName string, option string)
- func IncIAMRevokeCounter(withAdmin bool)
- func IncIAMRevokePrivilegesCounter(on string)
- func IncrementPartitioningCounter(partitioningType PartitioningTelemetryType)
- func IncrementShowCounter(showType ShowTelemetryType)
- func OptNodeCounter(nodeType string) telemetry.Counter
- func RecordError(ctx context.Context, err error, sv *settings.Values)
- func ReportJoinReorderLimit(value int)
- func SchemaChangeAlterCounter(typ string) telemetry.Counter
- func SchemaChangeAlterCounterWithExtra(typ string, extra string) telemetry.Counter
- func SchemaChangeCreateCounter(typ string) telemetry.Counter
- func SchemaChangeDropCounter(typ string) telemetry.Counter
- func SchemaJobControlCounter(desiredStatus string) telemetry.Counter
- func SchemaNewColumnTypeQualificationCounter(qual string) telemetry.Counter
- func SchemaNewTypeCounter(t string) telemetry.Counter
- func SchemaSetAuditModeCounter(mode string) telemetry.Counter
- func SchemaSetZoneConfigCounter(configName, keyChange string) telemetry.Counter
- func SerialColumnNormalizationCounter(inputType, normType string) telemetry.Counter
- func UnaryOpCounter(op, typ string) telemetry.Counter
- func UnimplementedClientStatusParameterCounter(key string) telemetry.Counter
- func UnimplementedSessionVarValueCounter(varName, val string) telemetry.Counter
- func VecModeCounter(mode string) telemetry.Counter
- func WindowFunctionCounter(wf string) telemetry.Counter
- type PartitioningTelemetryType
- type ShowTelemetryType
Constants ¶
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 ¶
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") )
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") )
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.
var ArrayConstructorCounter = telemetry.GetCounterOnce("sql.plan.ops.array.cons")
ArrayConstructorCounter is to be incremented upon type checking of ARRAY[...] expressions/
var ArrayFlattenCounter = telemetry.GetCounterOnce("sql.plan.ops.array.flatten")
ArrayFlattenCounter is to be incremented upon type checking of ARRAY(...) expressions.
var ArraySubscriptCounter = telemetry.GetCounterOnce("sql.plan.ops.array.ind")
ArraySubscriptCounter is to be incremented upon type checking an array subscript expression x[...].
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).
var CancelQueriesUseCounter = telemetry.GetCounterOnce("sql.session.cancel-queries")
CancelQueriesUseCounter is to be incremented whenever CANCEL QUERY or CANCEL QUERIES is run.
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.
var CancelSessionsUseCounter = telemetry.GetCounterOnce("sql.session.cancel-sessions")
CancelSessionsUseCounter is to be incremented whenever CANCEL SESSION or CANCEL SESSIONS is run.
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.
CorrelatedSubqueryUseCounter is to be incremented every time a correlated subquery has been processed during planning.
var CreateStatisticsUseCounter = telemetry.GetCounterOnce("sql.plan.stats.created")
CreateStatisticsUseCounter is to be incremented whenever a non-automatic run of CREATE STATISTICS occurs.
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).
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.
var DistSQLExecCounter = telemetry.GetCounterOnce("sql.exec.query.is-distributed")
DistSQLExecCounter is to be incremented whenever a query is distributed across multiple nodes.
var EnumCastCounter = telemetry.GetCounterOnce("sql.plan.ops.cast.enums")
EnumCastCounter is to be incremented when typechecking casts that are between enums.
var ExplainAnalyzeDebugUseCounter = telemetry.GetCounterOnce("sql.plan.explain-analyze-debug")
ExplainAnalyzeDebugUseCounter is to be incremented whenever EXPLAIN ANALYZE (DEBUG) is run.
var ExplainAnalyzeUseCounter = telemetry.GetCounterOnce("sql.plan.explain-analyze")
ExplainAnalyzeUseCounter is to be incremented whenever EXPLAIN ANALYZE is run.
var ExplainDistSQLUseCounter = telemetry.GetCounterOnce("sql.plan.explain-distsql")
ExplainDistSQLUseCounter is to be incremented whenever EXPLAIN (DISTSQL) is run.
var ExplainOptUseCounter = telemetry.GetCounterOnce("sql.plan.explain-opt")
ExplainOptUseCounter is to be incremented whenever EXPLAIN (OPT) is run.
var ExplainOptVerboseUseCounter = telemetry.GetCounterOnce("sql.plan.explain-opt-verbose")
ExplainOptVerboseUseCounter is to be incremented whenever EXPLAIN (OPT, VERBOSE) is run.
var ExplainPlanUseCounter = telemetry.GetCounterOnce("sql.plan.explain")
ExplainPlanUseCounter is to be incremented whenever vanilla EXPLAIN is run.
var ExplainVecUseCounter = telemetry.GetCounterOnce("sql.plan.explain-vec")
ExplainVecUseCounter is to be incremented whenever EXPLAIN (VEC) is run.
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.
var ForeignKeyCascadesUseCounter = telemetry.GetCounterOnce("sql.plan.fk.cascades")
ForeignKeyCascadesUseCounter is to be incremented every time a mutation involves a cascade.
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.
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.
var IfErrCounter = telemetry.GetCounterOnce("sql.plan.ops.iferr")
IfErrCounter is to be incremented upon type checking an IFERROR(...) expression or analogous.
var IndexHintDeleteUseCounter = telemetry.GetCounterOnce("sql.plan.hints.index.delete")
IndexHintDeleteUseCounter is to be incremented whenever a query specifies an index hint in a DELETE.
var IndexHintSelectUseCounter = telemetry.GetCounterOnce("sql.plan.hints.index.select")
IndexHintSelectUseCounter is to be incremented whenever a query specifies an index hint in a SELECT.
var IndexHintUpdateUseCounter = telemetry.GetCounterOnce("sql.plan.hints.index.update")
IndexHintUpdateUseCounter is to be incremented whenever a query specifies an index hint in an UPDATE.
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.
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.
var InterleavedTableJoinCounter = telemetry.GetCounterOnce("sql.plan.interleaved-table-join")
InterleavedTableJoinCounter is to be incremented whenever an InterleavedTableJoin is planned.
var JoinAlgoCrossUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.algo.cross")
JoinAlgoCrossUseCounter is to be incremented whenever a cross join node is planned.
var JoinAlgoHashUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.algo.hash")
JoinAlgoHashUseCounter is to be incremented whenever a hash join node is planned.
var JoinAlgoLookupUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.algo.lookup")
JoinAlgoLookupUseCounter is to be incremented whenever a lookup join node is planned.
var JoinAlgoMergeUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.algo.merge")
JoinAlgoMergeUseCounter is to be incremented whenever a merge join node is planned.
var JoinTypeAntiUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.anti")
JoinTypeAntiUseCounter is to be incremented whenever an anti-join node is planned.
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.
var JoinTypeInnerUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.inner")
JoinTypeInnerUseCounter is to be incremented whenever an inner join node is planned.
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.
var JoinTypeSemiUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.semi")
JoinTypeSemiUseCounter is to be incremented whenever a semi-join node is planned.
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.
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.
var LateralJoinUseCounter = telemetry.GetCounterOnce("sql.plan.lateral-join")
LateralJoinUseCounter is to be incremented whenever a query uses the LATERAL keyword.
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.
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.
var PortalWithLimitRequestCounter = telemetry.GetCounterOnce("pgwire.portal_with_limit_request")
PortalWithLimitRequestCounter is to be incremented every time a portal request is made.
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.
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.
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.
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.
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.
var SubqueryUseCounter = telemetry.GetCounterOnce("sql.plan.subquery")
SubqueryUseCounter is to be incremented every time a subquery is planned.
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") )
var TurnAuthAuditingOffUseCounter = telemetry.GetCounterOnce("auditing.authentication.disabled")
TurnAuthAuditingOffUseCounter counts how many time connection audit logs were disabled.
var TurnAuthAuditingOnUseCounter = telemetry.GetCounterOnce("auditing.authentication.enabled")
TurnAuthAuditingOnUseCounter counts how many time connection audit logs were enabled.
var TurnAutoStatsOffUseCounter = telemetry.GetCounterOnce("sql.plan.automatic-stats.disabled")
TurnAutoStatsOffUseCounter is to be incremented whenever automatic stats collection is explicitly disabled.
var TurnAutoStatsOnUseCounter = telemetry.GetCounterOnce("sql.plan.automatic-stats.enabled")
TurnAutoStatsOnUseCounter is to be incremented whenever automatic stats collection is explicitly enabled.
var TurnConnAuditingOffUseCounter = telemetry.GetCounterOnce("auditing.connection.disabled")
TurnConnAuditingOffUseCounter counts how many time connection audit logs were disabled.
var TurnConnAuditingOnUseCounter = telemetry.GetCounterOnce("auditing.connection.enabled")
TurnConnAuditingOnUseCounter counts how many time connection audit logs were enabled.
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.
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 ¶
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 ¶
BuiltinCounter creates a telemetry counter for a built-in function. This is to be incremented upon type checking of a function application.
func CastOpCounter ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
SchemaChangeAlterCounter behaves the same as SchemaChangeAlterCounterWithExtra but with no extra metadata.
func SchemaChangeAlterCounterWithExtra ¶
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 ¶
SchemaChangeCreateCounter is to be incremented every time a CREATE schema change was made.
func SchemaChangeDropCounter ¶
SchemaChangeDropCounter is to be incremented every time a DROP schema change was made.
func SchemaJobControlCounter ¶
SchemaJobControlCounter is to be incremented every time a job control action is taken.
func SchemaNewColumnTypeQualificationCounter ¶
SchemaNewColumnTypeQualificationCounter is to be incremented every time a new qualification is used for a newly created column.
func SchemaNewTypeCounter ¶
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 ¶
SchemaSetAuditModeCounter is to be incremented every time an audit mode is set.
func SchemaSetZoneConfigCounter ¶
SchemaSetZoneConfigCounter is to be incremented every time a ZoneConfig argument is parsed.
func SerialColumnNormalizationCounter ¶
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 ¶
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 ¶
UnimplementedClientStatusParameterCounter is to be incremented every time a client attempts to configure a status parameter that's not supported upon session initialization.
func UnimplementedSessionVarValueCounter ¶
UnimplementedSessionVarValueCounter is to be incremented every time a client attempts to set a compatitibility session var to an unsupported value.
func VecModeCounter ¶
VecModeCounter is to be incremented every time the vectorized execution mode is changed (including turned off).
func WindowFunctionCounter ¶
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