Skip to content
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

[pkg/stanza] Fix - Operators with DropOnErrorQuiet should drop log en… #35834

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

SamerJ
Copy link
Contributor

@SamerJ SamerJ commented Oct 16, 2024

Description

Fixed issue in which Operators with DropOnErrorQuiet are not dropping log entries on error.

Note: This issue was introduced by a bug fix meant to ensure Silent Operators are not logging errors (#35010). With this fix,
this side effect bug has been resolved.

Link to tracking issue

Fixes 35010

Testing

Added UT

@SamerJ SamerJ requested review from djaglowski and a team as code owners October 16, 2024 14:52
Copy link

linux-foundation-easycla bot commented Oct 16, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@SamerJ SamerJ force-pushed the fix/parser/error-propagation branch 3 times, most recently from 5bb0df7 to d0e2b3f Compare October 17, 2024 14:25
@SamerJ SamerJ force-pushed the fix/parser/error-propagation branch from d0e2b3f to bbc8a76 Compare October 23, 2024 09:56
@SamerJ
Copy link
Contributor Author

SamerJ commented Oct 23, 2024

@fatsheep9146
Let me know why you think.
Also, should there be any questions, let me know 😄 .

Comment on lines -109 to -111
if t.OnError == SendOnErrorQuiet || t.OnError == DropOnErrorQuiet {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Why is this removed?

Copy link
Contributor Author

@SamerJ SamerJ Oct 25, 2024

Choose a reason for hiding this comment

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

The error returned by this method isn't soley used to log a message. Sometimes the error is read and based on that we decide if a log entry should be dropped or not.
A concrete example would be https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.112.0/pkg/stanza/operator/helper/parser.go#L111

I was fearful of any refactoring because I could be going against a possible design tragectory set for this code.

Copy link
Member

@djaglowski djaglowski Oct 25, 2024

Choose a reason for hiding this comment

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

Won't this change result in a problem for transformers that are not parsers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was not too fearful of removing this block, because it didn't exist before my previous PR #35010
That being said, I see your point.
My rational is as such:
We can't replace an error with nil at this level as that would make it impossible for the caller to know if they should drop the entry or send it.
The caller has visibility on the config like OnError, so I ended moving the responsibility to the caller.

Let me know what you think.

@djaglowski djaglowski merged commit 1e41cec into open-telemetry:main Oct 28, 2024
158 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 28, 2024
jpbarto pushed a commit to jpbarto/opentelemetry-collector-contrib that referenced this pull request Oct 29, 2024
open-telemetry#35834)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Fixed issue in which Operators with DropOnErrorQuiet are not dropping
log entries on error.

Note: This issue was introduced by a bug fix meant to ensure Silent
Operators are not logging errors (open-telemetry#35010). With this fix,
this side effect bug has been resolved.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes 35010

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added UT
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
open-telemetry#35834)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Fixed issue in which Operators with DropOnErrorQuiet are not dropping
log entries on error.

Note: This issue was introduced by a bug fix meant to ensure Silent
Operators are not logging errors (open-telemetry#35010). With this fix,
this side effect bug has been resolved.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes 35010

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added UT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants