@@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"context"
5
+ "strings"
5
6
"time"
6
7
7
8
"github.com/prometheus/client_golang/prometheus"
@@ -306,8 +307,9 @@ func (m *MetricsCollectorBuild) collectBuildsTimeline(ctx context.Context, logge
306
307
for _ , build := range list .List {
307
308
timelineRecordList , _ := AzureDevopsClient .ListBuildTimeline (project .Id , int64ToString (build .Id ))
308
309
for _ , timelineRecord := range timelineRecordList .List {
309
- switch recordType := timelineRecord .RecordType ; recordType {
310
- case "Stage" :
310
+ recordType := timelineRecord .RecordType ;
311
+ switch strings .ToLower (recordType ) {
312
+ case "stage" :
311
313
buildStageMetric .Add (prometheus.Labels {
312
314
"projectID" : project .Id ,
313
315
"buildID" : int64ToString (build .Id ),
@@ -380,7 +382,7 @@ func (m *MetricsCollectorBuild) collectBuildsTimeline(ctx context.Context, logge
380
382
"type" : "duration" ,
381
383
}, timelineRecord .FinishTime .Sub (timelineRecord .StartTime ))
382
384
383
- case "Phase " :
385
+ case "phase " :
384
386
buildPhaseMetric .Add (prometheus.Labels {
385
387
"projectID" : project .Id ,
386
388
"buildID" : int64ToString (build .Id ),
@@ -458,7 +460,8 @@ func (m *MetricsCollectorBuild) collectBuildsTimeline(ctx context.Context, logge
458
460
"result" : timelineRecord .Result ,
459
461
"type" : "duration" ,
460
462
}, timelineRecord .FinishTime .Sub (timelineRecord .StartTime ))
461
- case "Job" :
463
+
464
+ case "job" :
462
465
buildJobMetric .Add (prometheus.Labels {
463
466
"projectID" : project .Id ,
464
467
"buildID" : int64ToString (build .Id ),
@@ -536,7 +539,8 @@ func (m *MetricsCollectorBuild) collectBuildsTimeline(ctx context.Context, logge
536
539
"result" : timelineRecord .Result ,
537
540
"type" : "duration" ,
538
541
}, timelineRecord .FinishTime .Sub (timelineRecord .StartTime ))
539
- case "Task" :
542
+
543
+ case "task" :
540
544
buildTaskMetric .Add (prometheus.Labels {
541
545
"projectID" : project .Id ,
542
546
"buildID" : int64ToString (build .Id ),
@@ -614,9 +618,7 @@ func (m *MetricsCollectorBuild) collectBuildsTimeline(ctx context.Context, logge
614
618
"result" : timelineRecord .Result ,
615
619
"type" : "duration" ,
616
620
}, timelineRecord .FinishTime .Sub (timelineRecord .StartTime ))
617
-
618
621
}
619
-
620
622
}
621
623
}
622
624
0 commit comments