diff --git a/exporter/prometheusremotewriteexporter/exporter.go b/exporter/prometheusremotewriteexporter/exporter.go index e9de101f46b..1cceb674cb6 100644 --- a/exporter/prometheusremotewriteexporter/exporter.go +++ b/exporter/prometheusremotewriteexporter/exporter.go @@ -91,10 +91,19 @@ func (prwe *prwExporter) pushMetrics(ctx context.Context, md pdata.Metrics) (int resourceMetrics := data.MetricDataToOtlp(pdatautil.MetricsToInternalMetrics(md)) for _, resourceMetric := range resourceMetrics { + if resourceMetric == nil { + continue + } // TODO: add resource attributes as labels, probably in next PR for _, instrumentationMetrics := range resourceMetric.InstrumentationLibraryMetrics { + if instrumentationMetrics == nil { + continue + } // TODO: decide if instrumentation library information should be exported as labels for _, metric := range instrumentationMetrics.Metrics { + if metric == nil { + continue + } // check for valid type and temporality combination if ok := validateMetrics(metric.MetricDescriptor); !ok { dropped++