Skip to content

Commit

Permalink
add check for nil
Browse files Browse the repository at this point in the history
  • Loading branch information
huyan0 committed Aug 28, 2020
1 parent 1529156 commit 24f4db3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions exporter/prometheusremotewriteexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down

0 comments on commit 24f4db3

Please sign in to comment.