mirror of
https://github.com/prometheus/prometheus.git
synced 2025-09-20 21:31:02 +02:00
better errors naming and formatting, typo fixes
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
parent
798bc98bd5
commit
ae7a254aa3
@ -472,10 +472,10 @@ func (c *concreteSeriesIterator) Seek(t int64) chunkenc.ValueType {
|
||||
}
|
||||
|
||||
func validateHistogramSchema(h *prompb.Histogram) error {
|
||||
if histogram.IsAcceptibleSchema(h.Schema) {
|
||||
if histogram.IsKnownSchema(h.Schema) {
|
||||
return nil
|
||||
}
|
||||
return histogram.InvalidSchemaError(h.Schema)
|
||||
return histogram.UnknownSchemaError(h.Schema)
|
||||
}
|
||||
|
||||
func getHistogramValType(h *prompb.Histogram) chunkenc.ValueType {
|
||||
|
@ -570,24 +570,25 @@ func TestConcreteSeriesIterator_InvalidHistogramSamples(t *testing.T) {
|
||||
require.Equal(t, chunkenc.ValFloat, it.Next())
|
||||
require.Equal(t, chunkenc.ValNone, it.Next())
|
||||
require.Error(t, it.Err())
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsUnknownSchema)
|
||||
|
||||
it = series.Iterator(it)
|
||||
require.Equal(t, chunkenc.ValFloat, it.Next())
|
||||
require.Equal(t, chunkenc.ValNone, it.Next())
|
||||
require.Error(t, it.Err())
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsUnknownSchema)
|
||||
|
||||
it = series.Iterator(it)
|
||||
require.Equal(t, chunkenc.ValNone, it.Seek(1))
|
||||
require.Error(t, it.Err())
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsUnknownSchema)
|
||||
|
||||
it = series.Iterator(it)
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(3))
|
||||
require.Equal(t, chunkenc.ValNone, it.Next())
|
||||
require.Error(t, it.Err())
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsUnknownSchema)
|
||||
|
||||
it = series.Iterator(it)
|
||||
require.Equal(t, chunkenc.ValNone, it.Seek(4))
|
||||
require.Error(t, it.Err())
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsUnknownSchema)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1488,12 +1488,12 @@ func TestFloatHistogramIteratorFailIfSchemaInValid(t *testing.T) {
|
||||
|
||||
it := c.Iterator(nil)
|
||||
require.Equal(t, ValNone, it.Next())
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsInvalidSchema)
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsUnknownSchema)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestFloatHistogramIteratorReduceShema(t *testing.T) {
|
||||
func TestFloatHistogramIteratorReduceSchema(t *testing.T) {
|
||||
for _, schema := range []int32{9, 52} {
|
||||
t.Run(fmt.Sprintf("schema %d", schema), func(t *testing.T) {
|
||||
h := &histogram.FloatHistogram{
|
||||
|
@ -1844,12 +1844,12 @@ func TestHistogramIteratorFailIfSchemaInValid(t *testing.T) {
|
||||
|
||||
it := c.Iterator(nil)
|
||||
require.Equal(t, ValNone, it.Next())
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsInvalidSchema)
|
||||
require.ErrorIs(t, it.Err(), histogram.ErrHistogramsUnknownSchema)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestHistogramIteratorReduceShema(t *testing.T) {
|
||||
func TestHistogramIteratorReduceSchema(t *testing.T) {
|
||||
for _, schema := range []int32{9, 52} {
|
||||
t.Run(fmt.Sprintf("schema %d", schema), func(t *testing.T) {
|
||||
h := &histogram.Histogram{
|
||||
|
Loading…
x
Reference in New Issue
Block a user