Documentation ¶
Overview ¶
Package textparse contains an efficient parser for the Prometheus text format.
Index ¶
Constants ¶
const ( MetricTypeCounter = "counter" MetricTypeGauge = "gauge" MetricTypeHistogram = "histogram" MetricTypeSummary = "summary" MetricTypeUntyped = "untyped" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses samples from a byte slice of samples in the official Prometheus text exposition format.
func (*Parser) Comment ¶
Comment returns the text of the current comment. Must only be called after Next returned a comment entry. The returned byte slice becomes invalid after the next call to Next.
func (*Parser) Help ¶
Help returns the metric name and help text in the current entry. Must only be called after Next returned a help entry. The returned byte slices become invalid after the next call to Next.
func (*Parser) Metric ¶
Metric writes the labels of the current sample into the passed labels. It returns the string from which the metric was parsed.
func (*Parser) Next ¶
Next advances the parser to the next sample. It returns false if no more samples were read or an error occurred.
func (*Parser) Series ¶
Series returns the bytes of the series, the timestamp if set, and the value of the current sample.
func (*Parser) Type ¶
func (p *Parser) Type() ([]byte, MetricType)
Type returns the metric name and type in the current entry. Must only be called after Next returned a type entry. The returned byte slices become invalid after the next call to Next.