File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -126,8 +126,8 @@ func runAgent(cmd *cobra.Command, args []string) error {
126126 logger .String ("prometheus_endpoint" , cfg .Prometheus .Endpoint ),
127127 logger .String ("server_endpoint" , cfg .Server .Endpoint ))
128128
129- // Scrape immediately on start with aligned timestamp
130- collectionTime := time .Now ().Truncate (cfg .Agent .Interval )
129+ // Scrape immediately on start with aligned timestamp (UTC)
130+ collectionTime := time .Now ().UTC (). Truncate (cfg .Agent .Interval )
131131 if err := scrapeAndSendWithTimestamp (scraper , sender , cfg .Agent .ServerID , collectionTime ); err != nil {
132132 logger .Error ("Initial scrape failed" , logger .Err (err ))
133133 }
@@ -138,8 +138,8 @@ func runAgent(cmd *cobra.Command, args []string) error {
138138 case <- ctx .Done ():
139139 return nil
140140 case tickTime := <- ticker .C :
141- // Align collection time to interval boundary
142- collectionTime := tickTime .Truncate (cfg .Agent .Interval )
141+ // Align collection time to interval boundary (UTC)
142+ collectionTime := tickTime .UTC (). Truncate (cfg .Agent .Interval )
143143 if err := scrapeAndSendWithTimestamp (scraper , sender , cfg .Agent .ServerID , collectionTime ); err != nil {
144144 logger .Error ("Scrape failed" , logger .Err (err ))
145145 }
You can’t perform that action at this time.
0 commit comments