mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
update prometheus client golang
update docker/distribution lib Signed-off-by: Hilário Coelho <hilario.coelho@securityside.com>
This commit is contained in:
committed by
Alex Ellis
parent
8065a4baa2
commit
a530b9dd63
8
gateway/vendor/github.com/prometheus/common/model/labels.go
generated
vendored
8
gateway/vendor/github.com/prometheus/common/model/labels.go
generated
vendored
@ -45,6 +45,14 @@ const (
|
||||
// scrape a target.
|
||||
MetricsPathLabel = "__metrics_path__"
|
||||
|
||||
// ScrapeIntervalLabel is the name of the label that holds the scrape interval
|
||||
// used to scrape a target.
|
||||
ScrapeIntervalLabel = "__scrape_interval__"
|
||||
|
||||
// ScrapeTimeoutLabel is the name of the label that holds the scrape
|
||||
// timeout used to scrape a target.
|
||||
ScrapeTimeoutLabel = "__scrape_timeout__"
|
||||
|
||||
// ReservedLabelPrefix is a prefix which is not legal in user-supplied
|
||||
// label names.
|
||||
ReservedLabelPrefix = "__"
|
||||
|
45
gateway/vendor/github.com/prometheus/common/model/time.go
generated
vendored
45
gateway/vendor/github.com/prometheus/common/model/time.go
generated
vendored
@ -14,6 +14,8 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"regexp"
|
||||
@ -201,13 +203,23 @@ func ParseDuration(durationStr string) (Duration, error) {
|
||||
|
||||
// Parse the match at pos `pos` in the regex and use `mult` to turn that
|
||||
// into ms, then add that value to the total parsed duration.
|
||||
var overflowErr error
|
||||
m := func(pos int, mult time.Duration) {
|
||||
if matches[pos] == "" {
|
||||
return
|
||||
}
|
||||
n, _ := strconv.Atoi(matches[pos])
|
||||
|
||||
// Check if the provided duration overflows time.Duration (> ~ 290years).
|
||||
if n > int((1<<63-1)/mult/time.Millisecond) {
|
||||
overflowErr = errors.New("duration out of range")
|
||||
}
|
||||
d := time.Duration(n) * time.Millisecond
|
||||
dur += d * mult
|
||||
|
||||
if dur < 0 {
|
||||
overflowErr = errors.New("duration out of range")
|
||||
}
|
||||
}
|
||||
|
||||
m(2, 1000*60*60*24*365) // y
|
||||
@ -218,7 +230,7 @@ func ParseDuration(durationStr string) (Duration, error) {
|
||||
m(12, 1000) // s
|
||||
m(14, 1) // ms
|
||||
|
||||
return Duration(dur), nil
|
||||
return Duration(dur), overflowErr
|
||||
}
|
||||
|
||||
func (d Duration) String() string {
|
||||
@ -254,6 +266,37 @@ func (d Duration) String() string {
|
||||
return r
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (d Duration) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(d.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||
func (d *Duration) UnmarshalJSON(bytes []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(bytes, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
dur, err := ParseDuration(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*d = dur
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalText implements the encoding.TextMarshaler interface.
|
||||
func (d *Duration) MarshalText() ([]byte, error) {
|
||||
return []byte(d.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements the encoding.TextUnmarshaler interface.
|
||||
func (d *Duration) UnmarshalText(text []byte) error {
|
||||
var err error
|
||||
*d, err = ParseDuration(string(text))
|
||||
return err
|
||||
}
|
||||
|
||||
// MarshalYAML implements the yaml.Marshaler interface.
|
||||
func (d Duration) MarshalYAML() (interface{}, error) {
|
||||
return d.String(), nil
|
||||
|
Reference in New Issue
Block a user