-
Notifications
You must be signed in to change notification settings - Fork 107
Refactor: Replace emptyReporter with DiscardReporter #218
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
Conversation
|
@mrproliu This seems to be a code level optimization only. We could keep this in 0.7? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the tracer functionality to reduce code duplication by replacing the custom emptyReporter with the existing DiscardReporter.
- Replaces the instantiation of &emptyReporter{} with reporter.NewDiscardReporter() in newTracer.
- Removes the emptyReporter type and its methods.
- Updates discard_reporter.go to return ConnectionStatusDisconnect for clarity.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| plugins/core/tracer.go | Replaces emptyReporter with DiscardReporter and removes unused code. |
| plugins/core/reporter/discard_reporter.go | Updates ConnectionStatus to return ConnectionStatusDisconnect. |
@wu-sheng I would be happy to contribute to this implementation if the proposal is accepted. Please let me know your thoughts on this addition and any specific requirements or considerations I should be aware of. |
|
Kafka reporter is fine, as other agents have that. |
It seems we don't have a way to avoid that. |
|
@zJiaJun Hi, please fix the UT. |
Fixed |
I'll start working on the Kafka Reporter implementation. It may take some time, and I plan to use segmentio/kafka-go v0.4.47 as the client library. |
Take your time. We have tagged 0.6 release. We have plenty time for 0.7. |
Purpose
This PR replaces the custom
emptyReporterimplementation inplugins/core/tracer.gowith the existingreporter.NewDiscardReporter()to reduce code duplication and improve maintainability.Changes
&emptyReporter{}withreporter.NewDiscardReporter()in thenewTracer()methodemptyReporterstruct and its method implementationsMotivation and Context
The
emptyReporterandDiscardReporterhave identical functionality - they both implement the Reporter interface but don't perform any actual operations. Using the existingDiscardReporterimplementation reduces code duplication and follows the DRY principle.