Skip to content

Commit

Permalink
Update instrumentation naming in accordance with otel spec. (#3733)
Browse files Browse the repository at this point in the history
* Update instrumentation naming in accordance with otel spec.

* Fix missing aggregation temporality on histograms.

* Use conventions package.
  • Loading branch information
a-feld authored Jun 10, 2021
1 parent 038be62 commit 22f1a40
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions exporter/newrelicexporter/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/newrelic/newrelic-telemetry-sdk-go/telemetry"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer/pdata"
"go.opentelemetry.io/collector/translator/conventions"
tracetranslator "go.opentelemetry.io/collector/translator/trace"
"go.uber.org/zap"
)
Expand All @@ -33,8 +34,8 @@ const (
descriptionAttrKey = "description"
collectorNameKey = "collector.name"
collectorVersionKey = "collector.version"
instrumentationNameKey = "instrumentation.name"
instrumentationVersionKey = "instrumentation.version"
instrumentationNameKey = conventions.InstrumentationLibraryName
instrumentationVersionKey = conventions.InstrumentationLibraryVersion
droppedAttributesCountKey = "otel.dropped_attributes_count"
droppedEventsCountKey = "otel.dropped_events_count"
statusCodeKey = "otel.status_code"
Expand Down Expand Up @@ -377,12 +378,14 @@ func (t *transformer) Metric(m pdata.Metric) ([]telemetry.Metric, error) {
}
}
case pdata.MetricDataTypeIntHistogram:
t.details.metricMetadataCount[k]++
hist := m.IntHistogram()
k.MetricTemporality = hist.AggregationTemporality()
t.details.metricMetadataCount[k]++
return nil, &errUnsupportedMetricType{metricType: k.MetricType.String(), metricName: m.Name(), numDataPoints: hist.DataPoints().Len()}
case pdata.MetricDataTypeHistogram:
t.details.metricMetadataCount[k]++
hist := m.Histogram()
k.MetricTemporality = hist.AggregationTemporality()
t.details.metricMetadataCount[k]++
return nil, &errUnsupportedMetricType{metricType: k.MetricType.String(), metricName: m.Name(), numDataPoints: hist.DataPoints().Len()}
case pdata.MetricDataTypeSummary:
t.details.metricMetadataCount[k]++
Expand Down

0 comments on commit 22f1a40

Please sign in to comment.