In Teamcity build, how to access TimeSpentInQueue statistic during the build, inside one of the steps?

Answered

Hi Team,

I am trying to send slack notification from the teamcity build and would like to show how much time this build spent in queue.
How to access TimeSpentInQueue statistic during the build, inside one of the steps? I am unable to find a way to directly access the statistic inside the build.

TeamCity Version we are using: TeamCity Enterprise 2019.2.4

Thanks,
Ankush

0
2 comments

Hi Ankush,

You can try using REST API for that. You can find your running build with /app/rest/builds/{locator}. There will be such attributes as

 "queuedDate": "20200714T180516+0300",
"startDate": "20200714T180520+0300",

You can calculate the difference and use it in your notification. Will that work for you?

1
Avatar
Permanently deleted user

Thanks Mikhail. This will work perfectly. 

0

Please sign in to leave a comment.