@@ -51,6 +51,7 @@ func (m *MetricsCollectorRelease) Setup(collector *CollectorProject) {
51
51
[]string {
52
52
"projectID" ,
53
53
"releaseID" ,
54
+ "releaseDefinitionID" ,
54
55
"sourceId" ,
55
56
"repositoryID" ,
56
57
"branch" ,
@@ -68,6 +69,7 @@ func (m *MetricsCollectorRelease) Setup(collector *CollectorProject) {
68
69
[]string {
69
70
"projectID" ,
70
71
"releaseID" ,
72
+ "releaseDefinitionID" ,
71
73
"environmentID" ,
72
74
"environmentName" ,
73
75
"status" ,
@@ -84,6 +86,7 @@ func (m *MetricsCollectorRelease) Setup(collector *CollectorProject) {
84
86
[]string {
85
87
"projectID" ,
86
88
"releaseID" ,
89
+ "releaseDefinitionID" ,
87
90
"environmentID" ,
88
91
"type" ,
89
92
},
@@ -97,6 +100,7 @@ func (m *MetricsCollectorRelease) Setup(collector *CollectorProject) {
97
100
[]string {
98
101
"projectID" ,
99
102
"releaseID" ,
103
+ "releaseDefinitionID" ,
100
104
"environmentID" ,
101
105
"approvalType" ,
102
106
"status" ,
@@ -228,40 +232,44 @@ func (m *MetricsCollectorRelease) Collect(ctx context.Context, callback chan<- f
228
232
229
233
for _ , artifact := range release .Artifacts {
230
234
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 ,
239
244
})
240
245
}
241
246
242
247
for _ , environment := range release .Environments {
243
248
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 ),
251
257
})
252
258
253
259
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" ,
258
265
}, environment .CreatedOn )
259
266
260
267
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" ,
265
273
}, environment .TimeToDeploy * 60 )
266
274
267
275
for _ , approval := range environment .PreDeployApprovals {
@@ -271,17 +279,18 @@ func (m *MetricsCollectorRelease) Collect(ctx context.Context, callback chan<- f
271
279
}
272
280
273
281
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 ,
285
294
}, approval .CreatedOn )
286
295
}
287
296
@@ -292,17 +301,18 @@ func (m *MetricsCollectorRelease) Collect(ctx context.Context, callback chan<- f
292
301
}
293
302
294
303
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 ,
306
316
}, approval .CreatedOn )
307
317
}
308
318
}
0 commit comments