Parse showq timestamps in the right timezone.

This commit is contained in:
Ed Schouten 2017-05-29 14:51:46 +02:00
parent 9b56cf9737
commit a907c85658

View File

@ -111,6 +111,7 @@ func CollectTextualShowqFromReader(file io.Reader, ch chan<- prometheus.Metric)
[]string{"queue"}) []string{"queue"})
now := time.Now() now := time.Now()
location, _ := time.LoadLocation("Local")
for scanner.Scan() { for scanner.Scan() {
matches := messageLine.FindStringSubmatch(scanner.Text()) matches := messageLine.FindStringSubmatch(scanner.Text())
if matches != nil { if matches != nil {
@ -132,7 +133,8 @@ func CollectTextualShowqFromReader(file io.Reader, ch chan<- prometheus.Metric)
// output contains no year number. Assume it // output contains no year number. Assume it
// applies to the last year for which the // applies to the last year for which the
// message date doesn't exceed time.Now(). // message date doesn't exceed time.Now().
date, err := time.Parse("Mon Jan 2 15:04:05", matches[3]) date, err := time.ParseInLocation("Mon Jan 2 15:04:05",
matches[3], location)
if err != nil { if err != nil {
return err return err
} }