update prometheus dependencies (#5520)

Signed-off-by: junot <junotxiang@kubesphere.io>
This commit is contained in:
junot
2023-02-14 09:46:22 +08:00
committed by GitHub
parent a979342f56
commit 2cd5f45d47
769 changed files with 81283 additions and 30511 deletions

View File

@@ -38,7 +38,7 @@ type byteStreamOpts struct {
Close bool
}
// ByteStreamConsumer creates a consmer for byte streams,
// ByteStreamConsumer creates a consumer for byte streams,
// takes a Writer/BinaryUnmarshaler interface or binary slice by reference,
// and reads from the provided reader
func ByteStreamConsumer(opts ...byteStreamOpt) Consumer {
@@ -58,6 +58,7 @@ func ByteStreamConsumer(opts ...byteStreamOpt) Consumer {
close = cl.Close
}
}
//nolint:errcheck // closing a reader wouldn't fail.
defer close()
if wrtr, ok := data.(io.Writer); ok {
@@ -76,6 +77,13 @@ func ByteStreamConsumer(opts ...byteStreamOpt) Consumer {
return bu.UnmarshalBinary(b)
}
if data != nil {
if str, ok := data.(*string); ok {
*str = string(b)
return nil
}
}
if t := reflect.TypeOf(data); data != nil && t.Kind() == reflect.Ptr {
v := reflect.Indirect(reflect.ValueOf(data))
if t = v.Type(); t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8 {
@@ -107,6 +115,7 @@ func ByteStreamProducer(opts ...byteStreamOpt) Producer {
close = cl.Close
}
}
//nolint:errcheck // TODO: closing a writer would fail.
defer close()
if rc, ok := data.(io.ReadCloser); ok {
@@ -129,6 +138,11 @@ func ByteStreamProducer(opts ...byteStreamOpt) Producer {
}
if data != nil {
if str, ok := data.(string); ok {
_, err := writer.Write([]byte(str))
return err
}
if e, ok := data.(error); ok {
_, err := writer.Write([]byte(e.Error()))
return err