func NewMetricWithConfig(tmc MetricConfig) *Metric {
	tm := new(Metric)
	config := customConfig(tmc)
	tm.proportionalWeight = config.ProportionalWeight
	tm.integralWeight = config.IntegralWeight
	tm.intervalLen = config.IntervalLength
	tm.maxIntervals = int(config.TrackingWindow / tm.intervalLen)
	tm.historyMaxSize = intervalToHistoryOffset(tm.maxIntervals) + 1
	tm.historyValue = 1.0
	tm.BaseService = *service.NewBaseService(nil, "Metric", tm)
	return tm
}
NewMetricWithConfig returns a trust metric with a custom configuration.
Use Start to begin tracking the quality of peer behavior over time
package trust
import (
	"math"
	"time"
	tmsync "github.com/tendermint/tendermint/internal/libs/sync"
	"github.com/tendermint/tendermint/libs/service"
)
const (
	defaultDerivativeGamma1 = 0
	defaultDerivativeGamma2 = 1.0
	defaultHistoryDataWeight = 0.8
)
type MetricHistoryJSON struct {
	NumIntervals int       `json:"intervals"`
	History      []float64 `json:"history"`
}
type Metric struct {
	service.BaseService
	mtx tmsync.Mutex
	proportionalWeight float64
	integralWeight float64
	numIntervals int
	maxIntervals int
	intervalLen time.Duration
	history []float64
	historyWeights []float64
	historyWeightSum float64
	historySize int
	historyMaxSize int
	historyValue float64
	bad, good float64
	paused bool
	testTicker MetricTicker
}
func NewMetric() *Metric {
	return NewMetricWithConfig(DefaultConfig())
}