I am using the go remote writer here : https://github.com/prometheus/prometheus/blob/master/documentation/examples/remote_storage/example_write_adapter/server.go
This line
fmt.Printf(" %f %d
", s.Value, s.Timestamp)
Prints this timestamp 1526415583412 and it's date is 9/3/50340 Wich is impossible . But if a remove three characters it works 1526415583
Prometheus timestamps are in milliseconds.
You can use time.Second/time.Millisecond
to convert from Milliseconds
to Seconds
:
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(time.Unix(1526415583412/int64(time.Second/time.Millisecond),0))
}
Prints 2018-05-15 20:19:43 +0000 UTC
Or, just divide by 1000.
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(time.Unix(1526415583412/1000,0))
}