<commit_before>// Copyright 2016 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// Author: <NAME> (<EMAIL>)

package storage

import (
	"time"

	"github.com/cockroachdb/cockroach/pkg/storage/engine"
	"github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb"
	"github.com/cockroachdb/cockroach/pkg/util/metric"
	"github.com/cockroachdb/cockroach/pkg/util/syncutil"
	"github.com/coreos/etcd/raft/raftpb"
)

var (
	// Replica metrics.
	metaReplicaCount                  = metric.Metadata{Name: "replicas"}
	metaReservedReplicaCount          = metric.Metadata{Name: "replicas.reserved"}
	metaRaftLeaderCount               = metric.Metadata{Name: "replicas.leaders"}
	metaRaftLeaderNotLeaseHolderCount = metric.Metadata{
		Name: "replicas.leaders_not_leaseholders",
		Help: "Number of replicas that are Raft leaders whose range lease is held by another store",
	}
	metaLeaseHolderCount = metric.Metadata{Name: "replicas.leaseholders"}
	metaQuiescentCount   = metric.Metadata{Name: "replicas.quiescent"}

	// Replica CommandQueue metrics. Max size metrics track the maximum value
	// seen for all replicas during a single replica scan.
	metaMaxCommandQueueSize = metric.Metadata{Name: "replicas.commandqueue.maxsize",
		Help: "Largest number of commands in any CommandQueue"}
	metaMaxCommandQueueWriteCount = metric.Metadata{Name: "replicas.commandqueue.maxwritecount",
		Help: "Largest number of read-write commands in any CommandQueue"}
	metaMaxCommandQueueReadCount = metric.Metadata{Name: "replicas.commandqueue.maxreadcount",
		Help: "Largest number of read-only commands in any CommandQueue"}
	metaMaxCommandQueueTreeSize = metric.Metadata{Name: "replicas.commandqueue.maxtreesize",
		Help: "Largest number of intervals in any CommandQueue's interval tree"}
	metaMaxCommandQueueOverlaps = metric.Metadata{Name: "replicas.commandqueue.maxoverlaps",
		Help: "Largest number of overlapping commands seen when adding to any CommandQueue"}
	metaCombinedCommandQueueSize = metric.Metadata{Name: "replicas.commandqueue.combinedqueuesize",
		Help: "Number of commands in all CommandQueues combined"}
	metaCombinedCommandWriteCount = metric.Metadata{Name: "replicas.commandqueue.combinedwritecount",
		Help: "Number of read-write commands in all CommandQueues combined"}
	metaCombinedCommandReadCount = metric.Metadata{Name: "replicas.commandqueue.combinedreadcount",
		Help: "Number of read-only commands in all CommandQueues combined"}

	// Range metrics.
	metaRangeCount = metric.Metadata{Name: "ranges",
		Help: "Number of ranges"}
	metaUnavailableRangeCount = metric.Metadata{Name: "ranges.unavailable",
		Help: "Number of ranges with fewer live replicas than needed for quorum"}
	metaUnderReplicatedRangeCount = metric.Metadata{Name: "ranges.underreplicated",
		Help: "Number of ranges with fewer live replicas than the replication target"}

	// Lease request metrics.
	metaLeaseRequestSuccessCount  = metric.Metadata{Name: "leases.success"}
	metaLeaseRequestErrorCount    = metric.Metadata{Name: "leases.error"}
	metaLeaseTransferSuccessCount = metric.Metadata{Name: "leasestransfers.success"}
	metaLeaseTransferErrorCount   = metric.Metadata{Name: "leasestransfers.error"}
	metaLeaseExpirationCount      = metric.Metadata{Name: "leases.expiration"}
	metaLeaseEpochCount           = metric.Metadata{Name: "leases.epoch"}

	// Storage metrics.
	metaLiveBytes       = metric.Metadata{Name: "livebytes"}
	metaKeyBytes        = metric.Metadata{Name: "keybytes"}
	metaValBytes        = metric.Metadata{Name: "valbytes"}
	metaIntentBytes     = metric.Metadata{Name: "intentbytes"}
	metaLiveCount       = metric.Metadata{Name: "livecount"}
	metaKeyCount        = metric.Metadata{Name: "keycount"}
	metaValCount        = metric.Metadata{Name: "valcount"}<commit_msg>storage: Fix lease transfer metric names<commit_after>// Copyright 2016 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// Author: <NAME> (<EMAIL>)

package storage

import (
	"time"

	"github.com/cockroachdb/cockroach/pkg/storage/engine"
	"github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb"
	"github.com/cockroachdb/cockroach/pkg/util/metric"
	"github.com/cockroachdb/cockroach/pkg/util/syncutil"
	"github.com/coreos/etcd/raft/raftpb"
)

var (
	// Replica metrics.
	metaReplicaCount                  = metric.Metadata{Name: "replicas"}
	metaReservedReplicaCount          = metric.Metadata{Name: "replicas.reserved"}
	metaRaftLeaderCount               = metric.Metadata{Name: "replicas.leaders"}
	metaRaftLeaderNotLeaseHolderCount = metric.Metadata{
		Name: "replicas.leaders_not_leaseholders",
		Help: "Number of replicas that are Raft leaders whose range lease is held by another store",
	}
	metaLeaseHolderCount = metric.Metadata{Name: "replicas.leaseholders"}
	metaQuiescentCount   = metric.Metadata{Name: "replicas.quiescent"}

	// Replica CommandQueue metrics. Max size metrics track the maximum value
	// seen for all replicas during a single replica scan.
	metaMaxCommandQueueSize = metric.Metadata{Name: "replicas.commandqueue.maxsize",
		Help: "Largest number of commands in any CommandQueue"}
	metaMaxCommandQueueWriteCount = metric.Metadata{Name: "replicas.commandqueue.maxwritecount",
		Help: "Largest number of read-write commands in any CommandQueue"}
	metaMaxCommandQueueReadCount = metric.Metadata{Name: "replicas.commandqueue.maxreadcount",
		Help: "Largest number of read-only commands in any CommandQueue"}
	metaMaxCommandQueueTreeSize = metric.Metadata{Name: "replicas.commandqueue.maxtreesize",
		Help: "Largest number of intervals in any CommandQueue's interval tree"}
	metaMaxCommandQueueOverlaps = metric.Metadata{Name: "replicas.commandqueue.maxoverlaps",
		Help: "Largest number of overlapping commands seen when adding to any CommandQueue"}
	metaCombinedCommandQueueSize = metric.Metadata{Name: "replicas.commandqueue.combinedqueuesize",
		Help: "Number of commands in all CommandQueues combined"}
	metaCombinedCommandWriteCount = metric.Metadata{Name: "replicas.commandqueue.combinedwritecount",
		Help: "Number of read-write commands in all CommandQueues combined"}
	metaCombinedCommandReadCount = metric.Metadata{Name: "replicas.commandqueue.combinedreadcount",
		Help: "Number of read-only commands in all CommandQueues combined"}

	// Range metrics.
	metaRangeCount = metric.Metadata{Name: "ranges",
		Help: "Number of ranges"}
	metaUnavailableRangeCount = metric.Metadata{Name: "ranges.unavailable",
		Help: "Number of ranges with fewer live replicas than needed for quorum"}
	metaUnderReplicatedRangeCount = metric.Metadata{Name: "ranges.underreplicated",
		Help: "Number of ranges with fewer live replicas than the replication target"}

	// Lease request metrics.
	metaLeaseRequestSuccessCount  = metric.Metadata{Name: "leases.success"}
	metaLeaseRequestErrorCount    = metric.Metadata{Name: "leases.error"}
	metaLeaseTransferSuccessCount = metric.Metadata{Name: "leases.transfers.success"}
	metaLeaseTransferErrorCount   = metric.Metadata{Name: "leases.transfers.error"}
	metaLeaseExpirationCount      = metric.Metadata{Name: "leases.expiration"}
	metaLeaseEpochCount           = metric.Metadata{Name: "leases.epoch"}

	// Storage metrics.
	metaLiveBytes       = metric.Metadata{Name: "livebytes"}
	metaKeyBytes        = metric.Metadata{Name: "keybytes"}
	metaValBytes        = metric.Metadata{Name: "valbytes"}
	metaIntentBytes     = metric.Metadata{Name: "intentbytes"}
	metaLiveCount       = metric.Metadata{Name: "livecount"}
	metaKeyCount        = metric.Metadata{Name: "keycount"}
	metaValCount        = metric.Metadata{Name: "valcount"}
{'fraction_non_alphanumeric': 0.09797101449275362, 'fraction_numerical': 0.0018550724637681159, 'mean_word_length': 4.884038199181446, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1422308', 'n_tokens_mistral': 2571, 'n_tokens_neox': 2510, 'n_words': 672}