textparse: remove MetricType alias

No backwards-compatibility; make a clean break.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2023-12-12 12:14:36 +00:00
parent 8065bef172
commit c83e1fc574
6 changed files with 7 additions and 10 deletions

View File

@ -44,7 +44,7 @@ type Parser interface {
// 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.
Type() ([]byte, MetricType)
Type() ([]byte, model.MetricType)
// Unit returns the metric name and unit in the current entry.
// Must only be called after Next returned a unit entry.
@ -111,5 +111,3 @@ const (
EntryUnit Entry = 4
EntryHistogram Entry = 5 // A series with a native histogram as a value.
)
type MetricType = model.MetricType

View File

@ -128,7 +128,7 @@ func (p *OpenMetricsParser) Help() ([]byte, []byte) {
// 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.
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
}

View File

@ -148,7 +148,7 @@ type PromParser struct {
builder labels.ScratchBuilder
series []byte
text []byte
mtype MetricType
mtype model.MetricType
val float64
ts int64
hasTS bool
@ -192,7 +192,7 @@ func (p *PromParser) Help() ([]byte, []byte) {
// 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.
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
}

View File

@ -623,7 +623,7 @@ func TestProtobufParse(t *testing.T) {
m string
t int64
v float64
typ MetricType
typ model.MetricType
help string
unit string
comment string

View File

@ -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()
e, ok := c.metadata[string(metric)]

View File

@ -30,7 +30,6 @@ import (
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/relabel"
"github.com/prometheus/prometheus/model/textparse"
"github.com/prometheus/prometheus/model/value"
"github.com/prometheus/prometheus/storage"
)
@ -87,7 +86,7 @@ type MetricMetadataStore interface {
// MetricMetadata is a piece of metadata for a metric.
type MetricMetadata struct {
Metric string
Type textparse.MetricType
Type model.MetricType
Help string
Unit string
}