9
9
"sync"
10
10
"time"
11
11
12
+ "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil"
13
+
12
14
"go.opentelemetry.io/collector/component"
13
15
"go.opentelemetry.io/collector/consumer"
14
16
"go.opentelemetry.io/collector/pdata/pcommon"
@@ -29,7 +31,7 @@ type metricsConnector struct {
29
31
config Config
30
32
31
33
// Additional dimensions to add to metrics.
32
- dimensions []dimension
34
+ dimensions []pdatautil. Dimension
33
35
34
36
keyBuf * bytes.Buffer
35
37
@@ -175,16 +177,16 @@ func (c *metricsConnector) addExemplar(exc *exception, traceID pcommon.TraceID,
175
177
e .SetDoubleValue (float64 (exc .count ))
176
178
}
177
179
178
- func buildDimensionKVs (dimensions []dimension , serviceName string , span ptrace.Span , eventAttrs pcommon.Map , resourceAttrs pcommon.Map ) pcommon.Map {
180
+ func buildDimensionKVs (dimensions []pdatautil. Dimension , serviceName string , span ptrace.Span , eventAttrs pcommon.Map , resourceAttrs pcommon.Map ) pcommon.Map {
179
181
dims := pcommon .NewMap ()
180
182
dims .EnsureCapacity (3 + len (dimensions ))
181
183
dims .PutStr (serviceNameKey , serviceName )
182
184
dims .PutStr (spanNameKey , span .Name ())
183
185
dims .PutStr (spanKindKey , traceutil .SpanKindStr (span .Kind ()))
184
186
dims .PutStr (statusCodeKey , traceutil .StatusCodeStr (span .Status ().Code ()))
185
187
for _ , d := range dimensions {
186
- if v , ok := getDimensionValue (d , span .Attributes (), eventAttrs , resourceAttrs ); ok {
187
- v .CopyTo (dims .PutEmpty (d .name ))
188
+ if v , ok := pdatautil . GetDimensionValue (d , span .Attributes (), eventAttrs , resourceAttrs ); ok {
189
+ v .CopyTo (dims .PutEmpty (d .Name ))
188
190
}
189
191
}
190
192
return dims
@@ -195,7 +197,7 @@ func buildDimensionKVs(dimensions []dimension, serviceName string, span ptrace.S
195
197
// or resource attributes. If the dimension exists in both, the span's attributes, being the most specific, takes precedence.
196
198
//
197
199
// The metric key is a simple concatenation of dimension values, delimited by a null character.
198
- func buildKey (dest * bytes.Buffer , serviceName string , span ptrace.Span , optionalDims []dimension , eventAttrs pcommon.Map , resourceAttrs pcommon.Map ) {
200
+ func buildKey (dest * bytes.Buffer , serviceName string , span ptrace.Span , optionalDims []pdatautil. Dimension , eventAttrs pcommon.Map , resourceAttrs pcommon.Map ) {
199
201
concatDimensionValue (dest , serviceName , false )
200
202
concatDimensionValue (dest , span .Name (), true )
201
203
concatDimensionValue (dest , traceutil .SpanKindStr (span .Kind ()), true )
0 commit comments