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
Added debug logs for render command #5328
Conversation
Added logs in just a few places around pulling and starting functions. I am not that familiar with the render code so feel free to reccomend other places where its useful. Ill go through it as well myself. |
Signed-off-by: lsviben <sviben.lovro@gmail.com>
dc61ae0
to
1f35023
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 thanks @lsviben!
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.
Just a few nits, but looks good to me. Thank you! Feel free to take or leave any of the suggestions.
// Run our Functions. | ||
conns := map[string]*grpc.ClientConn{} | ||
for _, fn := range in.Functions { | ||
runtime, err := GetRuntime(fn) | ||
if err != nil { | ||
return Outputs{}, errors.Wrapf(err, "cannot get runtime for Function %q", fn.GetName()) | ||
} | ||
rctx, err := runtime.Start(ctx) | ||
rctx, err := runtime.Start(ctx, logger) |
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.
Would it make sense to pass the logger in GetRuntime
? So it would be a field of the runtime struct rather than an argument to the Start
method?
@@ -49,7 +50,7 @@ const ( | |||
// A Runtime runs a Function. | |||
type Runtime interface { | |||
// Start the Function. | |||
Start(ctx context.Context) (RuntimeContext, error) | |||
Start(ctx context.Context, logger logging.Logger) (RuntimeContext, error) |
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.
Start(ctx context.Context, logger logging.Logger) (RuntimeContext, error) | |
Start(ctx context.Context, l logging.Logger) (RuntimeContext, error) |
Nit. Or log
if l
is too short, but "logger logging logger" stutters a lot. 😄 In other contexts I can live with it because the logger
variable tends to live for a lot of lines (you can't always easily see what it is from its type). Maybe log
everywhere would be a good compromise though? 🤔
@lsviben I'm going to merge this so that it's in the first RC for 1.15, feel free to address the nits above in a follow up PR. |
Backport failed for |
Description of your changes
Adds debug logs to
crossplane beta render
.For
render
the output is expected to be a valid yaml file, so we should be carefull where and when to log. Actually we dont need to do anything special as the CLI logger is already active only when--verbose
flag is provider, plus it logs by default to stderr, so users can filter the command output from the logs if needed.How it looks like:
crossplane beta render ...
- no changescrossplane beta render ... --verbose
:crossplane beta render ... --verbose 2>
crossplane beta render ... --verbose 1>
Fixes #4809
I have:
make reviewable
to ensure this PR is ready for review.[] Added or updated unit tests.[] Added or updated e2e tests.[] Linked a PR or a docs tracking issue to document this change.[] Addedbackport release-x.y
labels to auto-backport this PR.Need help with this checklist? See the cheat sheet.