mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
textparse: remove MetricType alias
No backwards-compatibility; make a clean break. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
8065bef172
commit
c83e1fc574
|
@ -44,7 +44,7 @@ type Parser interface {
|
||||||
// Type returns the metric name and type in the current entry.
|
// Type returns the metric name and type in the current entry.
|
||||||
// Must only be called after Next returned a type entry.
|
// Must only be called after Next returned a type entry.
|
||||||
// The returned byte slices become invalid after the next call to Next.
|
// The returned byte slices become invalid after the next call to Next.
|
||||||
Type() ([]byte, MetricType)
|
Type() ([]byte, model.MetricType)
|
||||||
|
|
||||||
// Unit returns the metric name and unit in the current entry.
|
// Unit returns the metric name and unit in the current entry.
|
||||||
// Must only be called after Next returned a unit entry.
|
// Must only be called after Next returned a unit entry.
|
||||||
|
@ -111,5 +111,3 @@ const (
|
||||||
EntryUnit Entry = 4
|
EntryUnit Entry = 4
|
||||||
EntryHistogram Entry = 5 // A series with a native histogram as a value.
|
EntryHistogram Entry = 5 // A series with a native histogram as a value.
|
||||||
)
|
)
|
||||||
|
|
||||||
type MetricType = model.MetricType
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ func (p *OpenMetricsParser) Help() ([]byte, []byte) {
|
||||||
// Type returns the metric name and type in the current entry.
|
// Type returns the metric name and type in the current entry.
|
||||||
// Must only be called after Next returned a type entry.
|
// Must only be called after Next returned a type entry.
|
||||||
// The returned byte slices become invalid after the next call to Next.
|
// The returned byte slices become invalid after the next call to Next.
|
||||||
func (p *OpenMetricsParser) Type() ([]byte, MetricType) {
|
func (p *OpenMetricsParser) Type() ([]byte, model.MetricType) {
|
||||||
return p.l.b[p.offsets[0]:p.offsets[1]], p.mtype
|
return p.l.b[p.offsets[0]:p.offsets[1]], p.mtype
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ type PromParser struct {
|
||||||
builder labels.ScratchBuilder
|
builder labels.ScratchBuilder
|
||||||
series []byte
|
series []byte
|
||||||
text []byte
|
text []byte
|
||||||
mtype MetricType
|
mtype model.MetricType
|
||||||
val float64
|
val float64
|
||||||
ts int64
|
ts int64
|
||||||
hasTS bool
|
hasTS bool
|
||||||
|
@ -192,7 +192,7 @@ func (p *PromParser) Help() ([]byte, []byte) {
|
||||||
// Type returns the metric name and type in the current entry.
|
// Type returns the metric name and type in the current entry.
|
||||||
// Must only be called after Next returned a type entry.
|
// Must only be called after Next returned a type entry.
|
||||||
// The returned byte slices become invalid after the next call to Next.
|
// The returned byte slices become invalid after the next call to Next.
|
||||||
func (p *PromParser) Type() ([]byte, MetricType) {
|
func (p *PromParser) Type() ([]byte, model.MetricType) {
|
||||||
return p.l.b[p.offsets[0]:p.offsets[1]], p.mtype
|
return p.l.b[p.offsets[0]:p.offsets[1]], p.mtype
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -623,7 +623,7 @@ func TestProtobufParse(t *testing.T) {
|
||||||
m string
|
m string
|
||||||
t int64
|
t int64
|
||||||
v float64
|
v float64
|
||||||
typ MetricType
|
typ model.MetricType
|
||||||
help string
|
help string
|
||||||
unit string
|
unit string
|
||||||
comment string
|
comment string
|
||||||
|
|
|
@ -961,7 +961,7 @@ func (c *scrapeCache) forEachStale(f func(labels.Labels) bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *scrapeCache) setType(metric []byte, t textparse.MetricType) {
|
func (c *scrapeCache) setType(metric []byte, t model.MetricType) {
|
||||||
c.metaMtx.Lock()
|
c.metaMtx.Lock()
|
||||||
|
|
||||||
e, ok := c.metadata[string(metric)]
|
e, ok := c.metadata[string(metric)]
|
||||||
|
|
|
@ -30,7 +30,6 @@ import (
|
||||||
"github.com/prometheus/prometheus/model/histogram"
|
"github.com/prometheus/prometheus/model/histogram"
|
||||||
"github.com/prometheus/prometheus/model/labels"
|
"github.com/prometheus/prometheus/model/labels"
|
||||||
"github.com/prometheus/prometheus/model/relabel"
|
"github.com/prometheus/prometheus/model/relabel"
|
||||||
"github.com/prometheus/prometheus/model/textparse"
|
|
||||||
"github.com/prometheus/prometheus/model/value"
|
"github.com/prometheus/prometheus/model/value"
|
||||||
"github.com/prometheus/prometheus/storage"
|
"github.com/prometheus/prometheus/storage"
|
||||||
)
|
)
|
||||||
|
@ -87,7 +86,7 @@ type MetricMetadataStore interface {
|
||||||
// MetricMetadata is a piece of metadata for a metric.
|
// MetricMetadata is a piece of metadata for a metric.
|
||||||
type MetricMetadata struct {
|
type MetricMetadata struct {
|
||||||
Metric string
|
Metric string
|
||||||
Type textparse.MetricType
|
Type model.MetricType
|
||||||
Help string
|
Help string
|
||||||
Unit string
|
Unit string
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue