Skip to content

Commit 1499576

Browse files
committed
feat: add more precision to duration metric
Release-As: 1.1.0
1 parent 80050b7 commit 1499576

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ func executeCommand(config *Config, cmdArgs []string) int {
127127
}
128128
}
129129

130+
duration := time.Since(time.Unix(startTime, 0)).Seconds()
130131
endTime := time.Now().Unix()
131-
duration := endTime - startTime
132132

133-
sendMetric(config, "job_duration_seconds", fmt.Sprintf("%d", duration), "gauge", "Total time taken for job execution in seconds")
133+
sendMetric(config, "job_duration_seconds", fmt.Sprintf("%.6f", duration), "gauge", "Total time taken for job execution in seconds")
134134
sendMetric(config, "job_exit_status", fmt.Sprintf("%d", exitStatus), "gauge", "Exit status code of the last job execution (0=success)")
135135
sendMetric(config, "job_last_execution_timestamp", fmt.Sprintf("%d", endTime), "gauge", "Timestamp of the last job execution")
136136
sendMetric(config, "job_executions_total", "1", "counter", "Total number of job executions")

0 commit comments

Comments
 (0)