open-telemetry / open-telemetry/weaver

[Refactor] Refactor CompoundError Usage to Distinguish Between True Errors and Diagnostic Messages

Open
#124 5 comments 0 reactions 1 assignee View on GitHub

@lquerel is already working on this.

Since Apr 22, 2024.

enhancement
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 Error trait 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 DiagMessage to represent a generic diagnostic message, which will include details like location, message content, type (warning or error), and additional context.
  • A struct named DiagChannel to facilitate the reporting of DiagMessage instances to a DiagMessageConsumer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.