func (p *parser) metric() labels.Labels {
	name := ""
	var m labels.Labels

	t := p.peek().typ
	if t == ItemIdentifier || t == ItemMetricIdentifier {
		name = p.next().val
		t = p.peek().typ
	}
	if t != ItemLeftBrace && name == "" {
		p.errorf("missing metric name or metric selector")
	}
	if t == ItemLeftBrace {
		m = p.labelSet()
	}
	if name != "" {
		m = append(m, labels.Label{Name: labels.MetricName, Value: name})
		sort.Sort(m)
	}
	return m
}
func (p *parser) metric() labels.Labels {
	name := ""
	var m labels.Labels

	t := p.peek().typ
	if t == ItemIdentifier || t == ItemMetricIdentifier {
		name = p.next().val
		t = p.peek().typ
	}
	if t != ItemLeftBrace && name == "" {
		p.errorf("missing metric name or metric selector")
	}
	if t == ItemLeftBrace {
		m = p.labelSet()
	}
	if name != "" {
		m = append(m, labels.Label{Name: labels.MetricName, Value: name})
		sort.Sort(m)
	}
	return m
}
func ( p * parser ) metric ( ) labels . Labels { name := " " var m labels . Labels t := p . peek ( ) . typ if t == ItemIdentifier || t == ItemMetricIdentifier { name = p . next ( ) . val t = p . peek ( ) . typ } if t != ItemLeftBrace && name == " " { p . errorf ( " " ) } if t == ItemLeftBrace { m = p . labelSet ( ) } if name != " " { m = append ( m , labels . Label { Name : labels . MetricName , Value : name } ) sort . Sort ( m ) } return m }
// metric parses a metric.
//
//		<label_set>
//		<metric_identifier> [<label_set>]
//
metric parses a metric . <label_set > <metric_identifier > [ <label_set > ]