@@ -87,11 +87,17 @@ func (m *MetricsCollectorIncident) Collect(ctx context.Context, callback chan<-
8787 }
8888
8989 for _ , incident := range list .Incidents {
90+ // workaround for https://github.com/PagerDuty/go-pagerduty/issues/218
91+ incidentId := incident .ID
92+ if incidentId == "" && incident .Id != "" {
93+ incidentId = incident .Id
94+ }
95+
9096 // info
9197 createdAt , _ := time .Parse (time .RFC3339 , incident .CreatedAt )
9298
9399 incidentMetricList .AddTime (prometheus.Labels {
94- "incidentID" : incident . Id ,
100+ "incidentID" : incidentId ,
95101 "serviceID" : incident .Service .ID ,
96102 "incidentUrl" : incident .HTMLURL ,
97103 "incidentNumber" : uintToString (incident .IncidentNumber ),
@@ -108,7 +114,7 @@ func (m *MetricsCollectorIncident) Collect(ctx context.Context, callback chan<-
108114 for _ , acknowledgement := range incident .Acknowledgements {
109115 createdAt , _ := time .Parse (time .RFC3339 , acknowledgement .At )
110116 incidentStatusMetricList .AddTime (prometheus.Labels {
111- "incidentID" : incident . Id ,
117+ "incidentID" : incidentId ,
112118 "userID" : acknowledgement .Acknowledger .ID ,
113119 "time" : createdAt .Format (opts .PagerDutyIncidentTimeFormat ),
114120 "type" : "acknowledgement" ,
@@ -119,7 +125,7 @@ func (m *MetricsCollectorIncident) Collect(ctx context.Context, callback chan<-
119125 for _ , assignment := range incident .Assignments {
120126 createdAt , _ := time .Parse (time .RFC3339 , assignment .At )
121127 incidentStatusMetricList .AddTime (prometheus.Labels {
122- "incidentID" : incident . Id ,
128+ "incidentID" : incidentId ,
123129 "userID" : assignment .Assignee .ID ,
124130 "time" : createdAt .Format (opts .PagerDutyIncidentTimeFormat ),
125131 "type" : "assignment" ,
@@ -129,7 +135,7 @@ func (m *MetricsCollectorIncident) Collect(ctx context.Context, callback chan<-
129135 // lastChange
130136 changedAt , _ := time .Parse (time .RFC3339 , incident .LastStatusChangeAt )
131137 incidentStatusMetricList .AddTime (prometheus.Labels {
132- "incidentID" : incident . Id ,
138+ "incidentID" : incidentId ,
133139 "userID" : incident .LastStatusChangeBy .ID ,
134140 "time" : changedAt .Format (opts .PagerDutyIncidentTimeFormat ),
135141 "type" : "lastChange" ,
0 commit comments