Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Limitador cluster EnvoyFilter controller #243
Limitador cluster EnvoyFilter controller #243
Changes from all commits
6d7384b
10cc4fc
2ed853d
54d9907
500887c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 64 in controllers/limitador_cluster_envoyfilter_controller.go
Codecov / codecov/patch
controllers/limitador_cluster_envoyfilter_controller.go#L63-L64
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.
Why
MarshalIndent
? I wonder whether it's suitable for when using structured logging, akaproduction
log mode.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.
AFAIK, from the
go-logr
interface I can only check logger level, nothing about the format (defined by development or production mode). I see that thisMarshalIndent
call is not entirely correct as logger could be configured with structured format and debug level. By default (noLOG_*
env vars), the logger is configured withinfo
level andproduction
level. When running withmake run
. it isdebug
anddevelopment
. Thus, no issue with this so far.Any better approach you are considering? Not for this PR, but considering that (almost) all controllers have this code in the beginning of the
Reconcile
method, it would be nice to have all of them fixed.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.
I didn't mean checking here what the log mode setting is. I just assumed that log level and log mode were two separate things, like in Authorino. But it looks like log mode and log level are somehow coupled together.
IMO, it does not have to be like that.
In Authorino, all 4 combinations are allowed, i.e.:
level: info, mode: production
level: debug, mode: production
level: info, mode: development
level: debug, mode: production
(Maybe the naming is a bit unfortunate, because
production
anddevelopment
mean actually "structured" and "human-readable", respectively.)Because it felt weird printing indented JSON when log mode is set to
production
, I'd probably have usedjson.Marshal
instead. Not a big deal though.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.
This project's log system is exactly the same, with those 4 combinations allowed.
Check my previous comment out again. You are right. However, if I change to
Mashal
, when I run in debug + development mode when I run withmake run
, it is not human readable. I need to indent it :)So looking for alternatives that makes a good dev experience as well.
Check warning on line 71 in controllers/limitador_cluster_envoyfilter_controller.go
Codecov / codecov/patch
controllers/limitador_cluster_envoyfilter_controller.go#L70-L71
Check warning on line 103 in controllers/limitador_cluster_envoyfilter_controller.go
Codecov / codecov/patch
controllers/limitador_cluster_envoyfilter_controller.go#L102-L103
Check warning on line 142 in controllers/limitador_cluster_envoyfilter_controller.go
Codecov / codecov/patch
controllers/limitador_cluster_envoyfilter_controller.go#L141-L142
Check warning on line 146 in controllers/limitador_cluster_envoyfilter_controller.go
Codecov / codecov/patch
controllers/limitador_cluster_envoyfilter_controller.go#L145-L146
Check warning on line 151 in controllers/limitador_cluster_envoyfilter_controller.go
Codecov / codecov/patch
controllers/limitador_cluster_envoyfilter_controller.go#L150-L151
Check warning on line 157 in controllers/limitador_cluster_envoyfilter_controller.go
Codecov / codecov/patch
controllers/limitador_cluster_envoyfilter_controller.go#L156-L157