MSP-8976 Up deps

This commit is contained in:
Иван Перлов committed 2026-11-20 17:19:44 +03:00
1 parent b8ef777339
commit 11d705124d
603 files changed
+47715 -13202

No files matched your search

+5 -5
View File
@@ -14,7 +14,7 @@
package model
import (
"sort"
"slices"
)
// SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is
@@ -37,7 +37,7 @@ func LabelsToSignature(labels map[string]string) uint64 {
for labelName := range labels {
labelNames = append(labelNames, labelName)
}
sort.Strings(labelNames)
slices.Sort(labelNames)
sum := hashNew()
for _, labelName := range labelNames {
@@ -60,7 +60,7 @@ func labelSetToFingerprint(ls LabelSet) Fingerprint {
for labelName := range ls {
labelNames = append(labelNames, labelName)
}
sort.Sort(labelNames)
slices.Sort(labelNames)
sum := hashNew()
for _, labelName := range labelNames {
@@ -100,7 +100,7 @@ func SignatureForLabels(m Metric, labels ...LabelName) uint64 {
return emptyLabelSignature
}
sort.Sort(LabelNames(labels))
slices.Sort(labels)
sum := hashNew()
for _, label := range labels {
@@ -129,7 +129,7 @@ func SignatureWithoutLabels(m Metric, labels map[LabelName]struct{}) uint64 {
if len(labelNames) == 0 {
return emptyLabelSignature
}
sort.Sort(labelNames)
slices.Sort(labelNames)
sum := hashNew()
for _, labelName := range labelNames {
+28
View File
@@ -164,6 +164,34 @@ func (t *Time) UnmarshalJSON(b []byte) error {
// This type should not propagate beyond the scope of input/output processing.
type Duration time.Duration
// Common durations. Day and Week are included because ParseDuration supports
// those units (unlike the standard time package).
//
// To count the number of units in a Duration, divide:
//
// second := model.Second
// fmt.Print(int64(second/model.Millisecond)) // prints 1000
//
// To convert an integer number of units to a Duration, multiply:
//
// seconds := 10
// fmt.Print(model.Duration(seconds)*model.Second) // prints 10s
const (
Nanosecond Duration = 1
Microsecond = 1000 * Nanosecond
Millisecond = 1000 * Microsecond
Second = 1000 * Millisecond
Minute = 60 * Second
Hour = 60 * Minute
Day = 24 * Hour
Week = 7 * Day
)
// Milliseconds returns the duration as an integer millisecond count.
// Prometheus stores timestamps in milliseconds; time.Duration already
// covers the other units.
func (d Duration) Milliseconds() int64 { return time.Duration(d).Milliseconds() }
// Set implements pflag/flag.Value.
func (d *Duration) Set(s string) error {
var err error
-22
View File
@@ -224,28 +224,6 @@ func (ss SampleStream) MarshalJSON() ([]byte, error) {
}
}
func (ss *SampleStream) UnmarshalJSON(b []byte) error {
v := struct {
Metric Metric `json:"metric"`
Values []SamplePair `json:"values"`
Histograms []SampleHistogramPair `json:"histograms"`
}{
Metric: ss.Metric,
Values: ss.Values,
Histograms: ss.Histograms,
}
if err := json.Unmarshal(b, &v); err != nil {
return err
}
ss.Metric = v.Metric
ss.Values = v.Values
ss.Histograms = v.Histograms
return nil
}
// Scalar is a scalar value evaluated at the set timestamp.
type Scalar struct {
Value SampleValue `json:"value"`
+70
View File
@@ -0,0 +1,70 @@
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.27
package model
import (
"bytes"
"encoding/json/jsontext"
"errors"
)
var nullBytes = []byte("null")
func (s *SamplePair) UnmarshalJSONFrom(dec *jsontext.Decoder) error {
if t, err := dec.ReadToken(); err != nil {
return err
} else if t.Kind() == jsontext.KindNull {
return nil
} else if t.Kind() != jsontext.KindBeginArray {
return errors.New("expected [")
}
// Loop until we see the end of the array (tolerate arrays of any length).
for i := 0; dec.PeekKind() != jsontext.KindEndArray; i++ {
switch i {
case 0:
if v, err := dec.ReadValue(); err != nil {
return err
} else if bytes.Equal(v, nullBytes) {
// Skip null values to match SamplePair#UnmarshalJSON behavior.
} else if err := s.Timestamp.UnmarshalJSON(v); err != nil {
return err
}
case 1:
if v, err := dec.ReadValue(); err != nil {
return err
} else if bytes.Equal(v, nullBytes) {
// Skip null values to match SamplePair#UnmarshalJSON behavior.
} else if err := s.Value.UnmarshalJSON(v); err != nil {
return err
}
default:
// Skip any remaining array items to match UnmarshalJSON behavior.
if err := dec.SkipValue(); err != nil {
return err
}
}
}
// Read the final end array token.
if t, err := dec.ReadToken(); err != nil {
return err
} else if t.Kind() != jsontext.KindEndArray {
return errors.New("expected ]")
}
return nil
}
+95
View File
@@ -0,0 +1,95 @@
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.27
package model
import (
"bytes"
"encoding/json/jsontext"
"encoding/json/v2"
"errors"
)
func (s *SampleHistogramPair) UnmarshalJSONFrom(dec *jsontext.Decoder) error {
if t, err := dec.ReadToken(); err != nil {
return err
} else if t.Kind() != jsontext.KindBeginArray {
return errors.New("expected [")
}
if v, err := dec.ReadValue(); err != nil {
return err
} else if bytes.Equal(v, nullBytes) {
// Skip null values to match SamplePair#UnmarshalJSON behavior.
} else if err := s.Timestamp.UnmarshalJSON(v); err != nil {
return err
}
if err := json.UnmarshalDecode(dec, &s.Histogram); err != nil {
return err
} else if s.Histogram == nil {
return errors.New("histogram is nil")
}
if t, err := dec.ReadToken(); err != nil {
return err
} else if t.Kind() != jsontext.KindEndArray {
return errors.New("expected ]")
}
return nil
}
func (s *HistogramBucket) UnmarshalJSONFrom(dec *jsontext.Decoder) error {
if t, err := dec.ReadToken(); err != nil {
return err
} else if t.Kind() != jsontext.KindBeginArray {
return errors.New("expected [")
}
if err := json.UnmarshalDecode(dec, &s.Boundaries); err != nil {
return err
}
if v, err := dec.ReadValue(); err != nil {
return err
} else if bytes.Equal(v, nullBytes) {
// Skip null values to match SamplePair#UnmarshalJSON behavior.
} else if err := s.Lower.UnmarshalJSON(v); err != nil {
return err
}
if v, err := dec.ReadValue(); err != nil {
return err
} else if bytes.Equal(v, nullBytes) {
// Skip null values to match SamplePair#UnmarshalJSON behavior.
} else if err := s.Upper.UnmarshalJSON(v); err != nil {
return err
}
if v, err := dec.ReadValue(); err != nil {
return err
} else if bytes.Equal(v, nullBytes) {
// Skip null values to match SamplePair#UnmarshalJSON behavior.
} else if err := s.Count.UnmarshalJSON(v); err != nil {
return err
}
if t, err := dec.ReadToken(); err != nil {
return err
} else if t.Kind() != jsontext.KindEndArray {
return errors.New("expected ]")
}
return nil
}