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
@@ -16,7 +16,8 @@ import (
"github.com/google/uuid"
"golang.org/x/xerrors"
"cdr.dev/slog"
"cdr.dev/slog/v3"
"github.com/coder/coder/v2/coderd/connectionlog"
"github.com/coder/coder/v2/coderd/cryptokeys"
"github.com/coder/coder/v2/coderd/database"
+2 -1
View File
@@ -6,7 +6,8 @@ import (
"net/url"
"path"
"cdr.dev/slog"
"cdr.dev/slog/v3"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/site"
)
+2 -1
View File
@@ -6,7 +6,8 @@ import (
"net/url"
"time"
"cdr.dev/slog"
"cdr.dev/slog/v3"
"github.com/coder/coder/v2/codersdk"
)
+2 -1
View File
@@ -18,7 +18,8 @@ import (
"github.com/google/uuid"
"go.opentelemetry.io/otel/trace"
"cdr.dev/slog"
"cdr.dev/slog/v3"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/coderd/cryptokeys"
"github.com/coder/coder/v2/coderd/database/dbtime"
+3 -3
View File
@@ -8,7 +8,7 @@ import (
"github.com/google/uuid"
"golang.org/x/xerrors"
"cdr.dev/slog"
"cdr.dev/slog/v3"
"github.com/coder/coder/v2/coderd/database/dbauthz"
"github.com/coder/coder/v2/coderd/database/dbtime"
@@ -169,7 +169,7 @@ func (sc *StatsCollector) rollup(now time.Time) []StatsReport {
for g, group := range sc.groupedStats {
if len(group) == 0 {
// Safety check, this should not happen.
sc.opts.Logger.Error(sc.ctx, "empty stats group", "group", g)
sc.opts.Logger.Error(sc.ctx, "empty stats group", slog.F("group", g))
delete(sc.groupedStats, g)
continue
}
@@ -244,7 +244,7 @@ func (sc *StatsCollector) flush(ctx context.Context) (err error) {
sc.opts.Logger.Debug(ctx, "flushing workspace app stats")
defer func() {
if err != nil {
sc.opts.Logger.Error(ctx, "failed to flush workspace app stats", "error", err)
sc.opts.Logger.Error(ctx, "failed to flush workspace app stats", slog.Error(err))
} else {
sc.opts.Logger.Debug(ctx, "flushed workspace app stats")
}