Skip to content
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

fix: ensure consistent JSON log format for automaxprocs #6335

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

omerap12
Copy link
Contributor

@omerap12 omerap12 commented Nov 15, 2024

Configures automaxprocs to use the application logger instead of default console logging to maintain consistent JSON format across all log output.
output:

keda-admission-webhooks:
 ~/ k logs deployments.apps/keda-admission-webhooks -n keda
2024-11-15T18:39:05Z	INFO	setup	maxprocs: Updating GOMAXPROCS=1: determined from CPU quota	{"system": "automaxprocs"}
2024-11-15T18:39:05Z	INFO	setup	Starting admission webhooks
2024-11-15T18:39:05Z	INFO	setup	KEDA Version: main
2024-11-15T18:39:05Z	INFO	setup	Git Commit: c2a6df04230e1f62d335127e0a02694015c79fa6
2024-11-15T18:39:05Z	INFO	setup	Go Version: go1.23.3
2024-11-15T18:39:05Z	INFO	setup	Go OS/Arch: linux/arm64
2024-11-15T18:39:05Z	INFO	setup	Running on Kubernetes 1.30	{"version": "v1.30.0"}
2024-11-15T18:39:05Z	INFO	controller-runtime.builder	skip registering a mutating webhook, object does not implement admission.Defaulter or WithDefaulter wasn't called	{"GVK": "keda.sh/v1alpha1, Kind=ScaledObject"}

keda-operator:

 ~/ k logs deployment/keda-operator -n keda
2024-11-15T18:39:00Z	INFO	setup	maxprocs: Updating GOMAXPROCS=1: determined from CPU quota	{"system": "automaxprocs"}
2024-11-15T18:39:00Z	INFO	setup	Starting manager
2024-11-15T18:39:00Z	INFO	setup	KEDA Version: main
2024-11-15T18:39:00Z	INFO	setup	Git Commit: c2a6df04230e1f62d335127e0a02694015c79fa6
2024-11-15T18:39:00Z	INFO	setup	Go Version: go1.23.3
2024-11-15T18:39:00Z	INFO	setup	Go OS/Arch: linux/arm64
2024-11-15T18:39:00Z	INFO	setup	Running on Kubernetes 1.30	{"version": "v1.30.0"}
2024-11-15T18:39:01Z	INFO	starting server	{"name": "health probe", "addr": "[::]:8081"}
I1115 18:39:01.071646       1 leaderelection.go:254] attempting to acquire leader lease keda/operator.keda.sh...
I1115 18:39:39.767722       1 leaderelection.go:268] successfully acquired lease keda/operator.keda.sh

keda-operator-metrics-apiserver:

 ~/ k logs deployments.apps/keda-operator-metrics-apiserver -n keda                       
I1115 18:38:55.350590       1 welcome.go:34] "msg"="Starting metrics server" "logger"="keda_metrics_adapter"
I1115 18:38:55.350752       1 welcome.go:35] "msg"="KEDA Version: main" "logger"="keda_metrics_adapter"
I1115 18:38:55.350756       1 welcome.go:36] "msg"="Git Commit: c2a6df04230e1f62d335127e0a02694015c79fa6" "logger"="keda_metrics_adapter"
I1115 18:38:55.350759       1 welcome.go:37] "msg"="Go Version: go1.23.3" "logger"="keda_metrics_adapter"
I1115 18:38:55.350761       1 welcome.go:38] "msg"="Go OS/Arch: linux/arm64" "logger"="keda_metrics_adapter"
I1115 18:38:55.350775       1 welcome.go:39] "msg"="Running on Kubernetes 1.30" "logger"="keda_metrics_adapter" "version"={"major":"1","minor":"30","gitVersion":"v1.30.0","gitCommit":"7c48c2bd72b9bf5c44d21d7338cc7bea77d0ad2a","gitTreeState":"clean","buildDate":"2024-05-13T22:02:25Z","goVersion":"go1.22.2","compiler":"gc","platform":"linux/arm64"}
I1115 18:38:55.350913       1 main.go:263] "msg"="maxprocs: Updating GOMAXPROCS=1: determined from CPU quota" "logger"="keda_metrics_adapter"
I1115 18:38:55.351645       1 main.go:112] "msg"="Connecting Metrics Service gRPC client to the server" "address"="keda-operator.keda.svc.cluster.local:9666" "logger"="keda_metrics_adapter"

Checklist

Fixes #5970

@omerap12 omerap12 requested a review from a team as a code owner November 15, 2024 18:42
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great!

Could you please define this in a single place and just reference in each component? The best place is probably a new file in https://github.com/kedacore/keda/tree/main/pkg/util

@omerap12
Copy link
Contributor Author

Thanks, this is great!

Could you please define this in a single place and just reference in each component? The best place is probably a new file in https://github.com/kedacore/keda/tree/main/pkg/util

fixed :)

@zroubalik
Copy link
Member

zroubalik commented Nov 19, 2024

/run-e2e internal
Update: You can check the progress here

@zroubalik
Copy link
Member

@omerap12 could you please also update Changelog? https://github.com/kedacore/keda/blob/main/CHANGELOG.md#improvements-1

@omerap12
Copy link
Contributor Author

@omerap12 could you please also update Changelog? https://github.com/kedacore/keda/blob/main/CHANGELOG.md#improvements-1

Done

Signed-off-by: Omer Aplatony <omerap12@gmail.com>
@wozniakjan
Copy link
Member

wozniakjan commented Nov 19, 2024

/run-e2e internal
Update: You can check the progress here

@omerap12
Copy link
Contributor Author

/run-e2e internal Update: You can check the progress here

Passed. can we merge it? :)

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Could you move the changelog entry to the unreleased section? after the release it was moved to v2.16 and should be unreleased yet

Signed-off-by: Omer Aplatony <omerap12@gmail.com>
@omerap12
Copy link
Contributor Author

omerap12 commented Nov 21, 2024

LGTM! Could you move the changelog entry to the unreleased section? after the release it was moved to v2.16 and should be unreleased yet

hope I did it right this time lol

@wozniakjan wozniakjan enabled auto-merge (squash) November 21, 2024 08:39
@wozniakjan
Copy link
Member

/skip-e2e
(last commit is just CHANGELOG.md change, previous commit e2e tests passed)

@wozniakjan wozniakjan merged commit 8b4ccdb into kedacore:main Nov 21, 2024
19 checks passed
mpechner-akasa pushed a commit to nrichardson-akasa/keda that referenced this pull request Nov 29, 2024
* fix: ensure consistent JSON log format for automaxprocs

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

* moved to Unreleased

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

---------

Signed-off-by: Omer Aplatony <omerap12@gmail.com>
Signed-off-by: michael pechner <mike.pechner@akasa.com>
robpickerill pushed a commit to robpickerill/keda that referenced this pull request Nov 30, 2024
* fix: ensure consistent JSON log format for automaxprocs

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

* moved to Unreleased

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

---------

Signed-off-by: Omer Aplatony <omerap12@gmail.com>
rickbrouwer pushed a commit to rickbrouwer/keda that referenced this pull request Dec 4, 2024
* fix: ensure consistent JSON log format for automaxprocs

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

* moved to Unreleased

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

---------

Signed-off-by: Omer Aplatony <omerap12@gmail.com>
rickbrouwer pushed a commit to rickbrouwer/keda that referenced this pull request Dec 4, 2024
* fix: ensure consistent JSON log format for automaxprocs

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

* moved to Unreleased

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

---------

Signed-off-by: Omer Aplatony <omerap12@gmail.com>
rickbrouwer pushed a commit to rickbrouwer/keda that referenced this pull request Dec 4, 2024
* fix: ensure consistent JSON log format for automaxprocs

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

* moved to Unreleased

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

---------

Signed-off-by: Omer Aplatony <omerap12@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automaxprocs library prints log in a different format then the rest of the KEDA operator
5 participants