opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

Allow creation of AttributeValue from nostd::span<const char*>

Open sirzooro opened this issue 3 years ago • 4 comments
trafficstars

Is your feature request related to a problem? For debugging purposes I would like to add current callstack as an attribute to a span. backtrace_symbols returns char**, so I would like to use it directly and pass to span->SetAttribute(...), wrapped in nostd::span<const char*>. Now this is not possible, AttributeValue cannot be created from nostd::span<const char*>.

Describe the solution you'd like Allow creation of AttributeValue from nostd::span<const char*>.

Describe alternatives you've considered Now I need to create extra std::vector<opentelemetry::nostd::string_view> as a workaround.

sirzooro avatar May 25 '22 11:05 sirzooro

This is a valid use case. Though adding any new type in AttributeValue will break the ABI compliance.

lalitb avatar Jun 02 '22 18:06 lalitb

@sirzooro - We discussed in the community meeting, that it would be good to support nostd::span<const char*>. Do you have plans to add the support?

lalitb avatar Jun 06 '22 20:06 lalitb

Could we also add nostd::span<std::string> if we are planing to break ABI? We can assign std::vector<std::string> and google::protobuf::RepeatedPtrField<std::string> to nostd::span<std::string> directly . We must create a container of string_view and keep the same lifetime with the container of std::string now. It's expensive.

owent avatar Jun 07 '22 03:06 owent

This issue was marked as stale due to lack of activity.

github-actions[bot] avatar Aug 07 '22 02:08 github-actions[bot]