File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,13 @@ func ResourceMetricsToMetricsData(resourceMetrics *otlpmetrics.ResourceMetrics)
4949 Resource : resource ,
5050 }
5151
52- // TODO: Do not ignore InstrumentationLibrary properties
53-
5452 if len (resourceMetrics .InstrumentationLibraryMetrics ) == 0 {
5553 return md
5654 }
5755
58- // This is a size approximation.
56+ // Allocate slice with a capacity approximated for the case when there is only one
57+ // InstrumentationLibrary or the first InstrumentationLibrary contains most of the data.
58+ // This is a best guess only that reduced slice re-allocations.
5959 metrics := make ([]* ocmetrics.Metric , 0 , len (resourceMetrics .InstrumentationLibraryMetrics [0 ].Metrics ))
6060 for _ , il := range resourceMetrics .InstrumentationLibraryMetrics {
6161 for _ , metric := range il .Metrics {
Original file line number Diff line number Diff line change @@ -52,13 +52,13 @@ func ResourceSpansToTraceData(resourceSpans *otlptrace.ResourceSpans) consumerda
5252 SourceFormat : sourceFormat ,
5353 }
5454
55- // TODO: Do not ignore InstrumentationLibrary properties
56-
5755 if len (resourceSpans .InstrumentationLibrarySpans ) == 0 {
5856 return td
5957 }
6058
61- // This is a size approximation.
59+ // Allocate slice with a capacity approximated for the case when there is only one
60+ // InstrumentationLibrary or the first InstrumentationLibrary contains most of the data.
61+ // This is a best guess only that reduced slice re-allocations.
6262 spans := make ([]* octrace.Span , 0 , len (resourceSpans .InstrumentationLibrarySpans [0 ].Spans ))
6363 for _ , ils := range resourceSpans .InstrumentationLibrarySpans {
6464 for _ , span := range ils .Spans {
You can’t perform that action at this time.
0 commit comments