Skip to content

Commit d444f47

Browse files
authored
[chore] Apply new Map.PutEmptyBytes method (#14128)
1 parent ec55269 commit d444f47

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

cmd/mdatagen/metrics.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (m *metric{{ $name.Render }}) recordDataPoint(start pcommon.Timestamp, ts p
113113
{{- else if eq (attributeInfo .).Type.Primitive "float64" }}
114114
dp.Attributes().PutDouble("{{ attributeKey .}}", {{ .RenderUnexported }}AttributeValue)
115115
{{- else if eq (attributeInfo .).Type.Primitive "[]byte" }}
116-
dp.Attributes().PutEmpty("{{ attributeKey .}}").SetEmptyBytesVal().FromRaw({{ .RenderUnexported }}AttributeValue)
116+
dp.Attributes().PutEmptyBytes("{{ attributeKey .}}").FromRaw({{ .RenderUnexported }}AttributeValue)
117117
{{- else }}
118118
dp.Attributes().PutString("{{ attributeKey .}}", {{ .RenderUnexported }}AttributeValue)
119119
{{- end }}

pkg/stanza/adapter/converter_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func TestConvert(t *testing.T) {
222222
m.PutInt("int", 123)
223223
m.PutDouble("double", 12.34)
224224
m.PutString("string", "hello")
225-
m.PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte("asdf"))
225+
m.PutEmptyBytes("bytes").FromRaw([]byte("asdf"))
226226
assert.EqualValues(t, m.Sort(), lr.Body().MapVal().Sort())
227227
}
228228
}

pkg/stanza/adapter/frompdataconverter_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func fillBaseMap(m pcommon.Map) {
5555
m.PutInt("int", 123)
5656
m.PutDouble("double", 12.34)
5757
m.PutString("string", "hello")
58-
m.PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{0xa1, 0xf0, 0x02, 0xff})
58+
m.PutEmptyBytes("bytes").FromRaw([]byte{0xa1, 0xf0, 0x02, 0xff})
5959
}
6060

6161
func complexPdataForNDifferentHosts(count int, n int) plog.Logs {

pkg/telemetryquerylanguage/contexts/internal/tqlcommon/resource_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func TestResourcePathGetSetter(t *testing.T) {
126126
orig: []byte{1, 3, 2},
127127
newVal: []byte{2, 3, 4},
128128
modified: func(resource pcommon.Resource) {
129-
resource.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{2, 3, 4})
129+
resource.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{2, 3, 4})
130130
},
131131
},
132132
{
@@ -254,7 +254,7 @@ func createResource() pcommon.Resource {
254254
resource.Attributes().PutBool("bool", true)
255255
resource.Attributes().PutInt("int", 10)
256256
resource.Attributes().PutDouble("double", 1.2)
257-
resource.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{1, 3, 2})
257+
resource.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{1, 3, 2})
258258

259259
arrStr := resource.Attributes().PutEmptySlice("arr_str")
260260
arrStr.AppendEmpty().SetStringVal("one")

pkg/telemetryquerylanguage/contexts/internal/tqlcommon/scope_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func TestScopePathGetSetter(t *testing.T) {
151151
orig: []byte{1, 3, 2},
152152
newVal: []byte{2, 3, 4},
153153
modified: func(is pcommon.InstrumentationScope) {
154-
is.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{2, 3, 4})
154+
is.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{2, 3, 4})
155155
},
156156
},
157157
{
@@ -274,7 +274,7 @@ func createInstrumentationScope() pcommon.InstrumentationScope {
274274
is.Attributes().PutBool("bool", true)
275275
is.Attributes().PutInt("int", 10)
276276
is.Attributes().PutDouble("double", 1.2)
277-
is.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{1, 3, 2})
277+
is.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{1, 3, 2})
278278

279279
arrStr := is.Attributes().PutEmptySlice("arr_str")
280280
arrStr.AppendEmpty().SetStringVal("one")

pkg/telemetryquerylanguage/contexts/tqllogs/logs_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func Test_newPathGetSetter(t *testing.T) {
264264
orig: []byte{1, 3, 2},
265265
newVal: []byte{2, 3, 4},
266266
modified: func(log plog.LogRecord, il pcommon.InstrumentationScope, resource pcommon.Resource) {
267-
log.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{2, 3, 4})
267+
log.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{2, 3, 4})
268268
},
269269
},
270270
{
@@ -425,7 +425,7 @@ func createTelemetry() (plog.LogRecord, pcommon.InstrumentationScope, pcommon.Re
425425
log.Attributes().PutBool("bool", true)
426426
log.Attributes().PutInt("int", 10)
427427
log.Attributes().PutDouble("double", 1.2)
428-
log.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{1, 3, 2})
428+
log.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{1, 3, 2})
429429

430430
arrStr := log.Attributes().PutEmptySlice("arr_str")
431431
arrStr.AppendEmpty().SetStringVal("one")

pkg/telemetryquerylanguage/contexts/tqlmetrics/metrics_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func Test_newPathGetSetter_NumberDataPoint(t *testing.T) {
199199
orig: []byte{1, 3, 2},
200200
newVal: []byte{2, 3, 4},
201201
modified: func(datapoint pmetric.NumberDataPoint) {
202-
datapoint.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{2, 3, 4})
202+
datapoint.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{2, 3, 4})
203203
},
204204
},
205205
{
@@ -525,7 +525,7 @@ func Test_newPathGetSetter_HistogramDataPoint(t *testing.T) {
525525
orig: []byte{1, 3, 2},
526526
newVal: []byte{2, 3, 4},
527527
modified: func(datapoint pmetric.HistogramDataPoint) {
528-
datapoint.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{2, 3, 4})
528+
datapoint.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{2, 3, 4})
529529
},
530530
},
531531
{
@@ -947,7 +947,7 @@ func Test_newPathGetSetter_ExpoHistogramDataPoint(t *testing.T) {
947947
orig: []byte{1, 3, 2},
948948
newVal: []byte{2, 3, 4},
949949
modified: func(datapoint pmetric.ExponentialHistogramDataPoint) {
950-
datapoint.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{2, 3, 4})
950+
datapoint.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{2, 3, 4})
951951
},
952952
},
953953
{
@@ -1254,7 +1254,7 @@ func Test_newPathGetSetter_SummaryDataPoint(t *testing.T) {
12541254
orig: []byte{1, 3, 2},
12551255
newVal: []byte{2, 3, 4},
12561256
modified: func(datapoint pmetric.SummaryDataPoint) {
1257-
datapoint.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{2, 3, 4})
1257+
datapoint.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{2, 3, 4})
12581258
},
12591259
},
12601260
{
@@ -1383,7 +1383,7 @@ func createAttributeTelemetry(attributes pcommon.Map) {
13831383
attributes.PutBool("bool", true)
13841384
attributes.PutInt("int", 10)
13851385
attributes.PutDouble("double", 1.2)
1386-
attributes.PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{1, 3, 2})
1386+
attributes.PutEmptyBytes("bytes").FromRaw([]byte{1, 3, 2})
13871387

13881388
arrStr := attributes.PutEmptySlice("arr_str")
13891389
arrStr.AppendEmpty().SetStringVal("one")

pkg/telemetryquerylanguage/contexts/tqltraces/traces_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func Test_newPathGetSetter(t *testing.T) {
287287
orig: []byte{1, 3, 2},
288288
newVal: []byte{2, 3, 4},
289289
modified: func(span ptrace.Span, il pcommon.InstrumentationScope, resource pcommon.Resource) {
290-
span.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{2, 3, 4})
290+
span.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{2, 3, 4})
291291
},
292292
},
293293
{
@@ -554,7 +554,7 @@ func createTelemetry() (ptrace.Span, pcommon.InstrumentationScope, pcommon.Resou
554554
span.Attributes().PutBool("bool", true)
555555
span.Attributes().PutInt("int", 10)
556556
span.Attributes().PutDouble("double", 1.2)
557-
span.Attributes().PutEmpty("bytes").SetEmptyBytesVal().FromRaw([]byte{1, 3, 2})
557+
span.Attributes().PutEmptyBytes("bytes").FromRaw([]byte{1, 3, 2})
558558

559559
arrStr := span.Attributes().PutEmptySlice("arr_str")
560560
arrStr.AppendEmpty().SetStringVal("one")

receiver/solacereceiver/unmarshaller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ func (u *solaceMessageUnmarshallerV1) insertUserProperty(toMap pcommon.Map, key
431431
case *model_v1.SpanData_UserPropertyValue_DoubleValue:
432432
toMap.PutDouble(k, v.DoubleValue)
433433
case *model_v1.SpanData_UserPropertyValue_ByteArrayValue:
434-
toMap.PutEmpty(k).SetEmptyBytesVal().FromRaw(v.ByteArrayValue)
434+
toMap.PutEmptyBytes(k).FromRaw(v.ByteArrayValue)
435435
case *model_v1.SpanData_UserPropertyValue_FloatValue:
436436
toMap.PutDouble(k, float64(v.FloatValue))
437437
case *model_v1.SpanData_UserPropertyValue_Int8Value:

0 commit comments

Comments
 (0)