You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: registry_internal.go
    path of file: ./repos/encore/runtimes/go/metrics
    
    the code of the file until where you have to start completion: package metrics

import (
	"fmt"
	"sync"
	"sync/atomic"

	"encore.dev/appruntime/shared/nativehist"
	"encore.dev/appruntime/shared/reqtrack"
)

type Registry struct {
	rt       *reqtrack.RequestTracker
	numSvcs  uint16
	tsid     uint64
	registry sync.Map // map[registryKey]*timeseries
}

func NewRegist
    
func getTS[T any](r *Registry, name string, labels any, info MetricInfo) (ts *timeseries[T], loaded bool) {
	key := registryKey{metricName: name, labels: labels}
	if val, ok := r.registry.Load(key); ok {
		return val.(*timeseries[T]), true
	}
	val, loaded := r.registry.LoadOrStore(key, &timeseries[T]{
		info: info,
		id:   atomic.AddUint64(&r.tsid, 1),
	})
	return val.(*timeseries[T]), loaded
}