Skip to content

refactor(tracing): refactor internal code and improve docs #839

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

Merged
merged 5 commits into from
Jun 16, 2025

Conversation

lcian
Copy link
Member

@lcian lcian commented Jun 12, 2025

  • Refactor some code in preparation for the logs integration
  • No breaking changes
  • Improve the docs a little
  • Test that a breadcrumb with errors carries the stringified error chain, behavior we added in refactor(tracing): remove EventFilter::exception and always attach exception #768
  • It's also a behavioral change because we were previously attaching all error fields in an errors field in the JSON data of the breadcrumb, which doesn't make much sense. Now we'll store them in separate fields, retaining the original name

example:

            tracing::info!(
                database_error = &db_error as &dyn Error,
                parse_error = &parse_error as &dyn Error,
                retry_count = 3,
                connection_timeout = "30s",
                "Multiple errors occurred during database operation"
            );

Before:
Screenshot 2025-06-12 at 13 27 15

After:
Screenshot 2025-06-12 at 13 27 41

pub(crate) exceptions: Vec<Exception>,
/// If `true`, stringify and store errors in `self.json_values` under the original field name
/// else (default), convert to `Exception`s and store in `self.exceptions`.
store_errors_in_values: bool,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of this PR, store_errors_in_values = true will be used for breadcrumbs.
We will use the same behavior for logs, so instead of duplicating code we make it a flag here on the visitor

Copy link

codecov bot commented Jun 12, 2025

Codecov Report

Attention: Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.40%. Comparing base (2b1455b) to head (97b7361).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #839      +/-   ##
==========================================
+ Coverage   73.36%   73.40%   +0.03%     
==========================================
  Files          64       64              
  Lines        7678     7682       +4     
==========================================
+ Hits         5633     5639       +6     
+ Misses       2045     2043       -2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lcian lcian marked this pull request as draft June 12, 2025 10:41
@lcian lcian marked this pull request as ready for review June 12, 2025 11:32
@lcian lcian requested a review from Swatinem June 13, 2025 08:28
@lcian lcian merged commit c42ed3f into master Jun 16, 2025
18 checks passed
@lcian lcian deleted the lcian/ref/tracing branch June 16, 2025 13:20
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

Successfully merging this pull request may close these issues.

2 participants