Skip to content

Conversation

braydonk
Copy link
Contributor

@braydonk braydonk commented Oct 3, 2025

Description

This PR adds functionality for consumers to create a partial error type. This will allow consumers to properly report partial success/failure with failed item counts, which can subsequently be used when reporting sent/failed metrics.

Link to tracking issue

Part of #13423

Testing

Documentation

godoc comments are added to the new public functions in consumererror.

@braydonk braydonk requested review from a team, bogdandrutu and dmitryax as code owners October 3, 2025 13:47
@braydonk braydonk force-pushed the partial_error branch 2 times, most recently from 39ad8a4 to 8faf1e8 Compare October 3, 2025 13:52
This PR adds functionality for consumers to create a partial error type.
This will allow consumers to properly report partial success/failure with
failed item counts, which can subsequently be used when reporting
sent/failed metrics.
Copy link

codecov bot commented Oct 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.66%. Comparing base (14a7832) to head (e3b4ff4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13927      +/-   ##
==========================================
- Coverage   91.66%   91.66%   -0.01%     
==========================================
  Files         652      653       +1     
  Lines       42516    42531      +15     
==========================================
+ Hits        38973    38985      +12     
- Misses       2734     2736       +2     
- Partials      809      810       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

I don't have a lot of background on this module so no strong opinion on the API itself, but I do feel like the two items I commented below should be addressed before moving forward

Copy link
Member

Choose a reason for hiding this comment

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

I would rather have this in xconsumererror at the start, use it in contrib and once we are confident about it we move it to the 'stable' module

Copy link
Member

Choose a reason for hiding this comment

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

Could you add a testable example on how to use this?

Copy link
Contributor

@jmacd jmacd left a comment

Choose a reason for hiding this comment

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

I would like to see a draft, at least, for the documentation that will accompany the package, what the consumers need to know. For example, in the fanout consumer, existing logic returns immediately when one of the fanned-out consumers returns a non-nil error. I believe we need a blanket recommendation that these errors may be treated the same as success in cases like these.

However even while continuing the fan-out, the returned error should join all the partial successes with good information that an OTLP receiver can convey to SDKs and user consoles. Here are some general rules that might make sense to apply:

  • When applying the same request multiple times: concatenate partial-success message strings, take the maximum number of rejected items
  • When combining requests as in a batch processor, prepend "batch rejected %d items: " to the partial-success message, set number rejected to 0

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.

3 participants