open-telemetry / open-telemetry/weaver
[Refactor] Refactor CompoundError Usage to Distinguish Between True Errors and Diagnostic Messages
@lquerel is already working on this.
Since Apr 22, 2024.
- Dominant language
- Rust
- Stars
- 486
- Forks
- 108
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 40
Description
Currently, we collect as many errors as possible via the CompoundError mechanism. However, these "errors" are not typical Rust errors, but rather diagnostic messages intended for user reporting via the console. This approach is not ideal for several reasons:
- Inappropriate Usage of the Error Trait: The
Errortrait is being used for messages that do not represent actual errors requiring special attention or interrupting the program. - Complex Enum Structures: There is a need to create complex enums for "errors" where most variants are actually diagnostic messages resulting from the parsing and resolution processes of the semantic conventions.
- Delayed Reporting on the Console: These diagnostic messages are typically reported in batch rather than in real-time, which is not optimal for immediate feedback during development.
This design could potentially be improved by differentiating true errors from diagnostic messages, possibly through separate structures or mechanisms for handling these two types of outputs more appropriately.
This issue proposes the addition of the following definitions in the weaver_common crate:
- A struct named
DiagMessageto represent a generic diagnostic message, which will include details like location, message content, type (warning or error), and additional context. - A struct named
DiagChannelto facilitate the reporting ofDiagMessageinstances to aDiagMessageConsumer.
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.
Assessment
This issue has not been assessed yet.