func (p *OpenMetricsParser) Metric(l *labels.Labels) string {
	// Allocate the full immutable string immediately, so we just
	// have to create references on it below.
	s := string(p.series)

	*l = append(*l, labels.Label{
		Name:  labels.MetricName,
		Value: s[:p.offsets[0]-p.start],
	})

	for i := 1; i < len(p.offsets); i += 4 {
		a := p.offsets[i] - p.start
		b := p.offsets[i+1] - p.start
		c := p.offsets[i+2] - p.start
		d := p.offsets[i+3] - p.start

		// Replacer causes allocations. Replace only when necessary.
		if strings.IndexByte(s[c:d], byte('\\')) >= 0 {
			*l = append(*l, labels.Label{Name: s[a:b], Value: lvalReplacer.Replace(s[c:d])})
			continue
		}
		*l = append(*l, labels.Label{Name: s[a:b], Value: s[c:d]})
	}

	// Sort labels. We can skip the first entry since the metric name is
	// already at the right place.
	sort.Sort((*l)[1:])

	return s
}
func (p *OpenMetricsParser) Metric(l *labels.Labels) string {
	
	
	s := string(p.series)

	*l = append(*l, labels.Label{
		Name:  labels.MetricName,
		Value: s[:p.offsets[0]-p.start],
	})

	for i := 1; i < len(p.offsets); i += 4 {
		a := p.offsets[i] - p.start
		b := p.offsets[i+1] - p.start
		c := p.offsets[i+2] - p.start
		d := p.offsets[i+3] - p.start

		
		if strings.IndexByte(s[c:d], byte('\\')) >= 0 {
			*l = append(*l, labels.Label{Name: s[a:b], Value: lvalReplacer.Replace(s[c:d])})
			continue
		}
		*l = append(*l, labels.Label{Name: s[a:b], Value: s[c:d]})
	}

	
	
	sort.Sort((*l)[1:])

	return s
}
func ( p * OpenMetricsParser ) Metric ( l * labels . Labels ) string { // Allocate the full immutable string immediately, so we just // have to create references on it below. s := string ( p . series ) * l = append ( * l , labels . Label { Name : labels . MetricName , Value : s [ : p . offsets [ 0 ] - p . start ] , } ) for i := 1 ; i < len ( p . offsets ) ; i += 4 { a := p . offsets [ i ] - p . start b := p . offsets [ i + 1 ] - p . start c := p . offsets [ i + 2 ] - p . start d := p . offsets [ i + 3 ] - p . start // Replacer causes allocations. Replace only when necessary. if strings . IndexByte ( s [ c : d ] , byte ( '\\' ) ) >= 0 { * l = append ( * l , labels . Label { Name : s [ a : b ] , Value : lvalReplacer . Replace ( s [ c : d ] ) } ) continue } * l = append ( * l , labels . Label { Name : s [ a : b ] , Value : s [ c : d ] } ) } // Sort labels. We can skip the first entry since the metric name is // already at the right place. sort . Sort ( ( * l ) [ 1 : ] ) return s }
// Metric writes the labels of the current sample into the passed labels.
// It returns the string from which the metric was parsed.
Metric writes the labels of the current sample into the passed labels . It returns the string from which the metric was parsed .