-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Discussion: Conventions for log keys #9447
Comments
/triage accepted |
cc @pohly (just in case you have a take on it / I missed some upstream Kubernetes guidance, thank you!) |
I don't really mind the mix of camelCase and lower case - there's a good justification for it and I haven't found it distracting or confusing when reading logs. I do think the more important point is whether certain data should be in k/v pairs - we should only really include data in k/v if it's useful for filtering or extracting from the logs. Maybe we should add some language to our logging conventions doc around that and put some effort into reviewing with that in mind in future. |
Ok with the above 👍 A |
The migration guide describes best practices for keys in Kubernetes. Unfortunately it's mostly just by example, without the corresponding rationale. |
So where we differ from that best practices is:
|
+1, as a general rule
I don't remember why we ended up with upper case Kind, but If this is the best practice we can consider to converge (but low priority) |
So in my opinion we can only use kind directly as a key in Cluster API. Otherwise we will end up with inconsistent kind keys in our logs. I think this basically applies to all cases where the kind key cannot be hard-coded via a constant string (@pohly just in case that is also relevant for upstream Kubernetes) |
/kind feature |
The Cluster API project currently lacks enough active contributors to adequately respond to all issues and PRs. What we have is consistent for kind (all the kind are pascal case) and we don't have a good solution to automatically convert to camel case generic CRD names + no one is volounteering to do the job. I will slowly convert everything to camel case, but is something we can do as part as the usual review work. /close |
@fabriziopandini: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This issue is to discuss conventions for log keys (brought up in kubernetes-sigs/cluster-api-provider-vsphere#2352 (comment)).
Current state in Cluster API:
Machine
,Cluster
,MachineDeployment
.count
,revision
,timeout
, ...In my opinion in a lot of cases for 2. we should ask ourselves if these even should be k/v pairs. For me it doesn't make sense to just put all data in a k/v pair. We should always think about if the k/v pair is actually useful. E.g. does it make sense to filter logs based on a
timeout
or on acount
or does it make the log more readable. In my opinion this sort of data should be simply part of the message. But maybe I'm missing something.Independent of that. For kinds we have to use the
kind
directly as we don't always know the kind upfront and then there is no good way to automatically calculate the right lowerCamelCase format of it. Please also see this PR in controller-runtime: kubernetes-sigs/controller-runtime#1954Now the question becomes, do we want to use CamelCase for all log keys consistently or only for kinds?
As far as I'm aware there is no upstream guidance on it:
The text was updated successfully, but these errors were encountered: