github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/batcheval/cmd_range_stats.go (about) 1 // Copyright 2018 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package batcheval 12 13 import ( 14 "context" 15 16 "github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval/result" 17 "github.com/cockroachdb/cockroach/pkg/roachpb" 18 "github.com/cockroachdb/cockroach/pkg/storage" 19 ) 20 21 func init() { 22 RegisterReadOnlyCommand(roachpb.RangeStats, DefaultDeclareKeys, RangeStats) 23 } 24 25 // RangeStats returns the MVCC statistics for a range. 26 func RangeStats( 27 _ context.Context, _ storage.Reader, cArgs CommandArgs, resp roachpb.Response, 28 ) (result.Result, error) { 29 reply := resp.(*roachpb.RangeStatsResponse) 30 reply.MVCCStats = cArgs.EvalCtx.GetMVCCStats() 31 reply.QueriesPerSecond = cArgs.EvalCtx.GetSplitQPS() 32 return result.Result{}, nil 33 }