Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions benchmarks/encodings/parquet/parquet.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ func (d *Encoding) Encode(data encodings.InMemoryData) ([]byte, error) {

func convertAttrs(attrs *otelstef.Attributes) (r []Attribute) {
for i := 0; i < attrs.Len(); i++ {
attr := attrs.At(i)
r = append(
r, Attribute{
Key: attr.Key(),
Value: string(attr.Value().String()),
Key: attrs.Key(i),
Value: string(attrs.Value(i).String()),
},
)
}
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/encodings/parquet/parquetz.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,10 @@ func (d *EncodingZ) Encode(data encodings.InMemoryData) ([]byte, error) {

func convertAttrsZ(attrs *otelstef.Attributes) (r []AttributeZ) {
for i := 0; i < attrs.Len(); i++ {
attr := attrs.At(i)
r = append(
r, AttributeZ{
Key: attr.Key(),
Value: string(attr.Value().String()),
Key: attrs.Key(i),
Value: string(attrs.Value(i).String()),
},
)
}
Expand Down
21 changes: 8 additions & 13 deletions examples/jsonl/internal/jsonstef/jsonobject.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/jsonl/json2stef.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func convertToJsonValue(src interface{}, dst *jsonstef.JsonValue) {

for _, k := range keys {
obj.SetKey(i, k)
convertToJsonValue(v[k], obj.At(i).Value())
convertToJsonValue(v[k], obj.Value(i))
i++
}
//obj.Sort()
Expand Down
21 changes: 8 additions & 13 deletions examples/profile/internal/profile/labels.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/profile/pprof2stef.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (c *pprof2stef) convertSample(srcSample *profile.Sample, srcProf *profile.P
for key, values := range srcSample.Label {
for _, value := range values {
dstLabels.SetKey(labelIndex, key)
dstLabelValue := dstLabels.At(labelIndex).Value()
dstLabelValue := dstLabels.Value(labelIndex)
dstLabelValue.SetStr(value)
labelIndex++
}
Expand All @@ -135,7 +135,7 @@ func (c *pprof2stef) convertSample(srcSample *profile.Sample, srcProf *profile.P
for key, values := range srcSample.NumLabel {
for _, value := range values {
dstLabels.SetKey(labelIndex, key)
dstLabelValue := dstLabels.At(labelIndex).Value()
dstLabelValue := dstLabels.Value(labelIndex)
dstLabelValue.SetType(stefprofile.LabelValueTypeNum)
numValue := dstLabelValue.Num()
numValue.SetVal(value)
Expand Down
4 changes: 2 additions & 2 deletions examples/profile/stef2pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ func convertStefToPprof(src io.Reader) (*profile.Profile, error) {

stefLabels := reader.Record.Labels()
for i := 0; i < stefLabels.Len(); i++ {
key := stefLabels.At(i).Key()
stefLabelValue := stefLabels.At(i).Value()
key := stefLabels.Key(i)
stefLabelValue := stefLabels.Value(i)

if stefLabelValue.Type() == stefprofile.LabelValueTypeStr {
value := stefLabelValue.Str()
Expand Down
18 changes: 8 additions & 10 deletions go/otel/manual_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func mapToTef(m map[string]any, out *otelstef.Attributes) {
sort.Strings(keys)

for _, k := range keys {
valueToTef(m[k], out.At(i).Value())
valueToTef(m[k], out.Value(i))
out.SetKey(i, k)
i++
}
Expand Down Expand Up @@ -184,7 +184,7 @@ func valueToTef(v any, into *otelstef.AnyValue) {
i := 0
for k, v := range val {
kvList.SetKey(i, k)
valueToTef(v, kvList.At(i).Value())
valueToTef(v, kvList.Value(i))
}

default:
Expand All @@ -196,9 +196,8 @@ func tefToMap(in *otelstef.Attributes) map[string]any {
out := map[string]any{}

for i := 0; i < in.Len(); i++ {
kv := in.At(i)
val := tefToValue(kv.Value())
out[kv.Key()] = val
val := tefToValue(in.Value(i))
out[in.Key(i)] = val
}
return out
}
Expand Down Expand Up @@ -236,9 +235,8 @@ func tefToValue(src *otelstef.AnyValue) any {
values := map[string]any{}
kvList := src.KVList()
for i := 0; i < kvList.Len(); i++ {
pair := kvList.At(i)
val := tefToValue(pair.Value())
values[pair.Key()] = val
val := tefToValue(kvList.Value(i))
values[kvList.Key(i)] = val
}
return values

Expand Down Expand Up @@ -410,7 +408,7 @@ func TestLargeMultimap(t *testing.T) {
attrs.EnsureLen(attrCount)
for i := 0; i < attrCount; i++ {
attrs.SetKey(i, strconv.Itoa(i))
attrs.At(i).Value().SetInt64(int64(i))
attrs.Value(i).SetInt64(int64(i))
}
var attrs1Copy otelstef.Attributes
attrs1Copy.CopyFrom(attrs)
Expand All @@ -420,7 +418,7 @@ func TestLargeMultimap(t *testing.T) {
// Modify one key. This normally would result in differential encoding
// but since the multimap is large it will use full encoding. This is
// precisely the case that this test verifies.
attrs.At(0).Value().SetString("abc")
attrs.Value(0).SetString("abc")
var attrs2Copy otelstef.Attributes
attrs2Copy.CopyFrom(attrs)
err = w.Write()
Expand Down
21 changes: 8 additions & 13 deletions go/otel/otelstef/attributes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 9 additions & 14 deletions go/otel/otelstef/envelopeattributes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 8 additions & 13 deletions go/otel/otelstef/keyvaluelist.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions go/pdata/internal/otlptools/otlpval2tef.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (o *Otlp2Stef) MapSorted(m pcommon.Map, out *otelstef.Attributes) {

out.EnsureLen(m.Len())
for i := range o.attrElems {
otlpValueToTefAnyValue(o.attrElems[i].val, out.At(i).Value())
otlpValueToTefAnyValue(o.attrElems[i].val, out.Value(i))
out.SetKey(i, o.attrElems[i].str)
}
}
Expand All @@ -92,7 +92,7 @@ func (o *Otlp2Stef) MapUnsorted(m pcommon.Map, out *otelstef.Attributes) {
i := 0
m.Range(
func(k string, v pcommon.Value) bool {
otlpValueToTefAnyValue(v, out.At(i).Value())
otlpValueToTefAnyValue(v, out.Value(i))
out.SetKey(i, k)
i++
return true
Expand Down Expand Up @@ -138,7 +138,7 @@ func otlpValueToTefAnyValue(val pcommon.Value, into *otelstef.AnyValue) {
val.Map().Range(
func(k string, v pcommon.Value) bool {
kvList.SetKey(i, k)
otlpValueToTefAnyValue(v, kvList.At(i).Value())
otlpValueToTefAnyValue(v, kvList.Value(i))
return true
},
)
Expand Down
11 changes: 4 additions & 7 deletions go/pdata/internal/otlptools/tef2otlpval.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ func TefToOtlpMap(in *otelstef.Attributes, out pcommon.Map) error {

//decoder := anyvalue.Decoder{}
for i := 0; i < in.Len(); i++ {
kv := in.At(i)
val := out.PutEmpty(kv.Key())
//decoder.Reset(anyvalue.ImmutableBytes(kv.Value()))
err := tefAnyValueToOtlp(kv.Value(), val)
val := out.PutEmpty(in.Key(i))
err := tefAnyValueToOtlp(in.Value(i), val)
if err != nil {
return err
}
Expand Down Expand Up @@ -77,9 +75,8 @@ func tefAnyValueToOtlp(anyVal *otelstef.AnyValue, into pcommon.Value) error {
values := into.SetEmptyMap()
kvList := anyVal.KVList()
for i := 0; i < kvList.Len(); i++ {
pair := kvList.At(i)
val := values.PutEmpty(pair.Key())
err := tefAnyValueToOtlp(pair.Value(), val)
val := values.PutEmpty(kvList.Key(i))
err := tefAnyValueToOtlp(kvList.Value(i), val)
if err != nil {
return err
}
Expand Down
Loading
Loading