I am trying to export certain gitlab job metrics to prometheus. The metrics are as follows
- Gitlab job id
- Timstamp of job Start
- Timestamp of Job End
- Job duration
I have had a look at this doc about predefined variables and I can echo ’
CI_JOB_STARTED_AT and get the job start time. This is not feasible since I will have to edit every gitlab-ci.yml file and thats just way too many repos.
So far my best best is to use the api with the jobs endpoint to derive the data I want and export it to prometheus. Is this the best way to do this?
I will appreciate any help on this.