Skip to content

Commit

Permalink
Merge pull request #97509 from miretskiy/backport22.2-93423
Browse files Browse the repository at this point in the history
release-22.2: changefeedccl: Drop env gate for metrics label
  • Loading branch information
miretskiy authored Feb 22, 2023
2 parents c1fa140 + 7d290f9 commit df0c962
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
7 changes: 0 additions & 7 deletions pkg/ccl/changefeedccl/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3335,15 +3335,8 @@ func TestChangefeedMonitoring(t *testing.T) {
t.Errorf(`expected 0 got %d`, c)
}

enableSLIMetrics = false
foo := feed(t, f, `CREATE CHANGEFEED FOR foo WITH metrics_label='tier0'`)
_, err := foo.Next()
require.Regexp(t, "cannot create metrics scope", err)
require.NoError(t, foo.Close())

enableSLIMetrics = true
foo = feed(t, f, `CREATE CHANGEFEED FOR foo WITH metrics_label='tier0'`)
_, err = foo.Next()
require.NoError(t, err)

testutils.SucceedsSoon(t, func() error {
Expand Down
14 changes: 0 additions & 14 deletions pkg/ccl/changefeedccl/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,19 @@ import (
"time"

"github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/cdcutils"
"github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/changefeedbase"
"github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/kvevent"
"github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/schemafeed"
"github.com/cockroachdb/cockroach/pkg/jobs"
"github.com/cockroachdb/cockroach/pkg/multitenant"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror"
"github.com/cockroachdb/cockroach/pkg/util/envutil"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/metric"
"github.com/cockroachdb/cockroach/pkg/util/metric/aggmetric"
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/errors"
)

// allow creation of per changefeed SLI metrics.
var enableSLIMetrics = envutil.EnvOrDefaultBool(
"COCKROACH_EXPERIMENTAL_ENABLE_PER_CHANGEFEED_METRICS", false)

const (
changefeedCheckpointHistMaxLatency = 30 * time.Second
changefeedBatchHistMaxLatency = 30 * time.Second
Expand Down Expand Up @@ -572,13 +565,6 @@ func (a *AggMetrics) getOrCreateScope(scope string) (*sliMetrics, error) {
}

if scope != defaultSLIScope {
if !enableSLIMetrics {
return nil, changefeedbase.WithTerminalError(
errors.WithHint(
pgerror.Newf(pgcode.ConfigurationLimitExceeded, "cannot create metrics scope %q", scope),
"try restarting with COCKROACH_EXPERIMENTAL_ENABLE_PER_CHANGEFEED_METRICS=true",
))
}
const failSafeMax = 1024
if len(a.mu.sliMetrics) == failSafeMax {
return nil, pgerror.Newf(pgcode.ConfigurationLimitExceeded,
Expand Down

0 comments on commit df0c962

Please sign in to comment.