func (d *DeltaCalculator) Calc(hash Hash, newValue float64) (float64, bool) {
	d.lock.Lock()
	defer d.lock.Unlock()
	oldValue, exists := d.history[hash]
	d.history[hash] = newValue
	return newValue - oldValue, exists
}
Calculate the delta for given hash and value. Returns the provided value and false if a previous value didn't exist.
package prometheus
import (
	"sort"
	"sync"
	"github.com/cespare/xxhash/v2"
)
func NewDeltaCalculator() *DeltaCalculator {
	return &DeltaCalculator{
		history: make(map[Hash]float64),
	}
}
type DeltaCalculator struct {
	lock    sync.Mutex
	history map[Hash]float64
}