Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqltelemetry: add CANCEL QUERIES and CANCEL SESSIONS telemetry #46778

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/sql/opt/exec/execbuilder/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ package execbuilder
import (
"bytes"

"github.com/cockroachdb/cockroach/pkg/server/telemetry"
"github.com/cockroachdb/cockroach/pkg/sql/opt"
"github.com/cockroachdb/cockroach/pkg/sql/opt/cat"
"github.com/cockroachdb/cockroach/pkg/sql/opt/exec"
"github.com/cockroachdb/cockroach/pkg/sql/opt/memo"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
"github.com/cockroachdb/cockroach/pkg/sql/sqlbase"
"github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry"
"github.com/cockroachdb/cockroach/pkg/util/treeprinter"
)

Expand Down Expand Up @@ -271,6 +273,9 @@ func (b *Builder) buildCancelQueries(cancel *memo.CancelQueriesExpr) (execPlan,
if err != nil {
return execPlan{}, err
}
if !b.disableTelemetry {
telemetry.Inc(sqltelemetry.CancelQueriesUseCounter)
}
// CancelQueries returns no columns.
return execPlan{root: node}, nil
}
Expand All @@ -284,6 +289,9 @@ func (b *Builder) buildCancelSessions(cancel *memo.CancelSessionsExpr) (execPlan
if err != nil {
return execPlan{}, err
}
if !b.disableTelemetry {
telemetry.Inc(sqltelemetry.CancelSessionsUseCounter)
}
// CancelSessions returns no columns.
return execPlan{root: node}, nil
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/sql/sqltelemetry/planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ var JoinTypeSemiUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.ty
// planned.
var JoinTypeAntiUseCounter = telemetry.GetCounterOnce("sql.plan.opt.node.join.type.anti")

// CancelQueriesUseCounter is to be incremented whenever CANCEL QUERY or
// CANCEL QUERIES is run.
var CancelQueriesUseCounter = telemetry.GetCounterOnce("sql.session.cancel-queries")

// CancelSessionsUseCounter is to be incremented whenever CANCEL SESSION or
// CANCEL SESSIONS is run.
var CancelSessionsUseCounter = telemetry.GetCounterOnce("sql.session.cancel-sessions")

// We can't parameterize these telemetry counters, so just make a bunch of
// buckets for setting the join reorder limit since the range of reasonable
// values for the join reorder limit is quite small.
Expand Down