Skip to content

Discussion: Conventions for log keys #9447

@sbueringer

Description

@sbueringer

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:

  1. When log keys are kinds we use the kind directly, e.g. Machine, Cluster, MachineDeployment.
  2. In a lot of other cases we use lower case: 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 a count 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#1954

Now 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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.priority/backlogHigher priority than priority/awaiting-more-evidence.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions