Update prometheus client and go-metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
		
							
								
								
									
										17
									
								
								vendor/github.com/prometheus/common/model/time.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/github.com/prometheus/common/model/time.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -163,9 +163,21 @@ func (t *Time) UnmarshalJSON(b []byte) error {
 | 
			
		||||
// This type should not propagate beyond the scope of input/output processing.
 | 
			
		||||
type Duration time.Duration
 | 
			
		||||
 | 
			
		||||
// Set implements pflag/flag.Value
 | 
			
		||||
func (d *Duration) Set(s string) error {
 | 
			
		||||
	var err error
 | 
			
		||||
	*d, err = ParseDuration(s)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Type implements pflag.Value
 | 
			
		||||
func (d *Duration) Type() string {
 | 
			
		||||
	return "duration"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$")
 | 
			
		||||
 | 
			
		||||
// StringToDuration parses a string into a time.Duration, assuming that a year
 | 
			
		||||
// ParseDuration parses a string into a time.Duration, assuming that a year
 | 
			
		||||
// always has 365d, a week always has 7d, and a day always has 24h.
 | 
			
		||||
func ParseDuration(durationStr string) (Duration, error) {
 | 
			
		||||
	matches := durationRE.FindStringSubmatch(durationStr)
 | 
			
		||||
@@ -202,6 +214,9 @@ func (d Duration) String() string {
 | 
			
		||||
		ms   = int64(time.Duration(d) / time.Millisecond)
 | 
			
		||||
		unit = "ms"
 | 
			
		||||
	)
 | 
			
		||||
	if ms == 0 {
 | 
			
		||||
		return "0s"
 | 
			
		||||
	}
 | 
			
		||||
	factors := map[string]int64{
 | 
			
		||||
		"y":  1000 * 60 * 60 * 24 * 365,
 | 
			
		||||
		"w":  1000 * 60 * 60 * 24 * 7,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user