mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
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:
@@ -13,7 +13,8 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"cdr.dev/slog"
|
||||
"cdr.dev/slog/v3"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtime"
|
||||
"github.com/coder/coder/v2/coderd/database/provisionerjobs"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"cdr.dev/slog"
|
||||
"cdr.dev/slog/v3"
|
||||
)
|
||||
|
||||
type Metrics struct {
|
||||
@@ -137,12 +137,12 @@ func (m *Metrics) UpdateWorkspaceTimingsMetrics(
|
||||
buildTime float64,
|
||||
) {
|
||||
m.logger.Debug(ctx, "update workspace timings metrics",
|
||||
"organizationName", organizationName,
|
||||
"templateName", templateName,
|
||||
"presetName", presetName,
|
||||
"isPrebuild", flags.IsPrebuild,
|
||||
"isClaim", flags.IsClaim,
|
||||
"isWorkspaceFirstBuild", flags.IsFirstBuild)
|
||||
slog.F("organization_name", organizationName),
|
||||
slog.F("template_name", templateName),
|
||||
slog.F("preset_name", presetName),
|
||||
slog.F("is_prebuild", flags.IsPrebuild),
|
||||
slog.F("is_claim", flags.IsClaim),
|
||||
slog.F("is_workspace_first_build", flags.IsFirstBuild))
|
||||
|
||||
workspaceTimingType := getWorkspaceTimingType(flags)
|
||||
switch workspaceTimingType {
|
||||
|
||||
@@ -27,7 +27,8 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
protobuf "google.golang.org/protobuf/proto"
|
||||
|
||||
"cdr.dev/slog"
|
||||
"cdr.dev/slog/v3"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/apikey"
|
||||
"github.com/coder/coder/v2/coderd/audit"
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
|
||||
@@ -25,7 +25,8 @@ import (
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
"storj.io/drpc"
|
||||
|
||||
"cdr.dev/slog/sloggers/slogtest"
|
||||
"cdr.dev/slog/v3/sloggers/slogtest"
|
||||
|
||||
"github.com/coder/coder/v2/coderd"
|
||||
"github.com/coder/coder/v2/coderd/util/ptr"
|
||||
"github.com/coder/quartz"
|
||||
|
||||
Reference in New Issue
Block a user