func GetOrCreateSummaryExt(name string, window time.Duration, quantiles []float64) *Summary {
	metricsMapLock.Lock()
	nm := metricsMap[name]
	metricsMapLock.Unlock()
	if nm == nil {
		// Slow path - create and register missing summary.
		if err := validateMetric(name); err != nil {
			panic(fmt.Errorf("BUG: invalid metric name %q: %s", name, err))
		}
		s := newSummary(window, quantiles)
		nmNew := &namedMetric{
			name:   name,
			metric: s,
		}
		mustRegisterQuantiles := false
		metricsMapLock.Lock()
		nm = metricsMap[name]
		if nm == nil {
			nm = nmNew
			metricsMap[name] = nm
			metricsList = append(metricsList, nm)
			registerSummary(s)
			mustRegisterQuantiles = true
		}
		metricsMapLock.Unlock()
		if mustRegisterQuantiles {
			registerSummaryQuantiles(name, s)
		}
	}
	s, ok := nm.metric.(*Summary)
	if !ok {
		panic(fmt.Errorf("BUG: metric %q isn't a Summary. It is %T", name, nm.metric))
	}
	if s.window != window {
		panic(fmt.Errorf("BUG: invalid window requested for the summary %q; requested %s; need %s", name, window, s.window))
	}
	if !isEqualQuantiles(s.quantiles, quantiles) {
		panic(fmt.Errorf("BUG: invalid quantiles requested from the summary %q; requested %v; need %v", name, quantiles, s.quantiles))
	}
	return s
}
// GetOrCreateSummaryExt returns registered summary with the given name,
// window and quantiles or creates new summary if the registry doesn't
// contain summary with the given name.
//
// name must be valid Prometheus-compatible metric with possible lables.
// For instance,
//
//     * foo
//     * foo{bar="baz"}
//     * foo{bar="baz",aaa="b"}
//
// The returned summary is safe to use from concurrent goroutines.
//
// Performance tip: prefer NewSummaryExt instead of GetOrCreateSummaryExt.
GetOrCreateSummaryExt returns registered summary with the given name,
window and quantiles or creates new summary if the registry doesn't
contain summary with the given name.

name must be valid Prometheus-compatible metric with possible lables.
For instance.



The returned summary is safe to use from concurrent goroutines.

Performance tip: prefer NewSummaryExt instead of GetOrCreateSummaryExt.
// GetOrCreateSummaryExt returns registered summary with the given name // window and quantiles or creates new summary if the registry doesn ' t // contain summary with the given name . // // name must be valid Prometheus - compatible metric with possible lables . // For instance // // * foo // * foo { bar = " baz " } // * foo { bar = " baz " aaa = " b " } // // The returned summary is safe to use from concurrent goroutines . // // Performance tip : prefer NewSummaryExt instead of GetOrCreateSummaryExt .
func GetOrCreateSummaryExt(name string, window time.Duration, quantiles []float64) *Summary {
	metricsMapLock.Lock()
	nm := metricsMap[name]
	metricsMapLock.Unlock()
	if nm == nil {
		if err := validateMetric(name); err != nil {
			panic(fmt.Errorf("BUG: invalid metric name %q: %s", name, err))
		}
		s := newSummary(window, quantiles)
		nmNew := &namedMetric{
			name:   name,
			metric: s,
		}
		mustRegisterQuantiles := false
		metricsMapLock.Lock()
		nm = metricsMap[name]
		if nm == nil {
			nm = nmNew
			metricsMap[name] = nm
			metricsList = append(metricsList, nm)
			registerSummary(s)
			mustRegisterQuantiles = true
		}
		metricsMapLock.Unlock()
		if mustRegisterQuantiles {
			registerSummaryQuantiles(name, s)
		}
	}
	s, ok := nm.metric.(*Summary)
	if !ok {
		panic(fmt.Errorf("BUG: metric %q isn't a Summary. It is %T", name, nm.metric))
	}
	if s.window != window {
		panic(fmt.Errorf("BUG: invalid window requested for the summary %q; requested %s; need %s", name, window, s.window))
	}
	if !isEqualQuantiles(s.quantiles, quantiles) {
		panic(fmt.Errorf("BUG: invalid quantiles requested from the summary %q; requested %v; need %v", name, quantiles, s.quantiles))
	}
	return s
}
func GetOrCreateSummaryExt ( name string , window time . Duration , quantiles [ ] float64 ) * Summary { metricsMapLock . Lock ( ) nm := metricsMap [ name ] metricsMapLock . Unlock ( ) if nm == nil { if err := validateMetric ( name ) ; err != nil { panic ( fmt . Errorf ( " " , name , err ) ) } s := newSummary ( window , quantiles ) nmNew := & namedMetric { name : name , metric : s , } mustRegisterQuantiles := false metricsMapLock . Lock ( ) nm = metricsMap [ name ] if nm == nil { nm = nmNew metricsMap [ name ] = nm metricsList = append ( metricsList , nm ) registerSummary ( s ) mustRegisterQuantiles = true } metricsMapLock . Unlock ( ) if mustRegisterQuantiles { registerSummaryQuantiles ( name , s ) } } s , ok := nm . metric . ( * Summary ) if ! ok { panic ( fmt . Errorf ( " " , name , nm . metric ) ) } if s . window != window { panic ( fmt . Errorf ( " " , name , window , s . window ) ) } if ! isEqualQuantiles ( s . quantiles , quantiles ) { panic ( fmt . Errorf ( " " , name , quantiles , s . quantiles ) ) } return s }
GetOrCreateSummaryExt returns registered summary with the given name,
window and quantiles or creates new summary if the registry doesn't
contain summary with the given name.
GetOrCreateSummaryExt returns registered summary with the given name window and quantiles or creates new summary if the registry doesn ' t contain summary with the given name .
// Slow path - create and register missing summary.