From 291dd4eed9831bf581c84ac91c29e1ac97c36398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sun, 29 Jun 2025 09:33:06 +0200 Subject: [PATCH] chore!: uniformize thread attribute name in logs (#1699) --- phpthread.go | 2 +- scaling.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpthread.go b/phpthread.go index 49f673b5..a60aa8f0 100644 --- a/phpthread.go +++ b/phpthread.go @@ -56,7 +56,7 @@ func (thread *phpThread) boot() { // start the actual posix thread - TODO: try this with go threads instead if !C.frankenphp_new_php_thread(C.uintptr_t(thread.threadIndex)) { - logger.LogAttrs(context.Background(), slog.LevelError, "unable to create thread", slog.Int("threadIndex", thread.threadIndex)) + logger.LogAttrs(context.Background(), slog.LevelError, "unable to create thread", slog.Int("thread", thread.threadIndex)) panic("unable to create thread") } diff --git a/scaling.go b/scaling.go index ca319a17..1691fdf9 100644 --- a/scaling.go +++ b/scaling.go @@ -197,7 +197,7 @@ func deactivateThreads() { // convert threads to inactive if they have been idle for too long if thread.state.is(stateReady) && waitTime > maxThreadIdleTime.Milliseconds() { - logger.LogAttrs(context.Background(), slog.LevelDebug, "auto-converting thread to inactive", slog.Int("threadIndex", thread.threadIndex)) + logger.LogAttrs(context.Background(), slog.LevelDebug, "auto-converting thread to inactive", slog.Int("thread", thread.threadIndex)) convertToInactiveThread(thread) stoppedThreadCount++ autoScaledThreads = append(autoScaledThreads[:i], autoScaledThreads[i+1:]...) @@ -209,7 +209,7 @@ func deactivateThreads() { // Some PECL extensions like #1296 will prevent threads from fully stopping (they leak memory) // Reactivate this if there is a better solution or workaround // if thread.state.is(stateInactive) && waitTime > maxThreadIdleTime.Milliseconds() { - // logger.LogAttrs(nil, slog.LevelDebug, "auto-stopping thread", slog.Int("threadIndex", thread.threadIndex)) + // logger.LogAttrs(nil, slog.LevelDebug, "auto-stopping thread", slog.Int("thread", thread.threadIndex)) // thread.shutdown() // stoppedThreadCount++ // autoScaledThreads = append(autoScaledThreads[:i], autoScaledThreads[i+1:]...)