// Copyright 2025 TiKV 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.

//go:build !vm_histogram

package metrics

import "github.com/prometheus/client_golang/prometheus"

func newHistogram(opts prometheus.HistogramOpts) Histogram {
	return prometheus.NewHistogram(opts)
}

func newHistogramVec(opts prometheus.HistogramOpts, labelNames []string) HistogramVec {
	return prometheus.NewHistogramVec(opts, labelNames)
}

func registerHistograms() {
	// HistogramVec
	prometheus.MustRegister(TiKVTxnCmdHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVBackoffHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVSendReqHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVRPCNetLatencyHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVTxnWriteKVCountHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVTxnWriteSizeHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVRawkvCmdHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVRawkvSizeHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVTxnRegionsNumHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVLoadRegionCacheHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVStatusDuration.(prometheus.Collector))
	prometheus.MustRegister(TiKVBatchPendingRequests.(prometheus.Collector))
	prometheus.MustRegister(TiKVBatchRequests.(prometheus.Collector))
	prometheus.MustRegister(TiKVRangeTaskPushDuration.(prometheus.Collector))
	prometheus.MustRegister(TiKVTxnHeartBeatHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVTxnFileMutationSizeHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVTxnFileDuration.(prometheus.Collector))

	// Histogram
	prometheus.MustRegister(TiKVLocalLatchWaitTimeHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVBatchSendTailLatency.(prometheus.Collector))
	prometheus.MustRegister(TiKVBatchClientUnavailable.(prometheus.Collector))
	prometheus.MustRegister(TiKVBatchClientWaitEstablish.(prometheus.Collector))
	prometheus.MustRegister(TiKVBatchClientRecycle.(prometheus.Collector))
	prometheus.MustRegister(TiKVTokenWaitDuration.(prometheus.Collector))
	prometheus.MustRegister(TiKVTTLManagerHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVPessimisticLockKeysDuration.(prometheus.Collector))
	prometheus.MustRegister(TiKVTSFutureWaitDuration.(prometheus.Collector))
	prometheus.MustRegister(TiKVRequestRetryTimesHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVTxnCommitBackoffSeconds.(prometheus.Collector))
	prometheus.MustRegister(TiKVTxnCommitBackoffCount.(prometheus.Collector))
	prometheus.MustRegister(TiKVSmallReadDuration.(prometheus.Collector))
	prometheus.MustRegister(TiKVReadThroughput.(prometheus.Collector))
	prometheus.MustRegister(TiKVPipelinedFlushLenHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVPipelinedFlushSizeHistogram.(prometheus.Collector))
	prometheus.MustRegister(TiKVPipelinedFlushDuration.(prometheus.Collector))
}
