code: func NewExtendedMetricsReporter(
  	scope tally.Scope,
  	reportInterval time.Duration,
  	metricsType ExtendedMetricsType,
  ) Reporter {
  	r := new(extendedMetricsReporter)
  	r.metricsType = metricsType
  	r.init(reportInterval, func() {
  		r.runtime.report(r.metricsType)
  		if r.metricsType >= ModerateExtendedMetrics {
  			r.process.report()
  		}
  	})
  	if r.metricsType == NoExtendedMetrics {
  		return r
  	}
  
  	runtimeScope := scope.SubScope("runtime")
  	processScope := scope.SubScope("process")
  	r.runtime.NumGoRoutines = runtimeScope.Gauge("num-goroutines")
  	r.runtime.GoMaxProcs = runtimeScope.Gauge("gomaxprocs")
  	r.process.NumFDs = processScope.Gauge("num-fds")
  	r.process.NumFDErrors = processScope.Counter("num-fd-errors")
  	r.process.pid = os.Getpid()
  	if r.metricsType < DetailedExtendedMetrics {
  		return r
  	}
  
  	var memstats runtime.MemStats
  	runtime.ReadMemStats(&memstats)
  	memoryScope := runtimeScope.SubScope("memory")
  	r.runtime.MemoryAllocated = memoryScope.Gauge("allocated")
  	r.runtime.MemoryHeap = memoryScope.Gauge("heap")
  	r.runtime.MemoryHeapIdle = memoryScope.Gauge("heapidle")
  	r.runtime.MemoryHeapInuse = memoryScope.Gauge("heapinuse")
  	r.runtime.MemoryStack = memoryScope.Gauge("stack")
  	r.runtime.GCCPUFraction = memoryScope.Gauge("gc-cpu-fraction")
  	r.runtime.NumGC = memoryScope.Counter("num-gc")
  	r.runtime.GcPauseMs = memoryScope.Timer("gc-pause-ms")
  	r.runtime.lastNumGC = memstats.NumGC
  
  	return r
  }
docs: // NewExtendedMetricsReporter creates a new extended metrics reporter
  // that reports runtime and process metrics.