fix: fix slog to always use array of Fields (#21426)

Upgrades to slog v3 which includes a small, but backward incompatible API change to the acceptible call arguments when logging. This change allows us to verify via compile time type checking that arguments are correct and won't cause a panic, as was possible in slog v1, which this replaces (v2 was tagged but never used in coder/coder).

It also updates dependencies that also use slog and were updated.

I've left the `aibridge` dependency as a commit SHA, under the assumption that the team there (cc @pawbana @dannykopping ) will tag and update the dependency soon and on their own schedule.

Other dependencies, I pushed new tags.
This commit is contained in:
Spike Curtis
2026-01-08 10:29:41 +04:00
committed by GitHub
parent d1b0722034
commit 49b34a716a
376 changed files with 789 additions and 546 deletions
+2 -1
View File
@@ -8,7 +8,8 @@ import (
"github.com/prometheus/client_golang/prometheus"
"cdr.dev/slog"
"cdr.dev/slog/v3"
"github.com/coder/coder/v2/coderd/database"
)
+3 -2
View File
@@ -8,8 +8,9 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/xerrors"
"cdr.dev/slog"
"cdr.dev/slog/sloggers/sloghuman"
"cdr.dev/slog/v3"
"cdr.dev/slog/v3/sloggers/sloghuman"
"github.com/coder/coder/v2/coderd/coderdtest/promhelp"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbmetrics"
+5 -2
View File
@@ -11,8 +11,11 @@ import (
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
"cdr.dev/slog"
// the redundant alias `slog` works around the fact that github.com/dave/dst is bugged and doesn't correctly resolve
// the package name. We use github.com/dave/dst in scripts/dbgen/ to generate new stubs for database.Store methods.
// Without this workaround, dbgen will drop and re-add slog, possibly resolving to a different version (e.g. v1).
// It can also result in the imports being sorted incorrectly.
slog "cdr.dev/slog/v3"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/rbac"
"github.com/coder/coder/v2/coderd/rbac/policy"