-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40880: sqltelemetry,sql: Add telemetry for partitioning related improvements r=rohany a=rohany This PR adds telemetry for the ALTER PARTITION FROM INDEX t@* command, as well as sets up some boilerplate code for adding more partitioning specific telemetry counters. We only have one thing that we are recording telemetry of relating to partitioning right now, but I thought it was good to just set up the boilerplate so that we could add some more counters in the future if desired. Work for https://github.com/cockroachlabs/registration/issues/228. Release justification: Low risk monitoring improvement. Release note: None 40910: row: check for uninitialized KVFetcher r=jordanlewis a=yuzefovich Previously, when GetRangesInfo() and GetBytesRead() was called on row.Fetcher before the underlying KVFetcher is initialized, it would panic due to NPE. Now this is fixed. The problem was introduced by the recent refactor of moving CFetcher from sql/row into sql/colexec. Fixes: #39013. Release justification: Release blocker. Release note: None Co-authored-by: Rohan Yadav <[email protected]> Co-authored-by: Yahor Yuzefovich <[email protected]>
- Loading branch information
Showing
5 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2019 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package sqltelemetry | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/server/telemetry" | ||
) | ||
|
||
// PartitioningTelemetryType is an enum used to represent the different partitioning related operations | ||
// that we are recording telemetry for. | ||
type PartitioningTelemetryType int | ||
|
||
const ( | ||
_ PartitioningTelemetryType = iota | ||
// AlterAllPartitions represents an ALTER ALL PARTITIONS statement (ALTER PARTITION OF INDEX t@*) | ||
AlterAllPartitions | ||
) | ||
|
||
var partitioningTelemetryMap = map[PartitioningTelemetryType]string{ | ||
AlterAllPartitions: "alter-all-partitions", | ||
} | ||
|
||
func (p PartitioningTelemetryType) String() string { | ||
return partitioningTelemetryMap[p] | ||
} | ||
|
||
var partitioningTelemetryCounters map[PartitioningTelemetryType]telemetry.Counter | ||
|
||
func init() { | ||
partitioningTelemetryCounters = make(map[PartitioningTelemetryType]telemetry.Counter) | ||
for ty, s := range partitioningTelemetryMap { | ||
partitioningTelemetryCounters[ty] = telemetry.GetCounterOnce(fmt.Sprintf("sql.partitioning.%s", s)) | ||
} | ||
} | ||
|
||
// IncrementPartitioningCounter is used to increment the telemetry counter for a particular partitioning operation. | ||
func IncrementPartitioningCounter(partitioningType PartitioningTelemetryType) { | ||
telemetry.Inc(partitioningTelemetryCounters[partitioningType]) | ||
} |