open-telemetry / open-telemetry/opentelemetry-cpp
SpanData should define virtual explicit operator SpanData *() const { .... }
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 632
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 75
Description
...because base class trace_sdk::Recordable defines it. Currently, the conversion operator always produces nullptr even if the real class pointed to is SpanData, SpanData does not override the operator, but it should. https://github.com/open-telemetry/opentelemetry-cpp/blob/054b0dc207c1f58e290d78cdaac5f314bc328b31/sdk/include/opentelemetry/sdk/trace/recordable.h#L174C3-L174C67
Workaround for the moment: Use of dynamic_cast(recordablePtr)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with sdk/include/opentelemetry/sdk/trace/recordable.h at the referenced conversion operator and inspect how SpanData relates to trace_sdk::Recordable. Define the explicit SpanData conversion there so a SpanData instance is returned instead of nullptr; the issue is done when this removes the need for the documented dynamic_cast workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100