Skip to content

Commit 8d7aa5c

Browse files
committed
check payload type
1 parent 4e207ed commit 8d7aa5c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/extensions/prometheus-metrics/prometheus_exporter.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ func (e *Exporter) SetLatestMetricReports(data []core.Payload) {
2626
e.latestMetricReports.Data = nil
2727

2828
for _, report := range data {
29-
e.latestMetricReports.Data = append(e.latestMetricReports.Data, report.(*proto.MetricsReport))
29+
if metricReport, ok := report.(*proto.MetricsReport); ok {
30+
e.latestMetricReports.Data = append(e.latestMetricReports.Data, metricReport)
31+
}
3032
}
3133
}
3234

test/performance/vendor/github.com/nginx/agent/v2/src/extensions/prometheus-metrics/prometheus_exporter.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)