Apply suggestions from code review

Co-authored-by: Björn Rabenstein <beorn@grafana.com>
Signed-off-by: George Krajcsovits <krajorama@users.noreply.github.com>
This commit is contained in:
George Krajcsovits 2025-09-19 08:58:27 +02:00 committed by GitHub
parent f0a297bb7c
commit 5e6900558a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ var (
ErrHistogramCustomBucketsInfinite = errors.New("histogram custom bounds must be finite") ErrHistogramCustomBucketsInfinite = errors.New("histogram custom bounds must be finite")
ErrHistogramsIncompatibleSchema = errors.New("cannot apply this operation on histograms with a mix of exponential and custom bucket schemas") ErrHistogramsIncompatibleSchema = errors.New("cannot apply this operation on histograms with a mix of exponential and custom bucket schemas")
ErrHistogramsIncompatibleBounds = errors.New("cannot apply this operation on custom buckets histograms with different custom bounds") ErrHistogramsIncompatibleBounds = errors.New("cannot apply this operation on custom buckets histograms with different custom bounds")
ErrHistogramsInvalidSchema = errors.New("histogram has an invalid schema, which must be between -4 and 8 for exponential buckets, or -53 for custom buckets") ErrHistogramsInvalidSchema = fmt.Errorf("histogram has an invalid schema, which must be between %d and %d for exponential buckets, or %d for custom buckets", ExponentialSchemaMin, ExponentialSchemaMax, CustomBucketsSchema)
) )
func IsCustomBucketsSchema(s int32) bool { func IsCustomBucketsSchema(s int32) bool {

View File

@ -475,7 +475,7 @@ func validateHistogramSchema(h *prompb.Histogram) error {
if histogram.IsValidSchema(h.Schema) { if histogram.IsValidSchema(h.Schema) {
return nil return nil
} }
return fmt.Errorf("invalid histogram schema %d", h.Schema) return return fmt.Errorf("%w, got schema %d", h.Schema, histogram.ErrHistogramsInvalidSchema)
} }
func getHistogramValType(h *prompb.Histogram) chunkenc.ValueType { func getHistogramValType(h *prompb.Histogram) chunkenc.ValueType {