Skip to content

🌱 log less values in hbmh Reconcile. #1606

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guettli
Copy link
Collaborator

@guettli guettli commented May 14, 2025

Logs of caph are hard to read for the human eye because they contain many key-value pairs.

Many of them are duplicated (like the namespace).

Additionally, logging nested key-value pairs should be avoided because they are hard to query. See VictoriaLogs: Key concepts

This PR is focused on the hbmh. Similar PRs could be created for other resources.

Key-value pairs before PR:

level: INFO
time: "2025-05-13T07:57:18.785Z"
file: host/host.go:1318
message: Some message
controller: hetznerbaremetalhost
controllerGroup: infrastructure.cluster.x-k8s.io
controllerKind: HetznerBareMetalHost
HetznerBareMetalHost:
  name: bm-4
  namespace: my-workspace
namespace: my-workspace
name: bm-4
reconcileID: 982b927b-9a27-4a9a-a889-df30d40f6300
HetznerCluster:
  name: my-cluster-7spww
  namespace: my-workspace
Cluster:
  name: my-cluster
  namespace: my-workspace
HetznerBareMetalMachine:
  name: my-cluster-md-bm-1-7kg97-swstk-v9hkq
  namespace: my-workspace

The string "my-namespace" is contained 5 times.

Additionally 1: when "Provisioning state changed" is logged, the duration is logged, too.

Additionally 2: The provisioning state is added as key-value pair.

Capi Docs about Logging define some guidelines. But finally:

Cluster API providers are developed by independent teams, and each team is free to define their own processes and conventions.

We should implement it the way it makes sense for us.

PR is WIP.

@github-actions github-actions bot added size/S Denotes a PR that changes 20-50 lines, ignoring generated files. area/code Changes made in the code directory labels May 14, 2025
@janiskemper
Copy link
Contributor

@guettli plz consider the official CAPI documentation, where they talk about logging the parent and other related objects: https://cluster-api.sigs.k8s.io/developer/core/logging#keyvalue-pairs. If you disagree with CAPI, please explicitly state why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/code Changes made in the code directory size/S Denotes a PR that changes 20-50 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants