@@ -51,6 +51,7 @@ func (m *MetricsCollectorRelease) Setup(collector *CollectorProject) {
5151 []string {
5252 "projectID" ,
5353 "releaseID" ,
54+ "releaseDefinitionID" ,
5455 "sourceId" ,
5556 "repositoryID" ,
5657 "branch" ,
@@ -68,6 +69,7 @@ func (m *MetricsCollectorRelease) Setup(collector *CollectorProject) {
6869 []string {
6970 "projectID" ,
7071 "releaseID" ,
72+ "releaseDefinitionID" ,
7173 "environmentID" ,
7274 "environmentName" ,
7375 "status" ,
@@ -84,6 +86,7 @@ func (m *MetricsCollectorRelease) Setup(collector *CollectorProject) {
8486 []string {
8587 "projectID" ,
8688 "releaseID" ,
89+ "releaseDefinitionID" ,
8790 "environmentID" ,
8891 "type" ,
8992 },
@@ -97,6 +100,7 @@ func (m *MetricsCollectorRelease) Setup(collector *CollectorProject) {
97100 []string {
98101 "projectID" ,
99102 "releaseID" ,
103+ "releaseDefinitionID" ,
100104 "environmentID" ,
101105 "approvalType" ,
102106 "status" ,
@@ -228,40 +232,44 @@ func (m *MetricsCollectorRelease) Collect(ctx context.Context, callback chan<- f
228232
229233 for _ , artifact := range release .Artifacts {
230234 releaseArtifactMetric .AddInfo (prometheus.Labels {
231- "projectID" : project .Id ,
232- "releaseID" : int64ToString (release .Id ),
233- "sourceId" : artifact .SourceId ,
234- "repositoryID" : artifact .DefinitionReference .Repository .Name ,
235- "branch" : artifact .DefinitionReference .Branch .Name ,
236- "type" : artifact .Type ,
237- "alias" : artifact .Alias ,
238- "version" : artifact .DefinitionReference .Version .Name ,
235+ "projectID" : project .Id ,
236+ "releaseID" : int64ToString (release .Id ),
237+ "releaseDefinitionID" : int64ToString (release .Definition .Id ),
238+ "sourceId" : artifact .SourceId ,
239+ "repositoryID" : artifact .DefinitionReference .Repository .Name ,
240+ "branch" : artifact .DefinitionReference .Branch .Name ,
241+ "type" : artifact .Type ,
242+ "alias" : artifact .Alias ,
243+ "version" : artifact .DefinitionReference .Version .Name ,
239244 })
240245 }
241246
242247 for _ , environment := range release .Environments {
243248 releaseEnvironmentMetric .AddInfo (prometheus.Labels {
244- "projectID" : project .Id ,
245- "releaseID" : int64ToString (release .Id ),
246- "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
247- "environmentName" : environment .Name ,
248- "status" : environment .Status ,
249- "triggerReason" : environment .TriggerReason ,
250- "rank" : int64ToString (environment .Rank ),
249+ "projectID" : project .Id ,
250+ "releaseID" : int64ToString (release .Id ),
251+ "releaseDefinitionID" : int64ToString (release .Definition .Id ),
252+ "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
253+ "environmentName" : environment .Name ,
254+ "status" : environment .Status ,
255+ "triggerReason" : environment .TriggerReason ,
256+ "rank" : int64ToString (environment .Rank ),
251257 })
252258
253259 releaseEnvironmentStatusMetric .AddTime (prometheus.Labels {
254- "projectID" : project .Id ,
255- "releaseID" : int64ToString (release .Id ),
256- "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
257- "type" : "created" ,
260+ "projectID" : project .Id ,
261+ "releaseID" : int64ToString (release .Id ),
262+ "releaseDefinitionID" : int64ToString (release .Definition .Id ),
263+ "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
264+ "type" : "created" ,
258265 }, environment .CreatedOn )
259266
260267 releaseEnvironmentStatusMetric .AddIfNotZero (prometheus.Labels {
261- "projectID" : project .Id ,
262- "releaseID" : int64ToString (release .Id ),
263- "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
264- "type" : "jobDuration" ,
268+ "projectID" : project .Id ,
269+ "releaseID" : int64ToString (release .Id ),
270+ "releaseDefinitionID" : int64ToString (release .Definition .Id ),
271+ "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
272+ "type" : "jobDuration" ,
265273 }, environment .TimeToDeploy * 60 )
266274
267275 for _ , approval := range environment .PreDeployApprovals {
@@ -271,17 +279,18 @@ func (m *MetricsCollectorRelease) Collect(ctx context.Context, callback chan<- f
271279 }
272280
273281 releaseEnvironmentApprovalMetric .AddTime (prometheus.Labels {
274- "projectID" : project .Id ,
275- "releaseID" : int64ToString (release .Id ),
276- "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
277- "approvalType" : approval .ApprovalType ,
278- "status" : approval .Status ,
279- "isAutomated" : boolToString (approval .IsAutomated ),
280- "trialNumber" : int64ToString (approval .TrialNumber ),
281- "attempt" : int64ToString (approval .Attempt ),
282- "rank" : int64ToString (approval .Rank ),
283- "approver" : approval .Approver .DisplayName ,
284- "approvedBy" : approval .ApprovedBy .DisplayName ,
282+ "projectID" : project .Id ,
283+ "releaseID" : int64ToString (release .Id ),
284+ "releaseDefinitionID" : int64ToString (release .Definition .Id ),
285+ "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
286+ "approvalType" : approval .ApprovalType ,
287+ "status" : approval .Status ,
288+ "isAutomated" : boolToString (approval .IsAutomated ),
289+ "trialNumber" : int64ToString (approval .TrialNumber ),
290+ "attempt" : int64ToString (approval .Attempt ),
291+ "rank" : int64ToString (approval .Rank ),
292+ "approver" : approval .Approver .DisplayName ,
293+ "approvedBy" : approval .ApprovedBy .DisplayName ,
285294 }, approval .CreatedOn )
286295 }
287296
@@ -292,17 +301,18 @@ func (m *MetricsCollectorRelease) Collect(ctx context.Context, callback chan<- f
292301 }
293302
294303 releaseEnvironmentApprovalMetric .AddTime (prometheus.Labels {
295- "projectID" : project .Id ,
296- "releaseID" : int64ToString (release .Id ),
297- "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
298- "approvalType" : approval .ApprovalType ,
299- "status" : approval .Status ,
300- "isAutomated" : boolToString (approval .IsAutomated ),
301- "trialNumber" : int64ToString (approval .TrialNumber ),
302- "attempt" : int64ToString (approval .Attempt ),
303- "rank" : int64ToString (approval .Rank ),
304- "approver" : approval .Approver .DisplayName ,
305- "approvedBy" : approval .ApprovedBy .DisplayName ,
304+ "projectID" : project .Id ,
305+ "releaseID" : int64ToString (release .Id ),
306+ "releaseDefinitionID" : int64ToString (release .Definition .Id ),
307+ "environmentID" : int64ToString (environment .DefinitionEnvironmentId ),
308+ "approvalType" : approval .ApprovalType ,
309+ "status" : approval .Status ,
310+ "isAutomated" : boolToString (approval .IsAutomated ),
311+ "trialNumber" : int64ToString (approval .TrialNumber ),
312+ "attempt" : int64ToString (approval .Attempt ),
313+ "rank" : int64ToString (approval .Rank ),
314+ "approver" : approval .Approver .DisplayName ,
315+ "approvedBy" : approval .ApprovedBy .DisplayName ,
306316 }, approval .CreatedOn )
307317 }
308318 }
0 commit comments