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
comp/trace: wrap pkg/trace/agent as a component #19466
Conversation
|
Ready for review, but probably tests will fail. I'll fix them tomorrow. |
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.
Overall, looks good. Just a few minor comments.
Can you add more details to the PR description, in addition to filling out the sections in the existing template? I feel that using the components framework is pretty nuanced, and it would be very helpful to have more details around what decision decisions were made here, what shared components the trace-agent is now using, which it isn't, future work planned, etc.
cfbe760
to
fb8cb37
Compare
5f72f26
to
479c4b9
Compare
479c4b9
to
ad2a185
Compare
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.
LGTM but I think not returning a nil component is important.
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.
LGTM for agent-platform
What does this PR do?
Introduce a wrapper for
pkg/trace/agentas a component. Important things to know:pkg/trace/agent. Some bits have been moved mainly tocomp/trace/agent/agent.go, to encapsulate them as part of the agent's lifecycle.cmd/trace-agent/subcommands/run/run.go. Now it lives inside the component, as it contains logic to start several non-components that the agent requires. They are potential next candidates to become components.For future reference, the gist about creating components (at least wrappers like this one) is:
fx.Moduleand annotated withfx.Provide, and the values/components provided by other providers. The function must return a value matching the exportedComponentinterface in your package. It can be an empty interface.dependenciesstruct, that must embedfx.Intype,the provider function must receive this struct as argument.startregistered as a lifecycle hook. Beware of the provided context, as it has a timeout. Don't use it for any long-living code, and also you must not block inside this block.stop. The same conditions apply regarding the provided context.fx.Shutdownerwhen catching a signal that means you need to stop.Additional Notes
fxutil.Runinstead offxutil.OneShot.inv lint-components --fixbefore pushing, so you can avoid a failing CI.Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
Reviewer's Checklist
Triagemilestone is set.major_changelabel if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.changelog/no-changeloglabel has been applied.qa/skip-qalabel is not applied.team/..label has been applied, indicating the team(s) that should QA this change.need-change/operatorandneed-change/helmlabels have been applied.k8s/<min-version>label, indicating the lowest Kubernetes version compatible with this feature.