Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdata/pcommon : export NewSliceFromRaw #5617

Closed
ldb opened this issue Jul 3, 2022 · 5 comments
Closed

pdata/pcommon : export NewSliceFromRaw #5617

ldb opened this issue Jul 3, 2022 · 5 comments

Comments

@ldb
Copy link

ldb commented Jul 3, 2022

Is your feature request related to a problem? Please describe.
Right now, the apparently only way to create slices Values and adding them to a span's attributes is pretty unergonomic:

s := pcommon.NewSlice()
s.EnsureCapacity(1)
v := b.AppendEmpty()
v.SetStringVal("bar")
vs := pcommon.NewValueSlice()
s.CopyTo(vs.SliceVal())
span.Attributes().Insert("foo", vs)

This could be made much easier by exporting pcommon.NewSliceFromRaw() in the same way that pcommon.NewMapFromRaw() is already exported.

Describe the solution you'd like
Export internal.NewSliceFromRaw to make it easier to create slices to be used as attribute values.

@ldb ldb changed the title pdata/pcommon : export NewSlice and NewSliceFromRaw pdata/pcommon : export NewSliceFromRaw Jul 3, 2022
@TylerHelmuth
Copy link
Member

pinging @dmitryax

@dmitryax
Copy link
Member

Makes sense. This is actually something that was missed in #5311.

@ldb do you want to submit a PR?

@TylerHelmuth
Copy link
Member

@ldb if you are unavailable I can take it

@ldb
Copy link
Author

ldb commented Jul 14, 2022

Hey @dmitryax and @TylerHelmuth, sorry I only now saw the response here. Would've loved to open a PR for this, but now there is no need I see :)
Thanks for fixing this so quickly!

@TylerHelmuth
Copy link
Member

@dmitryax This issue can be closed. @ldb Thanks for bringing this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants