From 144941a306c2d61a14a86702d8f61a27f156e060 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Mon, 11 Mar 2024 15:20:48 +0100 Subject: [PATCH] Migrate to slog (#507) --- .github/workflows/docker.yaml | 4 +- Makefile | 2 +- cmd/metal-api/internal/datastore/event.go | 5 +- cmd/metal-api/internal/datastore/integer.go | 8 +- .../datastore/integer_integration_test.go | 8 +- cmd/metal-api/internal/datastore/machine.go | 2 +- cmd/metal-api/internal/datastore/migrate.go | 16 +- .../migrate_integration_test.go | 4 +- cmd/metal-api/internal/datastore/rethinkdb.go | 10 +- .../datastore/rethinkdb_integration_test.go | 4 +- .../internal/datastore/rethinkdb_test.go | 7 +- cmd/metal-api/internal/datastore/testing.go | 4 +- cmd/metal-api/internal/eventbus/nsq.go | 22 +- cmd/metal-api/internal/eventbus/nsq_test.go | 9 +- cmd/metal-api/internal/fsm/fsm.go | 4 +- cmd/metal-api/internal/fsm/fsm_test.go | 6 +- cmd/metal-api/internal/fsm/states/alive.go | 7 +- .../internal/fsm/states/phoned-home.go | 6 +- cmd/metal-api/internal/fsm/states/states.go | 5 +- .../internal/grpc/boot-service-wait.go | 6 +- .../boot-service-wait_integration_test.go | 4 +- cmd/metal-api/internal/grpc/boot-service.go | 28 +-- .../internal/grpc/boot-service_test.go | 6 +- cmd/metal-api/internal/grpc/event-service.go | 8 +- .../internal/grpc/event-service_test.go | 7 +- cmd/metal-api/internal/grpc/grpc-server.go | 145 ++++++++---- cmd/metal-api/internal/headscale/client.go | 7 +- cmd/metal-api/internal/metal/machine.go | 8 +- cmd/metal-api/internal/service/async-actor.go | 31 ++- .../internal/service/audit-service.go | 4 +- .../internal/service/filesystem-service.go | 4 +- .../internal/service/firewall-service.go | 5 +- .../internal/service/firmware-service.go | 4 +- .../internal/service/image-service.go | 4 +- .../service/image-service_integration_test.go | 4 +- .../internal/service/image-service_test.go | 18 +- .../internal/service/integration_test.go | 9 +- cmd/metal-api/internal/service/ip-service.go | 6 +- .../internal/service/ip-service_test.go | 16 +- .../internal/service/machine-service.go | 77 ++++--- .../machine-service_allocation_test.go | 8 +- .../machine-service_integration_test.go | 4 +- .../internal/service/machine-service_test.go | 22 +- .../internal/service/network-service.go | 5 +- .../internal/service/network-service_test.go | 18 +- .../internal/service/partition-service.go | 4 +- .../service/partition-service_test.go | 16 +- .../internal/service/project-service.go | 4 +- .../internal/service/project-service_test.go | 6 +- cmd/metal-api/internal/service/service.go | 26 +-- .../internal/service/service_test.go | 17 +- .../internal/service/size-service.go | 4 +- .../internal/service/size-service_test.go | 24 +- .../service/sizeimageconstraint-service.go | 4 +- .../internal/service/switch-service.go | 4 +- .../internal/service/switch-service_test.go | 16 +- .../internal/service/tenant-service.go | 4 +- .../internal/service/tenant-service_test.go | 6 +- .../internal/service/user-service.go | 4 +- cmd/metal-api/internal/service/vpn-service.go | 4 +- cmd/metal-api/main.go | 160 +++++++------ go.mod | 96 ++++---- go.sum | 212 +++++++++--------- test/integration.go | 6 +- 64 files changed, 619 insertions(+), 589 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index b770f28f1..d0c6c091a 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -29,7 +29,7 @@ jobs: password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v5 @@ -38,7 +38,7 @@ jobs: cache: false - name: Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: args: --build-tags integration -p bugs -p unused -D protogetter --timeout=5m diff --git a/Makefile b/Makefile index 808974e26..fc121de73 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ test-unit: .PHONY: test-integration test-integration: - go test -tags=integration -timeout 600s -p 1 ./... + go test -v -tags=integration -timeout 600s -p 1 ./... .PHONY: check-diff check-diff: spec diff --git a/cmd/metal-api/internal/datastore/event.go b/cmd/metal-api/internal/datastore/event.go index 20d60517a..13e705b33 100644 --- a/cmd/metal-api/internal/datastore/event.go +++ b/cmd/metal-api/internal/datastore/event.go @@ -1,9 +1,10 @@ package datastore import ( + "log/slog" + "github.com/metal-stack/metal-api/cmd/metal-api/internal/fsm" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" - "go.uber.org/zap" ) // ListProvisioningEventContainers returns all machine provisioning event containers. @@ -38,7 +39,7 @@ func (rs *RethinkStore) UpsertProvisioningEventContainer(ec *metal.ProvisioningE return rs.upsertEntity(rs.eventTable(), ec) } -func (rs *RethinkStore) ProvisioningEventForMachine(log *zap.SugaredLogger, event *metal.ProvisioningEvent, machineID string) (*metal.ProvisioningEventContainer, error) { +func (rs *RethinkStore) ProvisioningEventForMachine(log *slog.Logger, event *metal.ProvisioningEvent, machineID string) (*metal.ProvisioningEventContainer, error) { ec, err := rs.FindProvisioningEventContainer(machineID) if err != nil && !metal.IsNotFound(err) { return nil, err diff --git a/cmd/metal-api/internal/datastore/integer.go b/cmd/metal-api/internal/datastore/integer.go index e3e8d6be1..818db0670 100644 --- a/cmd/metal-api/internal/datastore/integer.go +++ b/cmd/metal-api/internal/datastore/integer.go @@ -3,10 +3,10 @@ package datastore import ( "errors" "fmt" + "log/slog" "time" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" - "go.uber.org/zap" "github.com/avast/retry-go/v4" r "gopkg.in/rethinkdb/rethinkdb-go.v6" @@ -117,19 +117,19 @@ func (ip *IntegerPool) String() string { // - releasing the integer is fast // - you do not have gaps (because you can give the integers back to the pool) // - everything can be done atomically, so there are no race conditions -func (ip *IntegerPool) initIntegerPool(log *zap.SugaredLogger) error { +func (ip *IntegerPool) initIntegerPool(log *slog.Logger) error { var info integerinfo err := ip.infoTable.ReadOne(&info, ip.session) if err != nil && !errors.Is(err, r.ErrEmptyResult) { return err } - log.Infow("pool info", "id", ip.String(), "info", info) + log.Info("pool info", "id", ip.String(), "info", info) if info.IsInitialized { return nil } - log.Infow("initializing integer pool", "for", ip.String(), "RangeMin", ip.min, "RangeMax", ip.max) + log.Info("initializing integer pool", "for", ip.String(), "RangeMin", ip.min, "RangeMax", ip.max) intRange := makeRange(ip.min, ip.max) _, err = ip.poolTable.Insert(intRange).RunWrite(ip.session, r.RunOpts{ArrayLimit: ip.max}) if err != nil { diff --git a/cmd/metal-api/internal/datastore/integer_integration_test.go b/cmd/metal-api/internal/datastore/integer_integration_test.go index a830d6980..1638a8c63 100644 --- a/cmd/metal-api/internal/datastore/integer_integration_test.go +++ b/cmd/metal-api/internal/datastore/integer_integration_test.go @@ -5,12 +5,12 @@ package datastore import ( "context" + "log/slog" "sync" "time" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" "github.com/metal-stack/metal-api/test" - "go.uber.org/zap/zaptest" "testing" @@ -25,7 +25,7 @@ func TestRethinkStore_AcquireRandomUniqueIntegerIntegration(t *testing.T) { _ = container.Terminate(context.Background()) }() - rs := New(zaptest.NewLogger(t).Sugar(), c.IP+":"+c.Port, c.DB, c.User, c.Password) + rs := New(slog.Default(), c.IP+":"+c.Port, c.DB, c.User, c.Password) rs.VRFPoolRangeMin = 10000 rs.VRFPoolRangeMax = 10010 rs.ASNPoolRangeMin = 10000 @@ -50,7 +50,7 @@ func TestRethinkStore_AcquireUniqueIntegerTwiceIntegration(t *testing.T) { _ = container.Terminate(context.Background()) }() - rs := New(zaptest.NewLogger(t).Sugar(), c.IP+":"+c.Port, c.DB, c.User, c.Password) + rs := New(slog.Default(), c.IP+":"+c.Port, c.DB, c.User, c.Password) rs.VRFPoolRangeMin = 10000 rs.VRFPoolRangeMax = 10010 rs.ASNPoolRangeMin = 10000 @@ -77,7 +77,7 @@ func TestRethinkStore_AcquireUniqueIntegerPoolExhaustionIntegration(t *testing.T _ = container.Terminate(context.Background()) }() - rs := New(zaptest.NewLogger(t).Sugar(), c.IP+":"+c.Port, c.DB, c.User, c.Password) + rs := New(slog.Default(), c.IP+":"+c.Port, c.DB, c.User, c.Password) rs.VRFPoolRangeMin = 10000 rs.VRFPoolRangeMax = 10010 rs.ASNPoolRangeMin = 10000 diff --git a/cmd/metal-api/internal/datastore/machine.go b/cmd/metal-api/internal/datastore/machine.go index 1b8af67b1..6bf9d979d 100644 --- a/cmd/metal-api/internal/datastore/machine.go +++ b/cmd/metal-api/internal/datastore/machine.go @@ -456,7 +456,7 @@ func (rs *RethinkStore) FindWaitingMachine(projectid, partitionid string, size m for _, m := range candidates { ec, ok := ecMap[m.ID] if !ok { - rs.log.Errorw("cannot find machine provisioning event container", "machine", m, "error", err) + rs.log.Error("cannot find machine provisioning event container", "machine", m, "error", err) // fall through, so the rest of the machines is getting evaluated continue } diff --git a/cmd/metal-api/internal/datastore/migrate.go b/cmd/metal-api/internal/datastore/migrate.go index 4ccbc1d46..dc084c735 100644 --- a/cmd/metal-api/internal/datastore/migrate.go +++ b/cmd/metal-api/internal/datastore/migrate.go @@ -113,34 +113,34 @@ func (rs *RethinkStore) Migrate(targetVersion *int, dry bool) error { } if len(ms) == 0 { - rs.log.Infow("no database migration required", "current-version", current.Version) + rs.log.Info("no database migration required", "current-version", current.Version) return nil } - rs.log.Infow("database migration required", "current-version", current.Version, "newer-versions", len(ms), "target-version", ms[len(ms)-1].Version) + rs.log.Info("database migration required", "current-version", current.Version, "newer-versions", len(ms), "target-version", ms[len(ms)-1].Version) if dry { for _, m := range ms { - rs.log.Infow("database migration dry run", "version", m.Version, "name", m.Name) + rs.log.Info("database migration dry run", "version", m.Version, "name", m.Name) } return nil } - rs.log.Infow("setting demoted runtime user to read only", "user", DemotedUser) + rs.log.Info("setting demoted runtime user to read only", "user", DemotedUser) _, err = rs.db().Grant(DemotedUser, map[string]interface{}{"read": true, "write": false}).RunWrite(rs.session) if err != nil { return err } defer func() { - rs.log.Infow("removing read only", "user", DemotedUser) + rs.log.Info("removing read only", "user", DemotedUser) _, err = rs.db().Grant(DemotedUser, map[string]interface{}{"read": true, "write": true}).RunWrite(rs.session) if err != nil { - rs.log.Errorw("error giving back write permissions", "user", DemotedUser) + rs.log.Error("error giving back write permissions", "user", DemotedUser) } }() for _, m := range ms { - rs.log.Infow("running database migration", "version", m.Version, "name", m.Name) + rs.log.Info("running database migration", "version", m.Version, "name", m.Name) err = m.Up(rs.db(), rs.session, rs) if err != nil { return fmt.Errorf("error running database migration: %w", err) @@ -154,7 +154,7 @@ func (rs *RethinkStore) Migrate(targetVersion *int, dry bool) error { } } - rs.log.Infow("database migration succeeded") + rs.log.Info("database migration succeeded") return nil } diff --git a/cmd/metal-api/internal/datastore/migrations_integration/migrate_integration_test.go b/cmd/metal-api/internal/datastore/migrations_integration/migrate_integration_test.go index d567fef30..6092d2312 100644 --- a/cmd/metal-api/internal/datastore/migrations_integration/migrate_integration_test.go +++ b/cmd/metal-api/internal/datastore/migrations_integration/migrate_integration_test.go @@ -5,6 +5,7 @@ package migrations_integration import ( "context" + "log/slog" "time" "github.com/google/go-cmp/cmp" @@ -13,7 +14,6 @@ import ( _ "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore/migrations" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" "github.com/metal-stack/metal-api/test" - "go.uber.org/zap/zaptest" "testing" @@ -28,7 +28,7 @@ func Test_Migration(t *testing.T) { _ = container.Terminate(context.Background()) }() - rs := datastore.New(zaptest.NewLogger(t).Sugar(), c.IP+":"+c.Port, c.DB, c.User, c.Password) + rs := datastore.New(slog.Default(), c.IP+":"+c.Port, c.DB, c.User, c.Password) rs.VRFPoolRangeMin = 10000 rs.VRFPoolRangeMax = 10010 rs.ASNPoolRangeMin = 10000 diff --git a/cmd/metal-api/internal/datastore/rethinkdb.go b/cmd/metal-api/internal/datastore/rethinkdb.go index 4e85f8fa7..00ce05ca9 100644 --- a/cmd/metal-api/internal/datastore/rethinkdb.go +++ b/cmd/metal-api/internal/datastore/rethinkdb.go @@ -2,13 +2,13 @@ package datastore import ( "fmt" + "log/slog" "reflect" "strings" "time" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" - "go.uber.org/zap" r "gopkg.in/rethinkdb/rethinkdb-go.v6" ) @@ -25,7 +25,7 @@ var tables = []string{ // A RethinkStore is the database access layer for rethinkdb. type RethinkStore struct { - log *zap.SugaredLogger + log *slog.Logger session r.QueryExecutor dbsession *r.Session @@ -43,7 +43,7 @@ type RethinkStore struct { } // New creates a new rethink store. -func New(log *zap.SugaredLogger, dbhost string, dbname string, dbuser string, dbpass string) *RethinkStore { +func New(log *slog.Logger, dbhost string, dbname string, dbuser string, dbpass string) *RethinkStore { return &RethinkStore{ log: log, dbhost: dbhost, @@ -296,11 +296,11 @@ func connect(hosts []string, dbname, user, pwd string) (*r.Session, error) { // retryConnect infinitely tries to establish a database connection. // in case a connection could not be established, the function will // wait for a short period of time and try again. -func retryConnect(log *zap.SugaredLogger, hosts []string, dbname, user, pwd string) *r.Session { +func retryConnect(log *slog.Logger, hosts []string, dbname, user, pwd string) *r.Session { tryAgain: s, err := connect(hosts, dbname, user, pwd) if err != nil { - log.Errorw("db connection error", "db", dbname, "hosts", hosts, "error", err) + log.Error("db connection error", "db", dbname, "hosts", hosts, "error", err) time.Sleep(3 * time.Second) goto tryAgain } diff --git a/cmd/metal-api/internal/datastore/rethinkdb_integration_test.go b/cmd/metal-api/internal/datastore/rethinkdb_integration_test.go index 721d06da8..b04ccb830 100644 --- a/cmd/metal-api/internal/datastore/rethinkdb_integration_test.go +++ b/cmd/metal-api/internal/datastore/rethinkdb_integration_test.go @@ -5,6 +5,7 @@ package datastore import ( "context" + "log/slog" "os" "sort" @@ -15,7 +16,6 @@ import ( "github.com/metal-stack/metal-lib/pkg/testcommon" "github.com/stretchr/testify/require" "github.com/testcontainers/testcontainers-go" - "go.uber.org/zap" "testing" ) @@ -45,7 +45,7 @@ func startRethinkInitialized() (container testcontainers.Container, ds *RethinkS panic(err) } - rs := New(zap.L().Sugar(), c.IP+":"+c.Port, c.DB, c.User, c.Password) + rs := New(slog.Default(), c.IP+":"+c.Port, c.DB, c.User, c.Password) rs.VRFPoolRangeMin = 10000 rs.VRFPoolRangeMax = 10010 rs.ASNPoolRangeMin = 10000 diff --git a/cmd/metal-api/internal/datastore/rethinkdb_test.go b/cmd/metal-api/internal/datastore/rethinkdb_test.go index 5338bf8ca..bff2c2011 100644 --- a/cmd/metal-api/internal/datastore/rethinkdb_test.go +++ b/cmd/metal-api/internal/datastore/rethinkdb_test.go @@ -1,19 +1,18 @@ package datastore import ( + "log/slog" "reflect" "testing" "github.com/metal-stack/metal-api/cmd/metal-api/internal/testdata" - "go.uber.org/zap" - "go.uber.org/zap/zaptest" r "gopkg.in/rethinkdb/rethinkdb-go.v6" ) func TestNew(t *testing.T) { - logger := zaptest.NewLogger(t).Sugar() + logger := slog.Default() type args struct { - log *zap.SugaredLogger + log *slog.Logger dbhost string dbname string dbuser string diff --git a/cmd/metal-api/internal/datastore/testing.go b/cmd/metal-api/internal/datastore/testing.go index 0bed93b29..ed0100db4 100644 --- a/cmd/metal-api/internal/datastore/testing.go +++ b/cmd/metal-api/internal/datastore/testing.go @@ -1,9 +1,9 @@ package datastore import ( + "log/slog" "testing" - "go.uber.org/zap/zaptest" r "gopkg.in/rethinkdb/rethinkdb-go.v6" ) @@ -20,7 +20,7 @@ Return Values: */ func InitMockDB(t *testing.T) (*RethinkStore, *r.Mock) { rs := New( - zaptest.NewLogger(t).Sugar(), + slog.Default(), "db-addr", "mockdb", "db-user", diff --git a/cmd/metal-api/internal/eventbus/nsq.go b/cmd/metal-api/internal/eventbus/nsq.go index a3ebcf5ea..90e972556 100644 --- a/cmd/metal-api/internal/eventbus/nsq.go +++ b/cmd/metal-api/internal/eventbus/nsq.go @@ -2,21 +2,21 @@ package eventbus import ( "fmt" + "log/slog" "time" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" "github.com/metal-stack/metal-lib/bus" - "go.uber.org/zap" ) // nsqdRetryDelay represents the delay that is used for retries in blocking calls. const nsqdRetryDelay = 3 * time.Second -type PublisherProvider func(*zap.Logger, *bus.PublisherConfig) (bus.Publisher, error) +type PublisherProvider func(*slog.Logger, *bus.PublisherConfig) (bus.Publisher, error) // NSQClient is a type to request NSQ related tasks such as creation of topics. type NSQClient struct { - logger *zap.Logger + logger *slog.Logger config *bus.PublisherConfig publisherProvider PublisherProvider Publisher bus.Publisher @@ -24,7 +24,7 @@ type NSQClient struct { } // NewNSQ create a new NSQClient. -func NewNSQ(publisherConfig *bus.PublisherConfig, logger *zap.Logger, publisherProvider PublisherProvider) NSQClient { +func NewNSQ(publisherConfig *bus.PublisherConfig, logger *slog.Logger, publisherProvider PublisherProvider) NSQClient { return NSQClient{ config: publisherConfig, logger: logger, @@ -37,11 +37,11 @@ func (n *NSQClient) WaitForPublisher() { for { publisher, err := n.publisherProvider(n.logger, n.config) if err != nil { - n.logger.Sugar().Errorw("cannot create nsq publisher", "error", err) + n.logger.Error("cannot create nsq publisher", "error", err) n.delay() continue } - n.logger.Sugar().Infow("nsq connected", "nsqd", fmt.Sprintf("%+v", n.config)) + n.logger.Info("nsq connected", "nsqd", fmt.Sprintf("%+v", n.config)) n.Publisher = publisher break } @@ -62,7 +62,7 @@ func (n *NSQClient) CreateEndpoints(lookupds ...string) error { func (n NSQClient) WaitForTopicsCreated(partitions metal.Partitions, topics []metal.NSQTopic) { for { if err := n.createTopics(partitions, topics); err != nil { - n.logger.Sugar().Errorw("cannot create topics", "error", err) + n.logger.Error("cannot create topics", "error", err) n.delay() continue } @@ -73,10 +73,10 @@ func (n NSQClient) WaitForTopicsCreated(partitions metal.Partitions, topics []me // CreateTopic creates a topic with given name. func (n NSQClient) CreateTopic(name string) error { if err := n.Publisher.CreateTopic(name); err != nil { - n.logger.Sugar().Errorw("cannot create topic", "topic", name) + n.logger.Error("cannot create topic", "topic", name) return err } - n.logger.Sugar().Infow("topic created", "topic", name) + n.logger.Info("topic created", "topic", name) return nil } @@ -86,7 +86,7 @@ func (n NSQClient) createTopics(partitions metal.Partitions, topics []metal.NSQT continue } if err := n.CreateTopic(topic.Name); err != nil { - n.logger.Sugar().Errorw("cannot create topic", "topic", topic.Name) + n.logger.Error("cannot create topic", "topic", topic.Name) return err } } @@ -98,7 +98,7 @@ func (n NSQClient) createTopics(partitions metal.Partitions, topics []metal.NSQT } topicFQN := topic.GetFQN(partition.GetID()) if err := n.CreateTopic(topicFQN); err != nil { - n.logger.Sugar().Errorw("cannot create topic", "topic", topicFQN, "partition", partition.GetID()) + n.logger.Error("cannot create topic", "topic", topicFQN, "partition", partition.GetID()) return err } } diff --git a/cmd/metal-api/internal/eventbus/nsq_test.go b/cmd/metal-api/internal/eventbus/nsq_test.go index 05ca2d623..18f502e36 100644 --- a/cmd/metal-api/internal/eventbus/nsq_test.go +++ b/cmd/metal-api/internal/eventbus/nsq_test.go @@ -1,12 +1,12 @@ package eventbus import ( + "log/slog" "testing" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" "github.com/metal-stack/metal-lib/bus" "github.com/stretchr/testify/assert" - "go.uber.org/zap" ) func TestNewNSQ(t *testing.T) { @@ -15,8 +15,7 @@ func TestNewNSQ(t *testing.T) { HTTPEndpoint: "rest", } publisher := bus.NewPublisher - logger := zap.NewNop() - + logger := slog.Default() actual := NewNSQ(cfg, logger, publisher) assert.NotNil(t, actual) @@ -32,7 +31,7 @@ func TestNSQ_WaitForPublisher(t *testing.T) { } publisher := NopPublisher{} - nsq := NewNSQ(cfg, zap.NewNop(), func(logger *zap.Logger, config *bus.PublisherConfig) (bus.Publisher, error) { + nsq := NewNSQ(cfg, slog.Default(), func(logger *slog.Logger, config *bus.PublisherConfig) (bus.Publisher, error) { assert.Equal(t, cfg.TCPAddress, config.TCPAddress) assert.Equal(t, cfg.HTTPEndpoint, config.HTTPEndpoint) return publisher, nil @@ -54,7 +53,7 @@ func TestNSQ_WaitForTopicsCreated(t *testing.T) { T: t, topic: topic.GetFQN(partition.GetID()), } - nsq := NewNSQ(nil, zap.NewNop(), func(*zap.Logger, *bus.PublisherConfig) (bus.Publisher, error) { + nsq := NewNSQ(nil, slog.Default(), func(*slog.Logger, *bus.PublisherConfig) (bus.Publisher, error) { return nil, nil }) assert.NotNil(t, nsq) diff --git a/cmd/metal-api/internal/fsm/fsm.go b/cmd/metal-api/internal/fsm/fsm.go index 88ac952f9..624cbc895 100644 --- a/cmd/metal-api/internal/fsm/fsm.go +++ b/cmd/metal-api/internal/fsm/fsm.go @@ -3,12 +3,12 @@ package fsm import ( "errors" "fmt" + "log/slog" "strings" "github.com/looplab/fsm" "github.com/metal-stack/metal-api/cmd/metal-api/internal/fsm/states" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" - "go.uber.org/zap" ) // HandleProvisioningEvent can be called to determine whether the given incoming event follows an expected lifecycle of a machine considering the event history of the given provisioning event container. @@ -16,7 +16,7 @@ import ( // The function returns a new provisioning event container that can then be safely persisted in the database. If an error is returned, the incoming event is not supposed to be persisted in the database. // // Among other things, this function can detect crash loops or other irregularities within a machine lifecycle and enriches the returned provisioning event container with this information. -func HandleProvisioningEvent(log *zap.SugaredLogger, ec *metal.ProvisioningEventContainer, event *metal.ProvisioningEvent) (*metal.ProvisioningEventContainer, error) { +func HandleProvisioningEvent(log *slog.Logger, ec *metal.ProvisioningEventContainer, event *metal.ProvisioningEvent) (*metal.ProvisioningEventContainer, error) { if ec == nil { return nil, fmt.Errorf("provisioning event container must not be nil") } diff --git a/cmd/metal-api/internal/fsm/fsm_test.go b/cmd/metal-api/internal/fsm/fsm_test.go index 4e2d20dab..324d0a40e 100644 --- a/cmd/metal-api/internal/fsm/fsm_test.go +++ b/cmd/metal-api/internal/fsm/fsm_test.go @@ -1,12 +1,12 @@ package fsm import ( + "log/slog" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" - "go.uber.org/zap/zaptest" ) func TestHandleProvisioningEvent(t *testing.T) { @@ -629,7 +629,7 @@ func TestHandleProvisioningEvent(t *testing.T) { for i := range tests { tt := tests[i] t.Run(tt.name, func(t *testing.T) { - got, err := HandleProvisioningEvent(zaptest.NewLogger(t).Sugar(), tt.container, tt.event) + got, err := HandleProvisioningEvent(slog.Default(), tt.container, tt.event) if diff := cmp.Diff(tt.wantErr, err); diff != "" { t.Errorf("HandleProvisioningEvent() diff = %s", diff) } @@ -649,7 +649,7 @@ func TestReactionToAllIncomingEvents(t *testing.T) { // this test ensures that for every incoming event we have a proper transition for e1 := range metal.AllProvisioningEventTypes { for e2 := range metal.AllProvisioningEventTypes { - _, err := HandleProvisioningEvent(zaptest.NewLogger(t).Sugar(), &metal.ProvisioningEventContainer{ + _, err := HandleProvisioningEvent(slog.Default(), &metal.ProvisioningEventContainer{ Events: metal.ProvisioningEvents{ { Event: e2, diff --git a/cmd/metal-api/internal/fsm/states/alive.go b/cmd/metal-api/internal/fsm/states/alive.go index 0cdd53695..e7deb81d4 100644 --- a/cmd/metal-api/internal/fsm/states/alive.go +++ b/cmd/metal-api/internal/fsm/states/alive.go @@ -1,13 +1,14 @@ package states import ( + "log/slog" + "github.com/looplab/fsm" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" - "go.uber.org/zap" ) type AliveState struct { - log *zap.SugaredLogger + log *slog.Logger container *metal.ProvisioningEventContainer event *metal.ProvisioningEvent } @@ -22,5 +23,5 @@ func newAlive(c *StateConfig) *AliveState { func (p *AliveState) OnTransition(e *fsm.Event) { updateTimeAndLiveliness(p.event, p.container) - p.log.Debugw("received provisioning alive event", "id", p.container.ID) + p.log.Debug("received provisioning alive event", "id", p.container.ID) } diff --git a/cmd/metal-api/internal/fsm/states/phoned-home.go b/cmd/metal-api/internal/fsm/states/phoned-home.go index a3c5c4ffa..95568d027 100644 --- a/cmd/metal-api/internal/fsm/states/phoned-home.go +++ b/cmd/metal-api/internal/fsm/states/phoned-home.go @@ -1,18 +1,18 @@ package states import ( + "log/slog" "time" "github.com/looplab/fsm" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" - "go.uber.org/zap" ) // failedMachineReclaimThreshold is the duration after which the machine reclaim is assumed to have failed. const failedMachineReclaimThreshold = 5 * time.Minute type PhonedHomeState struct { - log *zap.SugaredLogger + log *slog.Logger container *metal.ProvisioningEventContainer event *metal.ProvisioningEvent } @@ -29,7 +29,7 @@ func (p *PhonedHomeState) OnTransition(e *fsm.Event) { switch e.Src { case PhonedHome.String(): updateTimeAndLiveliness(p.event, p.container) - p.log.Debugw("swallowing repeated phoned home event", "id", p.container.ID) + p.log.Debug("swallowing repeated phoned home event", "id", p.container.ID) case MachineReclaim.String(): // swallow on machine reclaim if p.container.LastEventTime != nil && p.event.Time.Sub(*p.container.LastEventTime) > failedMachineReclaimThreshold { diff --git a/cmd/metal-api/internal/fsm/states/states.go b/cmd/metal-api/internal/fsm/states/states.go index 6f1604b28..6ab10e539 100644 --- a/cmd/metal-api/internal/fsm/states/states.go +++ b/cmd/metal-api/internal/fsm/states/states.go @@ -1,9 +1,10 @@ package states import ( + "log/slog" + "github.com/looplab/fsm" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" - "go.uber.org/zap" ) const ( @@ -32,7 +33,7 @@ func (t stateType) String() string { } type StateConfig struct { - Log *zap.SugaredLogger + Log *slog.Logger Container *metal.ProvisioningEventContainer Event *metal.ProvisioningEvent } diff --git a/cmd/metal-api/internal/grpc/boot-service-wait.go b/cmd/metal-api/internal/grpc/boot-service-wait.go index 532451f96..89fef64ca 100644 --- a/cmd/metal-api/internal/grpc/boot-service-wait.go +++ b/cmd/metal-api/internal/grpc/boot-service-wait.go @@ -17,7 +17,7 @@ const ( func (b *BootService) Wait(req *v1.BootServiceWaitRequest, srv v1.BootService_WaitServer) error { machineID := req.MachineId - b.log.Infow("wait for allocation called by", "machineID", machineID) + b.log.Info("wait for allocation called by", "machineID", machineID) m, err := b.ds.FindMachineByID(machineID) if err != nil { @@ -39,7 +39,7 @@ func (b *BootService) Wait(req *v1.BootServiceWaitRequest, srv v1.BootService_Wa } err := b.updateWaitingFlag(machineID, false) if err != nil { - b.log.Errorw("unable to remove waiting flag from machine", "machineID", machineID, "error", err) + b.log.Error("unable to remove waiting flag from machine", "machineID", machineID, "error", err) } }() @@ -102,7 +102,7 @@ func (b *BootService) initWaitEndpoint() error { MustRegister(metal.TopicAllocation.Name, channel). Consume(metal.AllocationEvent{}, func(message interface{}) error { evt := message.(*metal.AllocationEvent) - b.log.Debugw("got message", "topic", metal.TopicAllocation.Name, "channel", channel, "machineID", evt.MachineID) + b.log.Debug("got message", "topic", metal.TopicAllocation.Name, "channel", channel, "machineID", evt.MachineID) b.handleAllocation(evt.MachineID) return nil }, 5, bus.Timeout(receiverHandlerTimeout, b.timeoutHandler), bus.TTL(allocationTopicTTL)) diff --git a/cmd/metal-api/internal/grpc/boot-service-wait_integration_test.go b/cmd/metal-api/internal/grpc/boot-service-wait_integration_test.go index 1ac45ed12..3eab7fa00 100644 --- a/cmd/metal-api/internal/grpc/boot-service-wait_integration_test.go +++ b/cmd/metal-api/internal/grpc/boot-service-wait_integration_test.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "io" + "log/slog" "math/rand/v2" "strconv" "sync" @@ -18,7 +19,6 @@ import ( "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" v1 "github.com/metal-stack/metal-api/pkg/api/v1" "github.com/stretchr/testify/require" - "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/keepalive" @@ -220,7 +220,7 @@ func (t *test) startApiInstances(ds *datastore.RethinkStore) { cfg := &ServerConfig{ Context: ctx, Store: ds, - Logger: zap.NewNop().Sugar(), + Logger: slog.Default(), GrpcPort: 50005 + i, TlsEnabled: false, ResponseInterval: 2 * time.Millisecond, diff --git a/cmd/metal-api/internal/grpc/boot-service.go b/cmd/metal-api/internal/grpc/boot-service.go index b8d99025c..d6c9dd644 100644 --- a/cmd/metal-api/internal/grpc/boot-service.go +++ b/cmd/metal-api/internal/grpc/boot-service.go @@ -4,11 +4,11 @@ import ( "context" "errors" "fmt" + "log/slog" "sync" "time" "github.com/avast/retry-go/v4" - "go.uber.org/zap" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" @@ -17,7 +17,7 @@ import ( ) type BootService struct { - log *zap.SugaredLogger + log *slog.Logger ds *datastore.RethinkStore ipmiSuperUser metal.MachineIPMISuperUser publisher bus.Publisher @@ -29,7 +29,7 @@ type BootService struct { } func NewBootService(cfg *ServerConfig, eventService *EventService) *BootService { - log := cfg.Logger.Named("boot-service") + log := cfg.Logger.WithGroup("boot-service") return &BootService{ ds: cfg.Store, @@ -45,7 +45,7 @@ func NewBootService(cfg *ServerConfig, eventService *EventService) *BootService } func (b *BootService) Dhcp(ctx context.Context, req *v1.BootServiceDhcpRequest) (*v1.BootServiceDhcpResponse, error) { - b.log.Infow("dhcp", "req", req) + b.log.Info("dhcp", "req", req) _, err := b.eventService.Send(ctx, &v1.EventServiceSendRequest{Events: map[string]*v1.MachineProvisioningEvent{ req.Uuid: { @@ -60,7 +60,7 @@ func (b *BootService) Dhcp(ctx context.Context, req *v1.BootServiceDhcpRequest) } func (b *BootService) Boot(ctx context.Context, req *v1.BootServiceBootRequest) (*v1.BootServiceBootResponse, error) { - b.log.Infow("boot", "req", req) + b.log.Info("boot", "req", req) p, err := b.ds.FindPartition(req.PartitionId) if err != nil || p == nil { @@ -72,12 +72,12 @@ func (b *BootService) Boot(ctx context.Context, req *v1.BootServiceBootRequest) InitRamDisks: []string{p.BootConfiguration.ImageURL}, Cmdline: &p.BootConfiguration.CommandLine, } - b.log.Infow("boot", "resp", resp) + b.log.Info("boot", "resp", resp) return resp, nil } func (b *BootService) Register(ctx context.Context, req *v1.BootServiceRegisterRequest) (*v1.BootServiceRegisterResponse, error) { - b.log.Infow("register", "req", req) + b.log.Info("register", "req", req) if req.Uuid == "" { return nil, errors.New("uuid is empty") } @@ -134,7 +134,7 @@ func (b *BootService) Register(ctx context.Context, req *v1.BootServiceRegisterR size, _, err := b.ds.FromHardware(machineHardware) if err != nil { size = metal.UnknownSize() - b.log.Errorw("no size found for hardware, defaulting to unknown size", "hardware", machineHardware, "error", err) + b.log.Error("no size found for hardware, defaulting to unknown size", "hardware", machineHardware, "error", err) } var ipmi metal.IPMI @@ -277,7 +277,7 @@ func (b *BootService) Register(ctx context.Context, req *v1.BootServiceRegisterR } func (b *BootService) SuperUserPassword(ctx context.Context, req *v1.BootServiceSuperUserPasswordRequest) (*v1.BootServiceSuperUserPasswordResponse, error) { - b.log.Infow("superuserpassword", "req", req) + b.log.Info("superuserpassword", "req", req) defer ctx.Done() resp := &v1.BootServiceSuperUserPasswordResponse{ @@ -289,7 +289,7 @@ func (b *BootService) SuperUserPassword(ctx context.Context, req *v1.BootService } func (b *BootService) Report(ctx context.Context, req *v1.BootServiceReportRequest) (*v1.BootServiceReportResponse, error) { - b.log.Infow("report", "req", req) + b.log.Info("report", "req", req) // FIXME implement success handling @@ -365,7 +365,7 @@ func (b *BootService) Report(ctx context.Context, req *v1.BootServiceReportReque } func (b *BootService) AbortReinstall(ctx context.Context, req *v1.BootServiceAbortReinstallRequest) (*v1.BootServiceAbortReinstallResponse, error) { - b.log.Infow("abortreinstall", "req", req) + b.log.Info("abortreinstall", "req", req) m, err := b.ds.FindMachineByID(req.Uuid) if err != nil { return nil, err @@ -385,7 +385,7 @@ func (b *BootService) AbortReinstall(ctx context.Context, req *v1.BootServiceAbo if err != nil { return nil, err } - b.log.Infow("removed reinstall mark", "machineID", m.ID) + b.log.Info("removed reinstall mark", "machineID", m.ID) if m.Allocation.MachineSetup != nil { bootInfo = &v1.BootInfo{ @@ -415,9 +415,9 @@ func (b *BootService) setBootOrderDisk(m *metal.Machine) { }, } - b.log.Infow("publish event", "event", evt, "command", *evt.Cmd) + b.log.Info("publish event", "event", evt, "command", *evt.Cmd) err := b.publisher.Publish(metal.TopicMachine.GetFQN(m.PartitionID), evt) if err != nil { - b.log.Errorw("unable to send boot via hd, continue anyway", "error", err) + b.log.Error("unable to send boot via hd, continue anyway", "error", err) } } diff --git a/cmd/metal-api/internal/grpc/boot-service_test.go b/cmd/metal-api/internal/grpc/boot-service_test.go index a112e811f..742b60b33 100644 --- a/cmd/metal-api/internal/grpc/boot-service_test.go +++ b/cmd/metal-api/internal/grpc/boot-service_test.go @@ -2,6 +2,7 @@ package grpc import ( "context" + "log/slog" "reflect" "sync" "testing" @@ -12,7 +13,6 @@ import ( v1 "github.com/metal-stack/metal-api/pkg/api/v1" "github.com/metal-stack/metal-lib/bus" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" r "gopkg.in/rethinkdb/rethinkdb-go.v6" ) @@ -151,7 +151,7 @@ func TestBootService_Register(t *testing.T) { } bootService := &BootService{ - log: zaptest.NewLogger(t).Sugar(), + log: slog.Default(), ds: ds, ipmiSuperUser: metal.DisabledIPMISuperUser(), publisher: &emptyPublisher{}, @@ -217,7 +217,7 @@ func TestBootService_Report(t *testing.T) { tt := tt t.Run(tt.name, func(t *testing.T) { b := &BootService{ - log: zaptest.NewLogger(t).Sugar(), + log: slog.Default(), ds: ds, ipmiSuperUser: metal.DisabledIPMISuperUser(), publisher: &emptyPublisher{}, diff --git a/cmd/metal-api/internal/grpc/event-service.go b/cmd/metal-api/internal/grpc/event-service.go index bbd7f6137..e869ff9ea 100644 --- a/cmd/metal-api/internal/grpc/event-service.go +++ b/cmd/metal-api/internal/grpc/event-service.go @@ -4,27 +4,27 @@ import ( "context" "errors" "fmt" + "log/slog" "time" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" v1 "github.com/metal-stack/metal-api/pkg/api/v1" - "go.uber.org/zap" ) type EventService struct { - log *zap.SugaredLogger + log *slog.Logger ds *datastore.RethinkStore } func NewEventService(cfg *ServerConfig) *EventService { return &EventService{ ds: cfg.Store, - log: cfg.Logger.Named("event-service"), + log: cfg.Logger.WithGroup("event-service"), } } func (e *EventService) Send(ctx context.Context, req *v1.EventServiceSendRequest) (*v1.EventServiceSendResponse, error) { - e.log.Debugw("send", "event", req) + e.log.Debug("send", "event", req) if req == nil { return nil, fmt.Errorf("no event send") } diff --git a/cmd/metal-api/internal/grpc/event-service_test.go b/cmd/metal-api/internal/grpc/event-service_test.go index 297eae30f..c8f5720d9 100644 --- a/cmd/metal-api/internal/grpc/event-service_test.go +++ b/cmd/metal-api/internal/grpc/event-service_test.go @@ -2,6 +2,7 @@ package grpc import ( "context" + "log/slog" "reflect" "testing" @@ -10,8 +11,6 @@ import ( "github.com/metal-stack/metal-api/cmd/metal-api/internal/testdata" v1 "github.com/metal-stack/metal-api/pkg/api/v1" - "go.uber.org/zap" - "go.uber.org/zap/zaptest" ) func TestEventService_Send(t *testing.T) { @@ -22,7 +21,7 @@ func TestEventService_Send(t *testing.T) { name string req *v1.EventServiceSendRequest ds *datastore.RethinkStore - log *zap.SugaredLogger + log *slog.Logger want *v1.EventServiceSendResponse wantErr bool }{ @@ -37,7 +36,7 @@ func TestEventService_Send(t *testing.T) { }, }, ds: ds, - log: zaptest.NewLogger(t).Sugar(), + log: slog.Default(), want: &v1.EventServiceSendResponse{ Events: uint64(1), Failed: []string{}, diff --git a/cmd/metal-api/internal/grpc/grpc-server.go b/cmd/metal-api/internal/grpc/grpc-server.go index 9f40d6adc..26b21dab6 100644 --- a/cmd/metal-api/internal/grpc/grpc-server.go +++ b/cmd/metal-api/internal/grpc/grpc-server.go @@ -5,17 +5,21 @@ import ( "crypto/tls" "crypto/x509" "fmt" + "log/slog" "net" "os" "runtime/debug" "time" - grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" - grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" - grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" - grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags" - grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/metal-stack/masterdata-api/pkg/interceptors/grpc_internalerror" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/collectors" + + grpcprom "github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus" + "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" + "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/recovery" + "github.com/prometheus/client_golang/prometheus/promauto" + "go.opentelemetry.io/otel/trace" + "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/keepalive" @@ -27,7 +31,6 @@ import ( v1 "github.com/metal-stack/metal-api/pkg/api/v1" "github.com/metal-stack/metal-lib/auditing" "github.com/metal-stack/metal-lib/bus" - "go.uber.org/zap" ) const ( @@ -40,7 +43,7 @@ type ServerConfig struct { Publisher bus.Publisher Consumer *bus.Consumer Store *datastore.RethinkStore - Logger *zap.SugaredLogger + Logger *slog.Logger GrpcPort int TlsEnabled bool CaCertFile string @@ -72,56 +75,83 @@ func Run(cfg *ServerConfig) error { Timeout: 1 * time.Second, // Wait 1 second for the ping ack before assuming the connection is dead } - log := cfg.Logger.Named("grpc") - grpc_zap.ReplaceGrpcLoggerV2(log.Desugar()) + log := cfg.Logger.WithGroup("grpc") - recoveryOpt := grpc_recovery.WithRecoveryHandlerContext( + recoveryOpt := recovery.WithRecoveryHandlerContext( func(ctx context.Context, p any) error { - log.Errorf("[PANIC] %s stack:%s", p, string(debug.Stack())) + log.Error("[PANIC] %s stack:%s", p, string(debug.Stack())) return status.Errorf(codes.Internal, "%s", p) }, ) - shouldAudit := func(fullMethod string) bool { - switch fullMethod { - case "/api.v1.BootService/Register": - return true - default: - return false + srvMetrics := grpcprom.NewServerMetrics( + grpcprom.WithServerHandlingTimeHistogram( + grpcprom.WithHistogramBuckets([]float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120}), + ), + ) + exemplarFromContext := func(ctx context.Context) prometheus.Labels { + if span := trace.SpanContextFromContext(ctx); span.IsSampled() { + return prometheus.Labels{"traceID": span.TraceID().String()} } + return nil + } + // Setup metric for panic recoveries. + reg := prometheus.NewRegistry() + reg.MustRegister(srvMetrics) + reg.MustRegister(collectors.NewGoCollector()) + panicsTotal := promauto.With(reg).NewCounter(prometheus.CounterOpts{ + Name: "grpc_req_panics_recovered_total", + Help: "Total number of gRPC requests recovered from internal panic.", + }) + grpcPanicRecoveryHandler := func(p any) (err error) { + panicsTotal.Inc() + log.Error("msg", "recovered from panic", "panic", p, "stack", debug.Stack()) + return status.Errorf(codes.Internal, "%s", p) } - streamInterceptors := []grpc.StreamServerInterceptor{} - unaryInterceptors := []grpc.UnaryServerInterceptor{} + streamInterceptors := []grpc.StreamServerInterceptor{ + srvMetrics.StreamServerInterceptor(grpcprom.WithExemplarFromContext(exemplarFromContext)), + logging.StreamServerInterceptor(interceptorLogger(log)), + recovery.StreamServerInterceptor(recovery.WithRecoveryHandler(grpcPanicRecoveryHandler)), + } + unaryInterceptors := []grpc.UnaryServerInterceptor{ + // Order matters e.g. tracing interceptor have to create span first for the later exemplars to work. + srvMetrics.UnaryServerInterceptor(), + logging.UnaryServerInterceptor(interceptorLogger(log)), + recovery.UnaryServerInterceptor(recovery.WithRecoveryHandler(grpcPanicRecoveryHandler)), + } if cfg.Auditing != nil { - streamInterceptors = append(streamInterceptors, auditing.StreamServerInterceptor(cfg.Auditing, log.Named("auditing-grpc"), shouldAudit)) - unaryInterceptors = append(unaryInterceptors, auditing.UnaryServerInterceptor(cfg.Auditing, log.Named("auditing-grpc"), shouldAudit)) + shouldAudit := func(fullMethod string) bool { + switch fullMethod { + case "/api.v1.BootService/Register": + return true + default: + return false + } + } + auditStreamInterceptor, err := auditing.StreamServerInterceptor(cfg.Auditing, log.WithGroup("auditing-grpc"), shouldAudit) + if err != nil { + return err + } + auditUnaryInterceptor, err := auditing.UnaryServerInterceptor(cfg.Auditing, log.WithGroup("auditing-grpc"), shouldAudit) + if err != nil { + return err + } + streamInterceptors = append(streamInterceptors, auditStreamInterceptor) + unaryInterceptors = append(unaryInterceptors, auditUnaryInterceptor) } - unaryInterceptors = append(unaryInterceptors, metrics.GrpcMetrics) - - streamInterceptors = append(streamInterceptors, - grpc_ctxtags.StreamServerInterceptor(), - grpc_prometheus.StreamServerInterceptor, - grpc_zap.StreamServerInterceptor(log.Desugar()), - grpc_internalerror.StreamServerInterceptor(), - grpc_recovery.StreamServerInterceptor(recoveryOpt), - ) - unaryInterceptors = append(unaryInterceptors, - grpc_ctxtags.UnaryServerInterceptor(), - grpc_prometheus.UnaryServerInterceptor, - grpc_zap.UnaryServerInterceptor(log.Desugar()), - grpc_internalerror.UnaryServerInterceptor(), - grpc_recovery.UnaryServerInterceptor(recoveryOpt), - ) + unaryInterceptors = append(unaryInterceptors, metrics.GrpcMetrics, recovery.UnaryServerInterceptor(recoveryOpt)) - server := grpc.NewServer( + opts := []grpc.ServerOption{ grpc.KeepaliveEnforcementPolicy(kaep), grpc.KeepaliveParams(kasp), - grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(streamInterceptors...)), - grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(unaryInterceptors...)), - ) - grpc_prometheus.Register(server) + grpc.ChainUnaryInterceptor(unaryInterceptors...), + grpc.ChainStreamInterceptor(streamInterceptors...), + } + + grpcServer := grpc.NewServer(opts...) + srvMetrics.InitializeMetrics(grpcServer) eventService := NewEventService(cfg) bootService := NewBootService(cfg, eventService) @@ -131,8 +161,8 @@ func Run(cfg *ServerConfig) error { return err } - v1.RegisterEventServiceServer(server, eventService) - v1.RegisterBootServiceServer(server, bootService) + v1.RegisterEventServiceServer(grpcServer, eventService) + v1.RegisterBootServiceServer(grpcServer, bootService) // this is only for the integration test of this package if cfg.integrationTestAllocator != nil { @@ -184,12 +214,31 @@ func Run(cfg *ServerConfig) error { } go func() { - log.Infow("serve gRPC", "address", listener.Addr()) - err = server.Serve(listener) + log.Info("serve gRPC", "address", listener.Addr()) + err = grpcServer.Serve(listener) }() <-cfg.Context.Done() - server.Stop() + grpcServer.Stop() return err } + +// interceptorLogger adapts slog logger to interceptor logger. +// This code is simple enough to be copied and not imported. +func interceptorLogger(l *slog.Logger) logging.Logger { + return logging.LoggerFunc(func(_ context.Context, lvl logging.Level, msg string, fields ...any) { + switch lvl { + case logging.LevelDebug: + l.Debug(msg, fields...) + case logging.LevelInfo: + l.Info(msg, fields...) + case logging.LevelWarn: + l.Warn(msg, fields...) + case logging.LevelError: + l.Error(msg, fields...) + default: + panic(fmt.Sprintf("unknown level %v", lvl)) + } + }) +} diff --git a/cmd/metal-api/internal/headscale/client.go b/cmd/metal-api/internal/headscale/client.go index 9dc7864d4..7d634ca7d 100644 --- a/cmd/metal-api/internal/headscale/client.go +++ b/cmd/metal-api/internal/headscale/client.go @@ -3,11 +3,10 @@ package headscale import ( "context" "fmt" + "log/slog" "strings" "time" - "go.uber.org/zap" - headscalev1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/juanfont/headscale/hscontrol" "google.golang.org/grpc" @@ -22,10 +21,10 @@ type HeadscaleClient struct { controlPlaneAddress string conn *grpc.ClientConn - logger *zap.SugaredLogger + logger *slog.Logger } -func NewHeadscaleClient(addr, controlPlaneAddr, apiKey string, logger *zap.SugaredLogger) (client *HeadscaleClient, err error) { +func NewHeadscaleClient(addr, controlPlaneAddr, apiKey string, logger *slog.Logger) (client *HeadscaleClient, err error) { if addr != "" || apiKey != "" { if addr == "" { return nil, fmt.Errorf("headscale address should be set with api key") diff --git a/cmd/metal-api/internal/metal/machine.go b/cmd/metal-api/internal/metal/machine.go index f7fdb5d6c..4107d21b2 100644 --- a/cmd/metal-api/internal/metal/machine.go +++ b/cmd/metal-api/internal/metal/machine.go @@ -2,6 +2,7 @@ package metal import ( "fmt" + "log/slog" "net/netip" "os" "slices" @@ -10,7 +11,6 @@ import ( "github.com/dustin/go-humanize" mn "github.com/metal-stack/metal-lib/pkg/net" - "go.uber.org/zap" ) // A MState is an enum which indicates the state of a machine @@ -617,14 +617,14 @@ type MachineIPMISuperUser struct { password string } -func NewIPMISuperUser(log *zap.SugaredLogger, path string) MachineIPMISuperUser { +func NewIPMISuperUser(log *slog.Logger, path string) MachineIPMISuperUser { password := "" if raw, err := os.ReadFile(path); err == nil { - log.Infow("ipmi superuser password found, feature is enabled") + log.Info("ipmi superuser password found, feature is enabled") password = strings.TrimSpace(string(raw)) } else { - log.Infow("ipmi superuser password could not be read, feature is disabled", "error", err) + log.Info("ipmi superuser password could not be read, feature is disabled", "error", err) } return MachineIPMISuperUser{ diff --git a/cmd/metal-api/internal/service/async-actor.go b/cmd/metal-api/internal/service/async-actor.go index d5f4f051e..a2f98a54b 100644 --- a/cmd/metal-api/internal/service/async-actor.go +++ b/cmd/metal-api/internal/service/async-actor.go @@ -4,11 +4,10 @@ import ( "context" "errors" "fmt" + "log/slog" "github.com/metal-stack/metal-api/cmd/metal-api/internal/headscale" - "go.uber.org/zap" - ipamer "github.com/metal-stack/go-ipam" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" "github.com/metal-stack/metal-api/cmd/metal-api/internal/ipam" @@ -18,14 +17,14 @@ import ( ) type asyncActor struct { - log *zap.SugaredLogger + log *slog.Logger ipam.IPAMer *datastore.RethinkStore machineNetworkReleaser bus.Func ipReleaser bus.Func } -func newAsyncActor(l *zap.SugaredLogger, ep *bus.Endpoints, ds *datastore.RethinkStore, ip ipam.IPAMer) (*asyncActor, error) { +func newAsyncActor(l *slog.Logger, ep *bus.Endpoints, ds *datastore.RethinkStore, ip ipam.IPAMer) (*asyncActor, error) { actor := &asyncActor{ log: l, IPAMer: ip, @@ -43,7 +42,7 @@ func newAsyncActor(l *zap.SugaredLogger, ep *bus.Endpoints, ds *datastore.Rethin return actor, nil } -func (a *asyncActor) freeMachine(ctx context.Context, pub bus.Publisher, m *metal.Machine, headscaleClient *headscale.HeadscaleClient, logger *zap.SugaredLogger) error { +func (a *asyncActor) freeMachine(ctx context.Context, pub bus.Publisher, m *metal.Machine, headscaleClient *headscale.HeadscaleClient, logger *slog.Logger) error { if m.State.Value == metal.LockedState { return errors.New("machine is locked") } @@ -51,16 +50,16 @@ func (a *asyncActor) freeMachine(ctx context.Context, pub bus.Publisher, m *meta if headscaleClient != nil && m.Allocation != nil { // always call DeleteMachine, in case machine is not registered it will return nil if err := headscaleClient.DeleteMachine(ctx, m.ID, m.Allocation.Project); err != nil { - logger.Error("unable to delete Node entry from headscale DB", zap.String("machineID", m.ID), zap.Error(err)) + logger.Error("unable to delete Node entry from headscale DB", "machineID", m.ID, "error", err) } } - err := deleteVRFSwitches(a.RethinkStore, m, a.log.Desugar()) + err := deleteVRFSwitches(a.RethinkStore, m, a.log) if err != nil { return err } - err = publishDeleteEvent(pub, m, a.log.Desugar()) + err = publishDeleteEvent(pub, m, a.log) if err != nil { return err } @@ -71,7 +70,7 @@ func (a *asyncActor) freeMachine(ctx context.Context, pub bus.Publisher, m *meta // log error, but what should we do here? we already called // deleteVRFSwitches and publishDeleteEvent, so should we return // an error or "fall through"? - a.log.Errorw("cannot call async machine cleanup", "error", err) + a.log.Error("cannot call async machine cleanup", "error", err) } old := *m @@ -84,7 +83,7 @@ func (a *asyncActor) freeMachine(ctx context.Context, pub bus.Publisher, m *meta if err != nil { return err } - a.log.Infow("freed machine", "machineID", m.ID) + a.log.Info("freed machine", "machineID", m.ID) return nil } @@ -175,10 +174,10 @@ func (a *asyncActor) disassociateIP(ip *metal.IP, machine *metal.Machine) error // begin of this loop checks if the IP contains the machine. // so we fork a new job to delete the IP. if this fails .... well then ("houston we have a problem") // we do not report the error to the caller, because this whole function cannot be re-do'ed. - a.log.Infow("async release IP", "ip", *ip) + a.log.Info("async release IP", "ip", *ip) if err := a.ipReleaser(*ip); err != nil { // what should we do here? this error shows a problem with the nsq-bus system - a.log.Errorw("cannot call ip releaser", "error", err) + a.log.Error("cannot call ip releaser", "error", err) } return nil @@ -189,12 +188,12 @@ func (a *asyncActor) disassociateIP(ip *metal.IP, machine *metal.Machine) error // to implement more validations: when a machine is deleted the caller has to check if the IP // is static or not. If only an IP is freed, the caller has to check if the IP has machine scope. func (a *asyncActor) releaseIP(ip metal.IP) error { - a.log.Infow("release IP", "ip", ip) + a.log.Info("release IP", "ip", ip) dbip, err := a.FindIPByID(ip.IPAddress) if err != nil && !metal.IsNotFound(err) { // some unknown error, we will let nsq resend the command - a.log.Errorw("cannot find IP", "ip", ip, "error", err) + a.log.Error("cannot find IP", "ip", ip, "error", err) return err } @@ -203,14 +202,14 @@ func (a *asyncActor) releaseIP(ip metal.IP) error { // moment it can happen that we already deleted and released the IP in the ipam // so make sure that this IP is not already connected to a new machine if len(dbip.GetMachineIds()) > 0 { - a.log.Infow("do not delete IP, it is connected to a machine", "ip", ip) + a.log.Info("do not delete IP, it is connected to a machine", "ip", ip) return nil } // the ip is in our database and is not connected to a machine so cleanup err = a.DeleteIP(&ip) if err != nil { - a.log.Errorw("cannot delete IP in datastore", "ip", ip, "error", err) + a.log.Error("cannot delete IP in datastore", "ip", ip, "error", err) return err } } diff --git a/cmd/metal-api/internal/service/audit-service.go b/cmd/metal-api/internal/service/audit-service.go index a3766d65e..2532b6abf 100644 --- a/cmd/metal-api/internal/service/audit-service.go +++ b/cmd/metal-api/internal/service/audit-service.go @@ -1,11 +1,11 @@ package service import ( + "log/slog" "net/http" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" "github.com/metal-stack/metal-lib/auditing" - "go.uber.org/zap" restfulspec "github.com/emicklei/go-restful-openapi/v2" restful "github.com/emicklei/go-restful/v3" @@ -17,7 +17,7 @@ type auditResource struct { a auditing.Auditing } -func NewAudit(log *zap.SugaredLogger, a auditing.Auditing) *restful.WebService { +func NewAudit(log *slog.Logger, a auditing.Auditing) *restful.WebService { ir := auditResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/filesystem-service.go b/cmd/metal-api/internal/service/filesystem-service.go index 7df3ca872..3ce830ece 100644 --- a/cmd/metal-api/internal/service/filesystem-service.go +++ b/cmd/metal-api/internal/service/filesystem-service.go @@ -3,12 +3,12 @@ package service import ( "errors" "fmt" + "log/slog" "net/http" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" "github.com/metal-stack/metal-lib/auditing" - "go.uber.org/zap" restfulspec "github.com/emicklei/go-restful-openapi/v2" restful "github.com/emicklei/go-restful/v3" @@ -20,7 +20,7 @@ type filesystemResource struct { } // NewFilesystemLayout returns a webservice for filesystem specific endpoints. -func NewFilesystemLayout(log *zap.SugaredLogger, ds *datastore.RethinkStore) *restful.WebService { +func NewFilesystemLayout(log *slog.Logger, ds *datastore.RethinkStore) *restful.WebService { r := filesystemResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/firewall-service.go b/cmd/metal-api/internal/service/firewall-service.go index 8d8309145..757cdd6de 100644 --- a/cmd/metal-api/internal/service/firewall-service.go +++ b/cmd/metal-api/internal/service/firewall-service.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "time" "net/http" @@ -13,8 +14,6 @@ import ( "github.com/metal-stack/security" - "go.uber.org/zap" - "github.com/metal-stack/metal-lib/httperrors" mdm "github.com/metal-stack/masterdata-api/pkg/client" @@ -42,7 +41,7 @@ type firewallResource struct { // NewFirewall returns a webservice for firewall specific endpoints. func NewFirewall( - log *zap.SugaredLogger, + log *slog.Logger, ds *datastore.RethinkStore, pub bus.Publisher, ipamer ipam.IPAMer, diff --git a/cmd/metal-api/internal/service/firmware-service.go b/cmd/metal-api/internal/service/firmware-service.go index 6439cb9a8..70edd5e5e 100644 --- a/cmd/metal-api/internal/service/firmware-service.go +++ b/cmd/metal-api/internal/service/firmware-service.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "net/http" "strings" @@ -12,7 +13,6 @@ import ( s3server "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/s3client" "github.com/metal-stack/metal-lib/httperrors" - "go.uber.org/zap" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" @@ -29,7 +29,7 @@ type firmwareResource struct { } // NewFirmware returns a webservice for firmware specific endpoints. -func NewFirmware(log *zap.SugaredLogger, ds *datastore.RethinkStore, s3Client *s3server.Client) (*restful.WebService, error) { +func NewFirmware(log *slog.Logger, ds *datastore.RethinkStore, s3Client *s3server.Client) (*restful.WebService, error) { r := firmwareResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/image-service.go b/cmd/metal-api/internal/service/image-service.go index f78c34a81..b24b8d126 100644 --- a/cmd/metal-api/internal/service/image-service.go +++ b/cmd/metal-api/internal/service/image-service.go @@ -3,6 +3,7 @@ package service import ( "errors" "fmt" + "log/slog" "net/http" "strconv" "time" @@ -12,7 +13,6 @@ import ( v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" "github.com/metal-stack/metal-api/cmd/metal-api/internal/utils" "github.com/metal-stack/metal-lib/auditing" - "go.uber.org/zap" restfulspec "github.com/emicklei/go-restful-openapi/v2" restful "github.com/emicklei/go-restful/v3" @@ -24,7 +24,7 @@ type imageResource struct { } // NewImage returns a webservice for image specific endpoints. -func NewImage(log *zap.SugaredLogger, ds *datastore.RethinkStore) *restful.WebService { +func NewImage(log *slog.Logger, ds *datastore.RethinkStore) *restful.WebService { ir := imageResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/image-service_integration_test.go b/cmd/metal-api/internal/service/image-service_integration_test.go index 3c68b7a68..8571a91ee 100644 --- a/cmd/metal-api/internal/service/image-service_integration_test.go +++ b/cmd/metal-api/internal/service/image-service_integration_test.go @@ -7,6 +7,7 @@ import ( "context" "encoding/json" "io" + "log/slog" "net/http" "net/http/httptest" "strings" @@ -19,7 +20,6 @@ import ( "github.com/metal-stack/metal-api/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) func TestGetImagesIntegration(t *testing.T) { @@ -29,7 +29,7 @@ func TestGetImagesIntegration(t *testing.T) { _ = rethinkContainer.Terminate(context.Background()) }() - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() ds := datastore.New(log, c.IP+":"+c.Port, c.DB, c.User, c.Password) ds.VRFPoolRangeMax = 1000 diff --git a/cmd/metal-api/internal/service/image-service_test.go b/cmd/metal-api/internal/service/image-service_test.go index 48093927a..032c1bfdb 100644 --- a/cmd/metal-api/internal/service/image-service_test.go +++ b/cmd/metal-api/internal/service/image-service_test.go @@ -3,6 +3,7 @@ package service import ( "bytes" "encoding/json" + "log/slog" "net/http" "net/http/httptest" "strings" @@ -11,7 +12,6 @@ import ( "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" "github.com/metal-stack/metal-api/cmd/metal-api/internal/testdata" - "go.uber.org/zap/zaptest" restful "github.com/emicklei/go-restful/v3" "github.com/metal-stack/metal-lib/httperrors" @@ -22,7 +22,7 @@ func TestGetImages(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - imageservice := NewImage(zaptest.NewLogger(t).Sugar(), ds) + imageservice := NewImage(slog.Default(), ds) container := restful.NewContainer().Add(imageservice) req := httptest.NewRequest("GET", "/v1/image", nil) w := httptest.NewRecorder() @@ -48,7 +48,7 @@ func TestGetImage(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - imageservice := NewImage(zaptest.NewLogger(t).Sugar(), ds) + imageservice := NewImage(slog.Default(), ds) container := restful.NewContainer().Add(imageservice) req := httptest.NewRequest("GET", "/v1/image/image-1", nil) w := httptest.NewRecorder() @@ -69,7 +69,7 @@ func TestGetImageNotFound(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - imageservice := NewImage(zaptest.NewLogger(t).Sugar(), ds) + imageservice := NewImage(slog.Default(), ds) container := restful.NewContainer().Add(imageservice) req := httptest.NewRequest("GET", "/v1/image/image-999", nil) w := httptest.NewRecorder() @@ -89,7 +89,7 @@ func TestGetImageNotFound(t *testing.T) { func TestDeleteImage(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() imageservice := NewImage(log, ds) container := restful.NewContainer().Add(imageservice) @@ -112,7 +112,7 @@ func TestDeleteImage(t *testing.T) { func TestCreateImage(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() createRequest := v1.ImageCreateRequest{ Common: v1.Common{ @@ -153,7 +153,7 @@ func TestCreateImage(t *testing.T) { func TestCreateImageWithBrokenURL(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() createRequest := v1.ImageCreateRequest{ Common: v1.Common{ @@ -210,7 +210,7 @@ func TestCreateImageWithClassification(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) vc := string(testdata.Img1.Classification) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() createRequest := v1.ImageCreateRequest{ Common: v1.Common{ @@ -252,7 +252,7 @@ func TestCreateImageWithClassification(t *testing.T) { func TestUpdateImage(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() imageservice := NewImage(log, ds) container := restful.NewContainer().Add(imageservice) diff --git a/cmd/metal-api/internal/service/integration_test.go b/cmd/metal-api/internal/service/integration_test.go index b7478d047..63034d9cb 100644 --- a/cmd/metal-api/internal/service/integration_test.go +++ b/cmd/metal-api/internal/service/integration_test.go @@ -6,6 +6,7 @@ package service import ( "context" "fmt" + "log/slog" "net" "net/http" "net/http/httptest" @@ -17,7 +18,6 @@ import ( "google.golang.org/grpc/keepalive" "github.com/testcontainers/testcontainers-go" - "go.uber.org/zap/zaptest" metalgrpc "github.com/metal-stack/metal-api/cmd/metal-api/internal/grpc" "github.com/metal-stack/metal-api/test" @@ -66,7 +66,8 @@ func createTestEnvironment(t *testing.T) testEnv { rethinkContainer, c, err := test.StartRethink(t) require.NoError(t, err) - ds := datastore.New(zaptest.NewLogger(t).Sugar(), c.IP+":"+c.Port, c.DB, c.User, c.Password) + log := slog.Default() + ds := datastore.New(log, c.IP+":"+c.Port, c.DB, c.User, c.Password) ds.VRFPoolRangeMax = 1000 ds.ASNPoolRangeMax = 1000 @@ -84,9 +85,7 @@ func createTestEnvironment(t *testing.T) testEnv { psc.On("Find", testifymock.Anything, &mdmv1.ProjectFindRequest{}).Return(&mdmv1.ProjectListResponse{Projects: []*mdmv1.Project{ {Meta: &mdmv1.Meta{Id: "test-project-1"}}, }}, nil) - mdc := mdm.NewMock(psc, nil) - - log := zaptest.NewLogger(t).Sugar() + mdc := mdm.NewMock(psc, nil, nil) go func() { err := metalgrpc.Run(&metalgrpc.ServerConfig{ diff --git a/cmd/metal-api/internal/service/ip-service.go b/cmd/metal-api/internal/service/ip-service.go index a3484c1a0..1fabd0966 100644 --- a/cmd/metal-api/internal/service/ip-service.go +++ b/cmd/metal-api/internal/service/ip-service.go @@ -3,6 +3,7 @@ package service import ( "errors" "fmt" + "log/slog" "net/http" "net/netip" @@ -17,7 +18,6 @@ import ( "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" "github.com/metal-stack/metal-api/cmd/metal-api/internal/tags" "github.com/metal-stack/metal-lib/auditing" - "go.uber.org/zap" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" @@ -36,7 +36,7 @@ type ipResource struct { } // NewIP returns a webservice for ip specific endpoints. -func NewIP(log *zap.SugaredLogger, ds *datastore.RethinkStore, ep *bus.Endpoints, ipamer ipam.IPAMer, mdc mdm.Client) (*restful.WebService, error) { +func NewIP(log *slog.Logger, ds *datastore.RethinkStore, ep *bus.Endpoints, ipamer ipam.IPAMer, mdc mdm.Client) (*restful.WebService, error) { ir := ipResource{ webResource: webResource{ log: log, @@ -329,7 +329,7 @@ func (r *ipResource) allocateIP(request *restful.Request, response *restful.Resp } } - r.logger(request).Debugw("allocated ip in ipam", "ip", ipAddress, "network", nw.ID) + r.logger(request).Debug("allocated ip in ipam", "ip", ipAddress, "network", nw.ID) ipType := metal.Ephemeral if requestPayload.Type == metal.Static { diff --git a/cmd/metal-api/internal/service/ip-service_test.go b/cmd/metal-api/internal/service/ip-service_test.go index cdef43305..9b0b9c7c4 100644 --- a/cmd/metal-api/internal/service/ip-service_test.go +++ b/cmd/metal-api/internal/service/ip-service_test.go @@ -4,13 +4,13 @@ import ( "bytes" "encoding/json" "errors" + "log/slog" "net/http" "net/http/httptest" "testing" "github.com/metal-stack/metal-lib/bus" "github.com/metal-stack/metal-lib/pkg/tag" - "go.uber.org/zap/zaptest" mdmv1 "github.com/metal-stack/masterdata-api/api/v1" mdmock "github.com/metal-stack/masterdata-api/api/v1/mocks" @@ -36,7 +36,7 @@ func TestGetIPs(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - logger := zaptest.NewLogger(t).Sugar() + logger := slog.Default() ipservice, err := NewIP(logger, ds, bus.DirectEndpoints(), ipam.New(goipam.New()), nil) require.NoError(t, err) @@ -66,7 +66,7 @@ func TestGetIP(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - logger := zaptest.NewLogger(t).Sugar() + logger := slog.Default() ipservice, err := NewIP(logger, ds, bus.DirectEndpoints(), ipam.New(goipam.New()), nil) require.NoError(t, err) container := restful.NewContainer().Add(ipservice) @@ -89,7 +89,7 @@ func TestGetIP(t *testing.T) { func TestGetIPNotFound(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - logger := zaptest.NewLogger(t).Sugar() + logger := slog.Default() ipservice, err := NewIP(logger, ds, bus.DirectEndpoints(), ipam.New(goipam.New()), nil) require.NoError(t, err) @@ -115,7 +115,7 @@ func TestDeleteIP(t *testing.T) { ipamer, err := testdata.InitMockIpamData(mock, true) require.NoError(t, err) testdata.InitMockDBData(mock) - logger := zaptest.NewLogger(t).Sugar() + logger := slog.Default() ipservice, err := NewIP(logger, ds, bus.DirectEndpoints(), ipamer, nil) require.NoError(t, err) @@ -171,7 +171,7 @@ func TestAllocateIP(t *testing.T) { ipamer, err := testdata.InitMockIpamData(mock, false) require.NoError(t, err) testdata.InitMockDBData(mock) - logger := zaptest.NewLogger(t).Sugar() + logger := slog.Default() psc := mdmock.ProjectServiceClient{} psc.On("Get", testifymock.Anything, &mdmv1.ProjectGetRequest{Id: "123"}).Return(&mdmv1.ProjectResponse{ @@ -182,7 +182,7 @@ func TestAllocateIP(t *testing.T) { ) tsc := mdmock.TenantServiceClient{} - mdc := mdm.NewMock(&psc, &tsc) + mdc := mdm.NewMock(&psc, &tsc, nil) ipservice, err := NewIP(logger, ds, bus.DirectEndpoints(), ipamer, mdc) require.NoError(t, err) @@ -291,7 +291,7 @@ func TestAllocateIP(t *testing.T) { func TestUpdateIP(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - logger := zaptest.NewLogger(t).Sugar() + logger := slog.Default() ipservice, err := NewIP(logger, ds, bus.DirectEndpoints(), ipam.New(goipam.New()), nil) require.NoError(t, err) diff --git a/cmd/metal-api/internal/service/machine-service.go b/cmd/metal-api/internal/service/machine-service.go index dce081ea5..52357a920 100644 --- a/cmd/metal-api/internal/service/machine-service.go +++ b/cmd/metal-api/internal/service/machine-service.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "net" "net/http" "strconv" @@ -23,8 +24,6 @@ import ( "golang.org/x/crypto/ssh" - "go.uber.org/zap" - "github.com/metal-stack/metal-lib/httperrors" "github.com/metal-stack/metal-lib/pkg/tag" @@ -109,7 +108,7 @@ type Allocator func(Allocation) error // NewMachine returns a webservice for machine specific endpoints. func NewMachine( - log *zap.SugaredLogger, + log *slog.Logger, ds *datastore.RethinkStore, pub bus.Publisher, ep *bus.Endpoints, @@ -664,7 +663,7 @@ func (r *machineResource) getMachineConsolePassword(request *restful.Request, re ConsolePassword: m.Allocation.ConsolePassword, } - r.log.Infow("consolepassword requested", "machine", m.ID, "user", user.Name, "email", user.EMail, "tenant", user.Tenant, "reason", requestPayload.Reason) + r.log.Info("consolepassword requested", "machine", m.ID, "user", user.Name, "email", user.EMail, "tenant", user.Tenant, "reason", requestPayload.Reason) r.send(request, response, http.StatusOK, resp) } @@ -863,11 +862,11 @@ func (r *machineResource) ipmiReport(request *restful.Request, response *restful Value: ledstate, } } else { - logger.Errorw("unable to decode ledstate", "id", uuid, "ledstate", report.IndicatorLEDState, "error", err) + logger.Error("unable to decode ledstate", "id", uuid, "ledstate", report.IndicatorLEDState, "error", err) } err = r.ds.CreateMachine(m) if err != nil { - logger.Errorw("could not create machine", "id", uuid, "ipmi-ip", report.BMCIp, "m", m, "err", err) + logger.Error("could not create machine", "id", uuid, "ipmi-ip", report.BMCIp, "m", m, "err", err) continue } resp.Created = append(resp.Created, uuid) @@ -893,7 +892,7 @@ func (r *machineResource) ipmiReport(request *restful.Request, response *restful } else if len(hostAndPort) < 2 { newMachine.IPMI.Address = report.BMCIp + ":" + defaultIPMIPort } else { - logger.Errorw("not updating ipmi, address is garbage", "id", uuid, "ip", report.BMCIp, "machine", newMachine, "address", newMachine.IPMI.Address) + logger.Error("not updating ipmi, address is garbage", "id", uuid, "ip", report.BMCIp, "machine", newMachine, "address", newMachine.IPMI.Address) continue } @@ -903,7 +902,7 @@ func (r *machineResource) ipmiReport(request *restful.Request, response *restful } if newMachine.PartitionID != p.ID { - logger.Errorw("could not update machine because overlapping id found", "id", uuid, "machine", newMachine, "partition", requestPayload.PartitionID) + logger.Error("could not update machine because overlapping id found", "id", uuid, "machine", newMachine, "partition", requestPayload.PartitionID) continue } @@ -935,13 +934,13 @@ func (r *machineResource) ipmiReport(request *restful.Request, response *restful Description: newMachine.LEDState.Description, } } else { - logger.Errorw("unable to decode ledstate", "id", uuid, "ledstate", report.IndicatorLEDState, "error", err) + logger.Error("unable to decode ledstate", "id", uuid, "ledstate", report.IndicatorLEDState, "error", err) } newMachine.IPMI.LastUpdated = time.Now() err = r.ds.UpdateMachine(&oldMachine, &newMachine) if err != nil { - logger.Errorw("could not update machine", "id", uuid, "ip", report.BMCIp, "machine", newMachine, "err", err) + logger.Error("could not update machine", "id", uuid, "ip", report.BMCIp, "machine", newMachine, "err", err) continue } resp.Updated = append(resp.Updated, uuid) @@ -1158,7 +1157,7 @@ func createMachineAllocationSpec(ds *datastore.RethinkStore, machineRequest v1.M }, nil } -func allocateMachine(logger *zap.SugaredLogger, ds *datastore.RethinkStore, ipamer ipam.IPAMer, allocationSpec *machineAllocationSpec, mdc mdm.Client, actor *asyncActor, publisher bus.Publisher) (*metal.Machine, error) { +func allocateMachine(logger *slog.Logger, ds *datastore.RethinkStore, ipamer ipam.IPAMer, allocationSpec *machineAllocationSpec, mdc mdm.Client, actor *asyncActor, publisher bus.Publisher) (*metal.Machine, error) { err := validateAllocationSpec(allocationSpec) if err != nil { return nil, err @@ -1262,7 +1261,7 @@ func allocateMachine(logger *zap.SugaredLogger, ds *datastore.RethinkStore, ipam } rollbackError := actor.machineNetworkReleaser(cleanupMachine) if rollbackError != nil { - logger.Errorw("cannot call async machine cleanup", "error", rollbackError) + logger.Error("cannot call async machine cleanup", "error", rollbackError) } old := *machineCandidate machineCandidate.Allocation = nil @@ -1271,7 +1270,7 @@ func allocateMachine(logger *zap.SugaredLogger, ds *datastore.RethinkStore, ipam rollbackError = ds.UpdateMachine(&old, machineCandidate) if rollbackError != nil { - logger.Errorw("cannot update machinecandidate to reset allocation", "error", rollbackError) + logger.Error("cannot update machinecandidate to reset allocation", "error", rollbackError) } } return err @@ -1314,9 +1313,9 @@ func allocateMachine(logger *zap.SugaredLogger, ds *datastore.RethinkStore, ipam // TODO: can be removed after metal-core refactoring err = publisher.Publish(metal.TopicAllocation.Name, &metal.AllocationEvent{MachineID: machine.ID}) if err != nil { - logger.Errorw("failed to publish machine allocation event, fallback should trigger on metal-hammer", "topic", metal.TopicAllocation.Name, "machineID", machine.ID, "error", err) + logger.Error("failed to publish machine allocation event, fallback should trigger on metal-hammer", "topic", metal.TopicAllocation.Name, "machineID", machine.ID, "error", err) } else { - logger.Debugw("published machine allocation event", "topic", metal.TopicAllocation.Name, "machineID", machine.ID) + logger.Debug("published machine allocation event", "topic", metal.TopicAllocation.Name, "machineID", machine.ID) } return machine, nil @@ -1758,7 +1757,7 @@ func (r machineResource) freeMachine(request *restful.Request, response *restful err = publishMachineCmd(logger, m, r.Publisher, metal.ChassisIdentifyLEDOffCmd) if err != nil { - logger.Error("unable to publish machine command", zap.String("command", string(metal.ChassisIdentifyLEDOffCmd)), zap.String("machineID", m.ID), zap.Error(err)) + logger.Error("unable to publish machine command", "command", string(metal.ChassisIdentifyLEDOffCmd), "machineID", m.ID, "error", err) } err = r.actor.freeMachine(request.Request.Context(), r.Publisher, m, r.headscaleClient, logger) @@ -1782,7 +1781,7 @@ func (r machineResource) freeMachine(request *restful.Request, response *restful } _, err = r.ds.ProvisioningEventForMachine(logger, &ev, id) if err != nil { - r.log.Errorw("error sending provisioning event after machine free", "error", err) + r.log.Error("error sending provisioning event after machine free", "error", err) } } @@ -1915,15 +1914,15 @@ func (r *machineResource) reinstallMachine(request *restful.Request, response *r return } - logger.Info("marked machine to get reinstalled", zap.String("machineID", m.ID)) + logger.Info("marked machine to get reinstalled", "machineID", m.ID) - err = deleteVRFSwitches(r.ds, m, logger.Desugar()) + err = deleteVRFSwitches(r.ds, m, logger) if err != nil { r.sendError(request, response, defaultError(err)) return } - err = publishDeleteEvent(r.Publisher, m, logger.Desugar()) + err = publishDeleteEvent(r.Publisher, m, logger) if err != nil { r.sendError(request, response, defaultError(err)) return @@ -1931,7 +1930,7 @@ func (r *machineResource) reinstallMachine(request *restful.Request, response *r err = publishMachineCmd(logger, m, r.Publisher, metal.MachineReinstallCmd) if err != nil { - logger.Error("unable to publish machine command", zap.String("command", string(metal.MachineReinstallCmd)), zap.String("machineID", m.ID), zap.Error(err)) + logger.Error("unable to publish machine command", "command", string(metal.MachineReinstallCmd), "machineID", m.ID, "error", err) } r.send(request, response, http.StatusOK, resp) @@ -1943,8 +1942,8 @@ func (r *machineResource) reinstallMachine(request *restful.Request, response *r r.sendError(request, response, httperrors.BadRequest(errors.New("machine either locked, not allocated yet or invalid image ID specified"))) } -func deleteVRFSwitches(ds *datastore.RethinkStore, m *metal.Machine, logger *zap.Logger) error { - logger.Info("set VRF at switch", zap.String("machineID", m.ID)) +func deleteVRFSwitches(ds *datastore.RethinkStore, m *metal.Machine, logger *slog.Logger) error { + logger.Info("set VRF at switch", "machineID", m.ID) err := retry.Do( func() error { _, err := ds.SetVrfAtSwitches(m, "") @@ -1958,25 +1957,25 @@ func deleteVRFSwitches(ds *datastore.RethinkStore, m *metal.Machine, logger *zap retry.LastErrorOnly(true), ) if err != nil { - logger.Error("cannot delete vrf switches", zap.String("machineID", m.ID), zap.Error(err)) + logger.Error("cannot delete vrf switches", "machineID", m.ID, "error", err) return fmt.Errorf("cannot delete vrf switches: %w", err) } return nil } -func publishDeleteEvent(publisher bus.Publisher, m *metal.Machine, logger *zap.Logger) error { - logger.Info("publish machine delete event", zap.String("machineID", m.ID)) +func publishDeleteEvent(publisher bus.Publisher, m *metal.Machine, logger *slog.Logger) error { + logger.Info("publish machine delete event", "machineID", m.ID) deleteEvent := metal.MachineEvent{Type: metal.DELETE, OldMachineID: m.ID, Cmd: &metal.MachineExecCommand{TargetMachineID: m.ID, IPMI: &m.IPMI}} err := publisher.Publish(metal.TopicMachine.GetFQN(m.PartitionID), deleteEvent) if err != nil { - logger.Error("cannot publish delete event", zap.String("machineID", m.ID), zap.Error(err)) + logger.Error("cannot publish delete event", "machineID", m.ID, "error", err) return fmt.Errorf("cannot publish delete event: %w", err) } return nil } // MachineLiveliness evaluates whether machines are still alive or if they have died -func MachineLiveliness(ds *datastore.RethinkStore, logger *zap.SugaredLogger) error { +func MachineLiveliness(ds *datastore.RethinkStore, logger *slog.Logger) error { logger.Info("machine liveliness was requested") machines, err := ds.ListMachines() @@ -1991,7 +1990,7 @@ func MachineLiveliness(ds *datastore.RethinkStore, logger *zap.SugaredLogger) er for _, m := range machines { lvlness, err := evaluateMachineLiveliness(ds, m) if err != nil { - logger.Errorw("cannot update liveliness", "error", err, "machine", m) + logger.Error("cannot update liveliness", "error", err, "machine", m) errs++ // fall through, so the rest of the machines is getting evaluated } @@ -2005,7 +2004,7 @@ func MachineLiveliness(ds *datastore.RethinkStore, logger *zap.SugaredLogger) er } } - logger.Infow("machine liveliness evaluated", "alive", alive, "dead", dead, "unknown", unknown, "errors", errs) + logger.Info("machine liveliness evaluated", "alive", alive, "dead", dead, "unknown", unknown, "errors", errs) return nil } @@ -2042,7 +2041,7 @@ func evaluateMachineLiveliness(ds *datastore.RethinkStore, m metal.Machine) (met } // ResurrectMachines attempts to resurrect machines that are obviously dead -func ResurrectMachines(ctx context.Context, ds *datastore.RethinkStore, publisher bus.Publisher, ep *bus.Endpoints, ipamer ipam.IPAMer, headscaleClient *headscale.HeadscaleClient, logger *zap.SugaredLogger) error { +func ResurrectMachines(ctx context.Context, ds *datastore.RethinkStore, publisher bus.Publisher, ep *bus.Endpoints, ipamer ipam.IPAMer, headscaleClient *headscale.HeadscaleClient, logger *slog.Logger) error { logger.Info("machine resurrection was requested") machines, err := ds.ListMachines() @@ -2064,7 +2063,7 @@ func ResurrectMachines(ctx context.Context, ds *datastore.RethinkStore, publishe provisioningEvents, err := ds.FindProvisioningEventContainer(m.ID) if err != nil { // we have no provisioning events... we cannot tell - logger.Debugw("no provisioningEvents found for resurrection", "machineID", m.ID, "error", err) + logger.Debug("no provisioningEvents found for resurrection", "machineID", m.ID, "error", err) continue } @@ -2073,19 +2072,19 @@ func ResurrectMachines(ctx context.Context, ds *datastore.RethinkStore, publishe } if provisioningEvents.Liveliness == metal.MachineLivelinessDead && time.Since(*provisioningEvents.LastEventTime) > metal.MachineResurrectAfter { - logger.Infow("resurrecting dead machine", "machineID", m.ID, "liveliness", provisioningEvents.Liveliness, "since", time.Since(*provisioningEvents.LastEventTime).String()) + logger.Info("resurrecting dead machine", "machineID", m.ID, "liveliness", provisioningEvents.Liveliness, "since", time.Since(*provisioningEvents.LastEventTime).String()) err = act.freeMachine(ctx, publisher, &m, headscaleClient, logger) if err != nil { - logger.Errorw("error during machine resurrection", "machineID", m.ID, "error", err) + logger.Error("error during machine resurrection", "machineID", m.ID, "error", err) } continue } if provisioningEvents.FailedMachineReclaim { - logger.Infow("resurrecting machine with failed reclaim", "machineID", m.ID, "liveliness", provisioningEvents.Liveliness, "since", time.Since(*provisioningEvents.LastEventTime).String()) + logger.Info("resurrecting machine with failed reclaim", "machineID", m.ID, "liveliness", provisioningEvents.Liveliness, "since", time.Since(*provisioningEvents.LastEventTime).String()) err = act.freeMachine(ctx, publisher, &m, headscaleClient, logger) if err != nil { - logger.Errorw("error during machine resurrection", "machineID", m.ID, "error", err) + logger.Error("error during machine resurrection", "machineID", m.ID, "error", err) } continue } @@ -2206,7 +2205,7 @@ func (r *machineResource) updateFirmware(request *restful.Request, response *res }, } - r.logger(request).Infow("publish event", "event", evt, "command", *evt.Cmd) + r.logger(request).Info("publish event", "event", evt, "command", *evt.Cmd) err = r.Publish(metal.TopicMachine.GetFQN(m.PartitionID), evt) if err != nil { r.sendError(request, response, httperrors.InternalServerError(err)) @@ -2294,7 +2293,7 @@ func (r *machineResource) machineCmd(cmd metal.MachineCommand, request *restful. r.send(request, response, http.StatusOK, resp) } -func publishMachineCmd(logger *zap.SugaredLogger, m *metal.Machine, publisher bus.Publisher, cmd metal.MachineCommand) error { +func publishMachineCmd(logger *slog.Logger, m *metal.Machine, publisher bus.Publisher, cmd metal.MachineCommand) error { evt := metal.MachineEvent{ Type: metal.COMMAND, Cmd: &metal.MachineExecCommand{ @@ -2304,7 +2303,7 @@ func publishMachineCmd(logger *zap.SugaredLogger, m *metal.Machine, publisher bu }, } - logger.Infow("publish event", "event", evt, "command", *evt.Cmd) + logger.Info("publish event", "event", evt, "command", *evt.Cmd) err := publisher.Publish(metal.TopicMachine.GetFQN(m.PartitionID), evt) if err != nil { return err diff --git a/cmd/metal-api/internal/service/machine-service_allocation_test.go b/cmd/metal-api/internal/service/machine-service_allocation_test.go index 94d9dff0d..ab1bdd7d4 100644 --- a/cmd/metal-api/internal/service/machine-service_allocation_test.go +++ b/cmd/metal-api/internal/service/machine-service_allocation_test.go @@ -8,6 +8,7 @@ import ( "context" "encoding/json" "fmt" + "log/slog" "net/http" "net/http/httptest" "sync" @@ -23,7 +24,6 @@ import ( "github.com/emicklei/go-restful/v3" testifymock "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" "golang.org/x/sync/errgroup" goipam "github.com/metal-stack/go-ipam" @@ -288,7 +288,7 @@ func createMachineRegisterRequest(i int) *grpcv1.BootServiceRegisterRequest { } func setupTestEnvironment(machineCount int, t *testing.T) (*datastore.RethinkStore, *restful.Container) { - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() _, c, err := test.StartRethink(t) require.NoError(t, err) @@ -304,7 +304,7 @@ func setupTestEnvironment(machineCount int, t *testing.T) (*datastore.RethinkSto psc := &mdmv1mock.ProjectServiceClient{} psc.On("Get", testifymock.Anything, &mdmv1.ProjectGetRequest{Id: "pr1"}).Return(&mdmv1.ProjectResponse{Project: &mdmv1.Project{}}, nil) - mdc := mdm.NewMock(psc, nil) + mdc := mdm.NewMock(psc, nil, nil) _, pg, err := test.StartPostgres() require.NoError(t, err) @@ -335,7 +335,7 @@ func setupTestEnvironment(machineCount int, t *testing.T) (*datastore.RethinkSto ms, err := NewMachine(log, rs, &emptyPublisher{}, bus.DirectEndpoints(), ipam.New(ipamer), mdc, nil, usergetter, 0, nil, metal.DisabledIPMISuperUser()) require.NoError(t, err) container := restful.NewContainer().Add(ms) - container.Filter(rest.UserAuth(usergetter, zaptest.NewLogger(t).Sugar())) + container.Filter(rest.UserAuth(usergetter, slog.Default())) return rs, container } diff --git a/cmd/metal-api/internal/service/machine-service_integration_test.go b/cmd/metal-api/internal/service/machine-service_integration_test.go index 03f4ad3c7..d07ca02ce 100644 --- a/cmd/metal-api/internal/service/machine-service_integration_test.go +++ b/cmd/metal-api/internal/service/machine-service_integration_test.go @@ -6,6 +6,7 @@ package service import ( "context" "fmt" + "log/slog" "net" "net/http" "strconv" @@ -19,7 +20,6 @@ import ( grpcv1 "github.com/metal-stack/metal-api/pkg/api/v1" "github.com/metal-stack/metal-api/test" "github.com/metal-stack/metal-lib/bus" - "go.uber.org/zap/zaptest" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -213,7 +213,7 @@ func BenchmarkMachineList(b *testing.B) { }() now := time.Now() - log := zaptest.NewLogger(b).Sugar() + log := slog.Default() ds := datastore.New(log, c.IP+":"+c.Port, c.DB, c.User, c.Password) ds.VRFPoolRangeMax = 1000 diff --git a/cmd/metal-api/internal/service/machine-service_test.go b/cmd/metal-api/internal/service/machine-service_test.go index 1f3b944e3..1f13b4910 100644 --- a/cmd/metal-api/internal/service/machine-service_test.go +++ b/cmd/metal-api/internal/service/machine-service_test.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "fmt" + "log/slog" "net/http" "net/http/httptest" "testing" @@ -18,7 +19,6 @@ import ( "github.com/metal-stack/metal-lib/bus" "github.com/metal-stack/security" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" "golang.org/x/crypto/ssh" r "gopkg.in/rethinkdb/rethinkdb-go.v6" ) @@ -55,7 +55,7 @@ func (m mockUserGetter) User(rq *http.Request) (*security.User, error) { func TestGetMachines(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() machineservice, err := NewMachine(log, ds, &emptyPublisher{}, bus.DirectEndpoints(), ipam.New(goipam.New()), nil, nil, nil, 0, nil, metal.DisabledIPMISuperUser()) require.NoError(t, err) @@ -83,7 +83,7 @@ func TestGetMachines(t *testing.T) { func TestMachineIPMIReport(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() tests := []struct { name string @@ -145,7 +145,7 @@ func TestMachineIPMIReport(t *testing.T) { } func TestMachineFindIPMI(t *testing.T) { - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() tests := []struct { name string @@ -220,7 +220,7 @@ func TestMachineFindIPMI(t *testing.T) { func TestSetMachineState(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() userGetter := mockUserGetter{&security.User{ EMail: "anonymous@metal-stack.io", @@ -261,7 +261,7 @@ func TestSetMachineState(t *testing.T) { func TestSetMachineStateIssuerResetWhenAvailable(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() userGetter := mockUserGetter{&security.User{ EMail: "anonymous@metal-stack.io", @@ -302,7 +302,7 @@ func TestSetMachineStateIssuerResetWhenAvailable(t *testing.T) { func TestGetMachine(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() machineservice, err := NewMachine(log, ds, &emptyPublisher{}, bus.DirectEndpoints(), ipam.New(goipam.New()), nil, nil, nil, 0, nil, metal.DisabledIPMISuperUser()) require.NoError(t, err) @@ -330,7 +330,7 @@ func TestGetMachine(t *testing.T) { func TestGetMachineNotFound(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() machineservice, err := NewMachine(log, ds, &emptyPublisher{}, bus.DirectEndpoints(), ipam.New(goipam.New()), nil, nil, nil, 0, nil, metal.DisabledIPMISuperUser()) require.NoError(t, err) @@ -353,7 +353,7 @@ func TestFreeMachine(t *testing.T) { testdata.InitMockDBData(mock) mock.On(r.DB("mockdb").Table("switch").Filter(r.MockAnything(), r.FilterOpts{})).Return([]metal.Switch{testdata.Switch1}, nil) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() pub := &emptyPublisher{} events := []string{"1-machine", "1-machine", "releaseMachineNetworks", "1-switch"} @@ -393,7 +393,7 @@ func TestSearchMachine(t *testing.T) { ds, mock := datastore.InitMockDB(t) mock.On(r.DB("mockdb").Table("machine").Filter(r.MockAnything())).Return([]interface{}{testdata.M1}, nil) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() machineservice, err := NewMachine(log, ds, &emptyPublisher{}, bus.DirectEndpoints(), ipam.New(goipam.New()), nil, nil, nil, 0, nil, metal.DisabledIPMISuperUser()) require.NoError(t, err) @@ -423,7 +423,7 @@ func TestSearchMachine(t *testing.T) { } func TestOnMachine(t *testing.T) { - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() tests := []struct { cmd metal.MachineCommand diff --git a/cmd/metal-api/internal/service/network-service.go b/cmd/metal-api/internal/service/network-service.go index 1183927ec..8f0019393 100644 --- a/cmd/metal-api/internal/service/network-service.go +++ b/cmd/metal-api/internal/service/network-service.go @@ -3,10 +3,9 @@ package service import ( "errors" "fmt" + "log/slog" "net/http" - "go.uber.org/zap" - mdmv1 "github.com/metal-stack/masterdata-api/api/v1" mdm "github.com/metal-stack/masterdata-api/pkg/client" @@ -28,7 +27,7 @@ type networkResource struct { } // NewNetwork returns a webservice for network specific endpoints. -func NewNetwork(log *zap.SugaredLogger, ds *datastore.RethinkStore, ipamer ipam.IPAMer, mdc mdm.Client) *restful.WebService { +func NewNetwork(log *slog.Logger, ds *datastore.RethinkStore, ipamer ipam.IPAMer, mdc mdm.Client) *restful.WebService { r := networkResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/network-service_test.go b/cmd/metal-api/internal/service/network-service_test.go index 57b19ea41..184d633a8 100644 --- a/cmd/metal-api/internal/service/network-service_test.go +++ b/cmd/metal-api/internal/service/network-service_test.go @@ -4,12 +4,12 @@ import ( "bytes" "encoding/json" "fmt" + "log/slog" "net/http" "net/http/httptest" "testing" "github.com/metal-stack/metal-lib/httperrors" - "go.uber.org/zap/zaptest" r "gopkg.in/rethinkdb/rethinkdb-go.v6" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" @@ -27,7 +27,7 @@ import ( func TestGetNetworks(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() networkservice := NewNetwork(log, ds, ipam.New(goipam.New()), nil) container := restful.NewContainer().Add(networkservice) @@ -55,7 +55,7 @@ func TestGetNetworks(t *testing.T) { func TestGetNetwork(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() networkservice := NewNetwork(log, ds, ipam.New(goipam.New()), nil) container := restful.NewContainer().Add(networkservice) @@ -78,7 +78,7 @@ func TestGetNetwork(t *testing.T) { func TestGetNetworkNotFound(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() networkservice := NewNetwork(log, ds, ipam.New(goipam.New()), nil) container := restful.NewContainer().Add(networkservice) @@ -104,7 +104,7 @@ func TestDeleteNetwork(t *testing.T) { ipamer, err := testdata.InitMockIpamData(mock, false) require.NoError(t, err) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() networkservice := NewNetwork(log, ds, ipamer, nil) container := restful.NewContainer().Add(networkservice) @@ -130,7 +130,7 @@ func TestDeleteNetworkIPInUse(t *testing.T) { ipamer, err := testdata.InitMockIpamData(mock, true) require.NoError(t, err) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() networkservice := NewNetwork(log, ds, ipamer, nil) container := restful.NewContainer().Add(networkservice) @@ -155,7 +155,7 @@ func TestCreateNetwork(t *testing.T) { ipamer, err := testdata.InitMockIpamData(mock, false) require.NoError(t, err) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() networkservice := NewNetwork(log, ds, ipamer, nil) container := restful.NewContainer().Add(networkservice) @@ -193,7 +193,7 @@ func TestCreateNetwork(t *testing.T) { func TestUpdateNetwork(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() networkservice := NewNetwork(log, ds, ipam.New(goipam.New()), nil) container := restful.NewContainer().Add(networkservice) @@ -229,7 +229,7 @@ func TestSearchNetwork(t *testing.T) { ds, mock := datastore.InitMockDB(t) mock.On(r.DB("mockdb").Table("network").Filter(r.MockAnything())).Return([]interface{}{testdata.Nw1}, nil) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() networkService := NewNetwork(log, ds, ipam.New(goipam.New()), nil) container := restful.NewContainer().Add(networkService) diff --git a/cmd/metal-api/internal/service/partition-service.go b/cmd/metal-api/internal/service/partition-service.go index c3aeb4289..7d11615d7 100644 --- a/cmd/metal-api/internal/service/partition-service.go +++ b/cmd/metal-api/internal/service/partition-service.go @@ -3,6 +3,7 @@ package service import ( "errors" "fmt" + "log/slog" "net/http" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" @@ -10,7 +11,6 @@ import ( "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" "github.com/metal-stack/metal-lib/auditing" "github.com/metal-stack/metal-lib/pkg/pointer" - "go.uber.org/zap" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" @@ -30,7 +30,7 @@ type partitionResource struct { } // NewPartition returns a webservice for partition specific endpoints. -func NewPartition(log *zap.SugaredLogger, ds *datastore.RethinkStore, tc TopicCreator) *restful.WebService { +func NewPartition(log *slog.Logger, ds *datastore.RethinkStore, tc TopicCreator) *restful.WebService { r := partitionResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/partition-service_test.go b/cmd/metal-api/internal/service/partition-service_test.go index 30c722c59..0d3a11f31 100644 --- a/cmd/metal-api/internal/service/partition-service_test.go +++ b/cmd/metal-api/internal/service/partition-service_test.go @@ -4,12 +4,12 @@ import ( "bytes" "encoding/json" "fmt" + "log/slog" "net/http" "net/http/httptest" "testing" "github.com/stretchr/testify/assert" - "go.uber.org/zap/zaptest" r "gopkg.in/rethinkdb/rethinkdb-go.v6" restful "github.com/emicklei/go-restful/v3" @@ -44,7 +44,7 @@ func TestGetPartitions(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - service := NewPartition(zaptest.NewLogger(t).Sugar(), ds, &nopTopicCreater{}) + service := NewPartition(slog.Default(), ds, &nopTopicCreater{}) container := restful.NewContainer().Add(service) req := httptest.NewRequest("GET", "/v1/partition", nil) w := httptest.NewRecorder() @@ -73,7 +73,7 @@ func TestGetPartition(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - service := NewPartition(zaptest.NewLogger(t).Sugar(), ds, &nopTopicCreater{}) + service := NewPartition(slog.Default(), ds, &nopTopicCreater{}) container := restful.NewContainer().Add(service) req := httptest.NewRequest("GET", "/v1/partition/1", nil) w := httptest.NewRecorder() @@ -94,7 +94,7 @@ func TestGetPartition(t *testing.T) { func TestGetPartitionNotFound(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() service := NewPartition(log, ds, &nopTopicCreater{}) container := restful.NewContainer().Add(service) @@ -116,7 +116,7 @@ func TestGetPartitionNotFound(t *testing.T) { func TestDeletePartition(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() service := NewPartition(log, ds, &nopTopicCreater{}) container := restful.NewContainer().Add(service) @@ -140,7 +140,7 @@ func TestDeletePartition(t *testing.T) { func TestCreatePartition(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() topicCreater := expectingTopicCreater{ t: t, @@ -195,7 +195,7 @@ func TestCreatePartition(t *testing.T) { func TestUpdatePartition(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() service := NewPartition(log, ds, &nopTopicCreater{}) container := restful.NewContainer().Add(service) @@ -257,7 +257,7 @@ func TestPartitionCapacity(t *testing.T) { mock.On(r.DB("mockdb").Table("event")).Return(ecs, nil) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() service := NewPartition(log, ds, &nopTopicCreater{}) container := restful.NewContainer().Add(service) diff --git a/cmd/metal-api/internal/service/project-service.go b/cmd/metal-api/internal/service/project-service.go index f3725e064..4b5ef450b 100644 --- a/cmd/metal-api/internal/service/project-service.go +++ b/cmd/metal-api/internal/service/project-service.go @@ -3,13 +3,13 @@ package service import ( "context" "errors" + "log/slog" "net/http" "github.com/metal-stack/masterdata-api/api/rest/mapper" v1 "github.com/metal-stack/masterdata-api/api/rest/v1" mdmv1 "github.com/metal-stack/masterdata-api/api/v1" mdm "github.com/metal-stack/masterdata-api/pkg/client" - "go.uber.org/zap" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" @@ -26,7 +26,7 @@ type projectResource struct { } // NewProject returns a webservice for project specific endpoints. -func NewProject(log *zap.SugaredLogger, ds *datastore.RethinkStore, mdc mdm.Client) *restful.WebService { +func NewProject(log *slog.Logger, ds *datastore.RethinkStore, mdc mdm.Client) *restful.WebService { r := projectResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/project-service_test.go b/cmd/metal-api/internal/service/project-service_test.go index 68b96344a..2469a75c9 100644 --- a/cmd/metal-api/internal/service/project-service_test.go +++ b/cmd/metal-api/internal/service/project-service_test.go @@ -3,6 +3,7 @@ package service import ( "errors" "fmt" + "log/slog" "testing" restful "github.com/emicklei/go-restful/v3" @@ -16,7 +17,6 @@ import ( "github.com/metal-stack/security" testifymock "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" r "gopkg.in/rethinkdb/rethinkdb-go.v6" ) @@ -45,12 +45,12 @@ func NewMockedProjectService(t *testing.T, projectServiceMock func(mock *mdmv1mo if projectServiceMock != nil { projectServiceMock(psc) } - mdc := mdm.NewMock(psc, &mdmv1mock.TenantServiceClient{}) + mdc := mdm.NewMock(psc, &mdmv1mock.TenantServiceClient{}, nil) ds, mock := datastore.InitMockDB(t) if dsmock != nil { dsmock(mock) } - ws := NewProject(zaptest.NewLogger(t).Sugar(), ds, mdc) + ws := NewProject(slog.Default(), ds, mdc) return &MockedProjectService{ t: t, ws: ws, diff --git a/cmd/metal-api/internal/service/service.go b/cmd/metal-api/internal/service/service.go index ad5f83b0c..401323eb7 100644 --- a/cmd/metal-api/internal/service/service.go +++ b/cmd/metal-api/internal/service/service.go @@ -2,6 +2,7 @@ package service import ( "fmt" + "log/slog" "strings" mdmv1 "github.com/metal-stack/masterdata-api/api/v1" @@ -14,7 +15,6 @@ import ( "github.com/emicklei/go-restful/v3" "github.com/metal-stack/security" - "go.uber.org/zap" ) const ( @@ -27,18 +27,18 @@ const ( var BasePath = "/" type webResource struct { - log *zap.SugaredLogger + log *slog.Logger ds *datastore.RethinkStore } // logger returns the request logger from the request. -func (w *webResource) logger(rq *restful.Request) *zap.SugaredLogger { +func (w *webResource) logger(rq *restful.Request) *slog.Logger { requestLogger := rest.GetLoggerFromContext(rq.Request, w.log) - return requestLogger.WithOptions(zap.AddCallerSkip(1)) + return requestLogger } func (w *webResource) sendError(rq *restful.Request, rsp *restful.Response, httperr *httperrors.HTTPErrorResponse) { - w.logger(rq).Errorw("service error", "status", httperr.StatusCode, "error", httperr.Message) + w.logger(rq).Error("service error", "status", httperr.StatusCode, "error", httperr.Message) w.send(rq, rsp, httperr.StatusCode, httperr) } @@ -69,10 +69,10 @@ func defaultError(err error) *httperrors.HTTPErrorResponse { return httperrors.UnprocessableEntity(err) } -func send(log *zap.SugaredLogger, rsp *restful.Response, status int, value any) { +func send(log *slog.Logger, rsp *restful.Response, status int, value any) { err := rsp.WriteHeaderAndEntity(status, value) if err != nil { - log.Errorw("failed to send response", "error", err) + log.Error("failed to send response", "error", err) } } @@ -149,14 +149,14 @@ func oneOf(rf restful.RouteFunction, acc ...security.ResourceAccess) restful.Rou if !usr.HasGroup(acc...) { log := rest.GetLoggerFromContext(request.Request, nil) if log != nil { - log.Infow("missing group", "user", usr, "required-group", acc) + log.Info("missing group", "user", usr, "required-group", acc) } httperr := httperrors.Forbidden(fmt.Errorf("you are not member in one of %+v", acc)) err := response.WriteHeaderAndEntity(httperr.StatusCode, httperr) if err != nil && log != nil { - log.Errorw("failed to send response", "error", err) + log.Error("failed to send response", "error", err) } return } @@ -170,13 +170,13 @@ func tenant(request *restful.Request) string { // TenantEnsurer holds allowed tenants and a list of path suffixes that type TenantEnsurer struct { - logger *zap.SugaredLogger + logger *slog.Logger allowedTenants map[string]bool excludedPathSuffixes []string } // NewTenantEnsurer creates a new ensurer with the given tenants. -func NewTenantEnsurer(log *zap.SugaredLogger, tenants, excludedPathSuffixes []string) TenantEnsurer { +func NewTenantEnsurer(log *slog.Logger, tenants, excludedPathSuffixes []string) TenantEnsurer { result := TenantEnsurer{ logger: log, allowedTenants: make(map[string]bool), @@ -206,8 +206,8 @@ func (e *TenantEnsurer) EnsureAllowedTenantFilter(req *restful.Request, resp *re if !e.allowed(tenantID) { httperror := httperrors.Forbidden(fmt.Errorf("tenant %s not allowed", tenantID)) - requestLogger := rest.GetLoggerFromContext(req.Request, e.logger).Desugar().WithOptions(zap.AddCallerSkip(1)).Sugar() - requestLogger.Errorw("service error", "status", httperror.StatusCode, "error", httperror.Message) + requestLogger := rest.GetLoggerFromContext(req.Request, e.logger) // FIXME call stack skip missing + requestLogger.Error("service error", "status", httperror.StatusCode, "error", httperror.Message) send(requestLogger, resp, httperror.StatusCode, httperror.Message) return diff --git a/cmd/metal-api/internal/service/service_test.go b/cmd/metal-api/internal/service/service_test.go index 2db2e7e66..1427195ec 100644 --- a/cmd/metal-api/internal/service/service_test.go +++ b/cmd/metal-api/internal/service/service_test.go @@ -4,14 +4,13 @@ import ( "bytes" "context" "io" + "log/slog" "net/http" "net/http/httptest" "testing" "time" "github.com/stretchr/testify/require" - "go.uber.org/zap" - "go.uber.org/zap/zaptest" "github.com/emicklei/go-restful/v3" "github.com/metal-stack/metal-lib/httperrors" @@ -21,22 +20,22 @@ import ( var testUserDirectory = NewUserDirectory("") -func injectViewer(log *zap.SugaredLogger, container *restful.Container, rq *http.Request) *restful.Container { +func injectViewer(log *slog.Logger, container *restful.Container, rq *http.Request) *restful.Container { return injectUser(log, testUserDirectory.viewer, container, rq) } -func injectEditor(log *zap.SugaredLogger, container *restful.Container, rq *http.Request) *restful.Container { +func injectEditor(log *slog.Logger, container *restful.Container, rq *http.Request) *restful.Container { return injectUser(log, testUserDirectory.edit, container, rq) } -func injectAdmin(log *zap.SugaredLogger, container *restful.Container, rq *http.Request) *restful.Container { +func injectAdmin(log *slog.Logger, container *restful.Container, rq *http.Request) *restful.Container { return injectUser(log, testUserDirectory.admin, container, rq) } -func injectUser(log *zap.SugaredLogger, u security.User, container *restful.Container, rq *http.Request) *restful.Container { +func injectUser(log *slog.Logger, u security.User, container *restful.Container, rq *http.Request) *restful.Container { hma := security.NewHMACAuth(u.Name, []byte{1, 2, 3}, security.WithUser(u)) usergetter := security.NewCreds(security.WithHMAC(hma)) - container.Filter(rest.UserAuth(usergetter, log)) + container.Filter(rest.UserAuth(usergetter, log)) // FIXME var body []byte if rq.Body != nil { data, _ := io.ReadAll(rq.Body) @@ -49,7 +48,7 @@ func injectUser(log *zap.SugaredLogger, u security.User, container *restful.Cont } func TestTenantEnsurer(t *testing.T) { - e := NewTenantEnsurer(zaptest.NewLogger(t).Sugar(), []string{"pvdr", "Pv", "pv-DR"}, nil) + e := NewTenantEnsurer(slog.Default(), []string{"pvdr", "Pv", "pv-DR"}, nil) require.True(t, e.allowed("pvdr")) require.True(t, e.allowed("Pv")) require.True(t, e.allowed("pv")) @@ -65,7 +64,7 @@ func TestAllowedPathSuffixes(t *testing.T) { _ = resp.WriteHeaderAndEntity(http.StatusOK, nil) } - e := NewTenantEnsurer(zaptest.NewLogger(t).Sugar(), []string{"a", "b", "c"}, []string{"health", "liveliness"}) + e := NewTenantEnsurer(slog.Default(), []string{"a", "b", "c"}, []string{"health", "liveliness"}) ws := new(restful.WebService).Path("/").Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON) ws.Filter(e.EnsureAllowedTenantFilter) health := ws.GET("health").To(foo).Returns(http.StatusOK, "OK", nil).DefaultReturns("Error", httperrors.HTTPErrorResponse{}) diff --git a/cmd/metal-api/internal/service/size-service.go b/cmd/metal-api/internal/service/size-service.go index 8afb0beb5..4bada642f 100644 --- a/cmd/metal-api/internal/service/size-service.go +++ b/cmd/metal-api/internal/service/size-service.go @@ -3,6 +3,7 @@ package service import ( "errors" "fmt" + "log/slog" "net/http" mdmv1 "github.com/metal-stack/masterdata-api/api/v1" @@ -12,7 +13,6 @@ import ( v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" "github.com/metal-stack/metal-lib/auditing" "github.com/metal-stack/metal-lib/pkg/pointer" - "go.uber.org/zap" restfulspec "github.com/emicklei/go-restful-openapi/v2" restful "github.com/emicklei/go-restful/v3" @@ -25,7 +25,7 @@ type sizeResource struct { } // NewSize returns a webservice for size specific endpoints. -func NewSize(log *zap.SugaredLogger, ds *datastore.RethinkStore, mdc mdm.Client) *restful.WebService { +func NewSize(log *slog.Logger, ds *datastore.RethinkStore, mdc mdm.Client) *restful.WebService { r := sizeResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/size-service_test.go b/cmd/metal-api/internal/service/size-service_test.go index 09ca22100..eec3a86b3 100644 --- a/cmd/metal-api/internal/service/size-service_test.go +++ b/cmd/metal-api/internal/service/size-service_test.go @@ -3,6 +3,7 @@ package service import ( "bytes" "encoding/json" + "log/slog" "net/http" "net/http/httptest" "testing" @@ -19,7 +20,6 @@ import ( "github.com/stretchr/testify/assert" testifymock "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" restful "github.com/emicklei/go-restful/v3" ) @@ -28,7 +28,7 @@ func TestGetSizes(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - sizeservice := NewSize(zaptest.NewLogger(t).Sugar(), ds, nil) + sizeservice := NewSize(slog.Default(), ds, nil) container := restful.NewContainer().Add(sizeservice) req := httptest.NewRequest("GET", "/v1/size", nil) w := httptest.NewRecorder() @@ -57,7 +57,7 @@ func TestGetSize(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - sizeservice := NewSize(zaptest.NewLogger(t).Sugar(), ds, nil) + sizeservice := NewSize(slog.Default(), ds, nil) container := restful.NewContainer().Add(sizeservice) req := httptest.NewRequest("GET", "/v1/size/1", nil) w := httptest.NewRecorder() @@ -87,7 +87,7 @@ func TestSuggest(t *testing.T) { require.NoError(t, err) body := bytes.NewBuffer(js) - sizeservice := NewSize(zaptest.NewLogger(t).Sugar(), ds, nil) + sizeservice := NewSize(slog.Default(), ds, nil) container := restful.NewContainer().Add(sizeservice) req := httptest.NewRequest("POST", "/v1/size/suggest", body) req.Header.Add("Content-Type", "application/json") @@ -127,7 +127,7 @@ func TestGetSizeNotFound(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - sizeservice := NewSize(zaptest.NewLogger(t).Sugar(), ds, nil) + sizeservice := NewSize(slog.Default(), ds, nil) container := restful.NewContainer().Add(sizeservice) req := httptest.NewRequest("GET", "/v1/size/999", nil) w := httptest.NewRecorder() @@ -147,7 +147,7 @@ func TestGetSizeNotFound(t *testing.T) { func TestDeleteSize(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() sizeservice := NewSize(log, ds, nil) container := restful.NewContainer().Add(sizeservice) @@ -171,13 +171,13 @@ func TestDeleteSize(t *testing.T) { func TestCreateSize(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() psc := &mdmv1mock.ProjectServiceClient{} psc.On("Find", testifymock.Anything, &mdmv1.ProjectFindRequest{}).Return(&mdmv1.ProjectListResponse{Projects: []*mdmv1.Project{ {Meta: &mdmv1.Meta{Id: "a"}}, }}, nil) - mdc := mdm.NewMock(psc, &mdmv1mock.TenantServiceClient{}) + mdc := mdm.NewMock(psc, &mdmv1mock.TenantServiceClient{}, nil) sizeservice := NewSize(log, ds, mdc) container := restful.NewContainer().Add(sizeservice) @@ -237,13 +237,13 @@ func TestCreateSize(t *testing.T) { func TestUpdateSize(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() psc := &mdmv1mock.ProjectServiceClient{} psc.On("Find", testifymock.Anything, &mdmv1.ProjectFindRequest{}).Return(&mdmv1.ProjectListResponse{Projects: []*mdmv1.Project{ {Meta: &mdmv1.Meta{Id: "p1"}}, }}, nil) - mdc := mdm.NewMock(psc, &mdmv1mock.TenantServiceClient{}) + mdc := mdm.NewMock(psc, &mdmv1mock.TenantServiceClient{}, nil) sizeservice := NewSize(log, ds, mdc) container := restful.NewContainer().Add(sizeservice) @@ -295,13 +295,13 @@ func TestUpdateSize(t *testing.T) { func TestListSizeReservations(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() psc := &mdmv1mock.ProjectServiceClient{} psc.On("Find", testifymock.Anything, &mdmv1.ProjectFindRequest{}).Return(&mdmv1.ProjectListResponse{Projects: []*mdmv1.Project{ {Meta: &mdmv1.Meta{Id: "p1"}}, }}, nil) - mdc := mdm.NewMock(psc, &mdmv1mock.TenantServiceClient{}) + mdc := mdm.NewMock(psc, &mdmv1mock.TenantServiceClient{}, nil) sizeservice := NewSize(log, ds, mdc) container := restful.NewContainer().Add(sizeservice) diff --git a/cmd/metal-api/internal/service/sizeimageconstraint-service.go b/cmd/metal-api/internal/service/sizeimageconstraint-service.go index 97f1d80e5..48bea470c 100644 --- a/cmd/metal-api/internal/service/sizeimageconstraint-service.go +++ b/cmd/metal-api/internal/service/sizeimageconstraint-service.go @@ -3,13 +3,13 @@ package service import ( "errors" "fmt" + "log/slog" "net/http" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" "github.com/metal-stack/metal-api/cmd/metal-api/internal/metal" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" "github.com/metal-stack/metal-lib/auditing" - "go.uber.org/zap" restfulspec "github.com/emicklei/go-restful-openapi/v2" restful "github.com/emicklei/go-restful/v3" @@ -21,7 +21,7 @@ type sizeImageConstraintResource struct { } // NewSize returns a webservice for size specific endpoints. -func NewSizeImageConstraint(log *zap.SugaredLogger, ds *datastore.RethinkStore) *restful.WebService { +func NewSizeImageConstraint(log *slog.Logger, ds *datastore.RethinkStore) *restful.WebService { r := sizeImageConstraintResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/switch-service.go b/cmd/metal-api/internal/service/switch-service.go index d0a392bfb..2a83b6966 100644 --- a/cmd/metal-api/internal/service/switch-service.go +++ b/cmd/metal-api/internal/service/switch-service.go @@ -3,6 +3,7 @@ package service import ( "errors" "fmt" + "log/slog" "net/http" "sort" "time" @@ -17,7 +18,6 @@ import ( "github.com/metal-stack/metal-lib/auditing" "github.com/metal-stack/metal-lib/httperrors" "github.com/metal-stack/metal-lib/pkg/pointer" - "go.uber.org/zap" ) type switchResource struct { @@ -25,7 +25,7 @@ type switchResource struct { } // NewSwitch returns a webservice for switch specific endpoints. -func NewSwitch(log *zap.SugaredLogger, ds *datastore.RethinkStore) *restful.WebService { +func NewSwitch(log *slog.Logger, ds *datastore.RethinkStore) *restful.WebService { r := switchResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/switch-service_test.go b/cmd/metal-api/internal/service/switch-service_test.go index efaa69b06..49c1d5cd2 100644 --- a/cmd/metal-api/internal/service/switch-service_test.go +++ b/cmd/metal-api/internal/service/switch-service_test.go @@ -3,6 +3,7 @@ package service import ( "bytes" "encoding/json" + "log/slog" "net/http" "net/http/httptest" "reflect" @@ -12,7 +13,6 @@ import ( restful "github.com/emicklei/go-restful/v3" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" r "gopkg.in/rethinkdb/rethinkdb-go.v6" "github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore" @@ -24,7 +24,7 @@ import ( func TestRegisterSwitch(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() switchservice := NewSwitch(log, ds) container := restful.NewContainer().Add(switchservice) @@ -70,7 +70,7 @@ func TestRegisterSwitch(t *testing.T) { func TestRegisterExistingSwitch(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() switchservice := NewSwitch(log, ds) container := restful.NewContainer().Add(switchservice) @@ -114,7 +114,7 @@ func TestRegisterExistingSwitch(t *testing.T) { func TestRegisterExistingSwitchErrorModifyingNics(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() switchservice := NewSwitch(log, ds) container := restful.NewContainer().Add(switchservice) @@ -144,7 +144,7 @@ func TestRegisterExistingSwitchErrorModifyingNics(t *testing.T) { func TestReplaceSwitch(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() switchservice := NewSwitch(log, ds) container := restful.NewContainer().Add(switchservice) @@ -1163,7 +1163,7 @@ func Test_updateSwitchNics(t *testing.T) { func TestUpdateSwitch(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() switchservice := NewSwitch(log, ds) container := restful.NewContainer().Add(switchservice) @@ -1207,7 +1207,7 @@ func TestUpdateSwitch(t *testing.T) { func TestNotifySwitch(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() switchservice := NewSwitch(log, ds) container := restful.NewContainer().Add(switchservice) @@ -1242,7 +1242,7 @@ func TestNotifySwitch(t *testing.T) { func TestNotifyErrorSwitch(t *testing.T) { ds, mock := datastore.InitMockDB(t) testdata.InitMockDBData(mock) - log := zaptest.NewLogger(t).Sugar() + log := slog.Default() switchservice := NewSwitch(log, ds) container := restful.NewContainer().Add(switchservice) diff --git a/cmd/metal-api/internal/service/tenant-service.go b/cmd/metal-api/internal/service/tenant-service.go index 88a16500a..8d24edcdb 100644 --- a/cmd/metal-api/internal/service/tenant-service.go +++ b/cmd/metal-api/internal/service/tenant-service.go @@ -2,13 +2,13 @@ package service import ( "errors" + "log/slog" "net/http" "github.com/metal-stack/masterdata-api/api/rest/mapper" v1 "github.com/metal-stack/masterdata-api/api/rest/v1" mdmv1 "github.com/metal-stack/masterdata-api/api/v1" mdm "github.com/metal-stack/masterdata-api/pkg/client" - "go.uber.org/zap" "google.golang.org/protobuf/types/known/wrapperspb" restfulspec "github.com/emicklei/go-restful-openapi/v2" @@ -23,7 +23,7 @@ type tenantResource struct { } // NewTenant returns a webservice for tenant specific endpoints. -func NewTenant(log *zap.SugaredLogger, mdc mdm.Client) *restful.WebService { +func NewTenant(log *slog.Logger, mdc mdm.Client) *restful.WebService { r := tenantResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/tenant-service_test.go b/cmd/metal-api/internal/service/tenant-service_test.go index 98fcc0112..cfda1ea97 100644 --- a/cmd/metal-api/internal/service/tenant-service_test.go +++ b/cmd/metal-api/internal/service/tenant-service_test.go @@ -2,6 +2,7 @@ package service import ( "fmt" + "log/slog" "testing" restful "github.com/emicklei/go-restful/v3" @@ -13,7 +14,6 @@ import ( "github.com/metal-stack/security" testifymock "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" ) type MockedTenantService struct { @@ -26,8 +26,8 @@ func NewMockedTenantService(t *testing.T, tenantServiceMock func(mock *mdmv1mock if tenantServiceMock != nil { tenantServiceMock(tsc) } - mdc := mdm.NewMock(&mdmv1mock.ProjectServiceClient{}, tsc) - ws := NewTenant(zaptest.NewLogger(t).Sugar(), mdc) + mdc := mdm.NewMock(&mdmv1mock.ProjectServiceClient{}, tsc, nil) + ws := NewTenant(slog.Default(), mdc) return &MockedTenantService{ t: t, ws: ws, diff --git a/cmd/metal-api/internal/service/user-service.go b/cmd/metal-api/internal/service/user-service.go index 5844b7e00..63789104f 100644 --- a/cmd/metal-api/internal/service/user-service.go +++ b/cmd/metal-api/internal/service/user-service.go @@ -2,11 +2,11 @@ package service import ( "fmt" + "log/slog" "net/http" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" "github.com/metal-stack/security" - "go.uber.org/zap" restfulspec "github.com/emicklei/go-restful-openapi/v2" restful "github.com/emicklei/go-restful/v3" @@ -19,7 +19,7 @@ type userResource struct { } // NewUser returns a webservice for user specific endpoints. -func NewUser(log *zap.SugaredLogger, userGetter security.UserGetter) *restful.WebService { +func NewUser(log *slog.Logger, userGetter security.UserGetter) *restful.WebService { r := userResource{ webResource: webResource{ log: log, diff --git a/cmd/metal-api/internal/service/vpn-service.go b/cmd/metal-api/internal/service/vpn-service.go index b9ff8f93f..c37a01061 100644 --- a/cmd/metal-api/internal/service/vpn-service.go +++ b/cmd/metal-api/internal/service/vpn-service.go @@ -2,13 +2,13 @@ package service import ( "fmt" + "log/slog" "net/http" "time" restfulspec "github.com/emicklei/go-restful-openapi/v2" "github.com/emicklei/go-restful/v3" - "go.uber.org/zap" "github.com/metal-stack/metal-api/cmd/metal-api/internal/headscale" v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1" @@ -22,7 +22,7 @@ type vpnResource struct { // NewVPN returns a webservice for VPN specific endpoints. func NewVPN( - log *zap.SugaredLogger, + log *slog.Logger, headscaleClient *headscale.HeadscaleClient, ) *restful.WebService { r := vpnResource{ diff --git a/cmd/metal-api/main.go b/cmd/metal-api/main.go index 1a3a59a9c..ae3621da0 100644 --- a/cmd/metal-api/main.go +++ b/cmd/metal-api/main.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "log" "log/slog" "net/http" httppprof "net/http/pprof" @@ -37,8 +38,6 @@ import ( "github.com/go-openapi/spec" "github.com/spf13/cobra" "github.com/spf13/viper" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" goipam "github.com/metal-stack/go-ipam" "github.com/metal-stack/masterdata-api/pkg/auth" @@ -69,7 +68,7 @@ const ( ) var ( - logger *zap.SugaredLogger + logger *slog.Logger ds *datastore.RethinkStore ipamer *ipam.Ipam @@ -206,7 +205,7 @@ var deleteOrphanImagesCmd = &cobra.Command{ func main() { if err := rootCmd.Execute(); err != nil { - logger.Fatalw("failed executing root command", "error", err) + log.Fatalf("failed executing root command: %s", err) } } @@ -342,26 +341,19 @@ func initConfig() { } func initLogging() { - level := zap.NewAtomicLevelAt(zap.InfoLevel) + level := slog.LevelInfo if viper.IsSet("log-level") { - var err error - level, err = zap.ParseAtomicLevel(viper.GetString("log-level")) + var ( + lvlvar slog.LevelVar + ) + err := lvlvar.UnmarshalText([]byte(viper.GetString("log-level"))) if err != nil { - panic(fmt.Errorf("can't initialize zap logger: %w", err)) + panic(fmt.Errorf("can't initialize logger: %w", err)) } + level = lvlvar.Level() } - zcfg := zap.NewProductionConfig() - zcfg.EncoderConfig.TimeKey = "timestamp" - zcfg.EncoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder - zcfg.Level = level - - l, err := zcfg.Build() - if err != nil { - panic(fmt.Errorf("can't initialize zap logger: %w", err)) - } - - logger = l.Sugar() + logger = slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: level})) } func initMetrics() { @@ -384,10 +376,10 @@ func initMetrics() { err := server.ListenAndServe() if err != nil { - logger.Errorw("failed to start metrics endpoint, exiting...", "error", err) + logger.Error("failed to start metrics endpoint, exiting...", "error", err) os.Exit(1) } - logger.Errorw("metrics server has stopped unexpectedly without an error") + logger.Error("metrics server has stopped unexpectedly without an error") }() } @@ -440,7 +432,7 @@ func initEventBus() { partitions := waitForPartitions() - nsq := eventbus.NewNSQ(publisherCfg, logger.Named("nsq-eventbus").Desugar(), bus.NewPublisher) + nsq := eventbus.NewNSQ(publisherCfg, logger.WithGroup("nsq-eventbus"), bus.NewPublisher) // FIXME nsq.WaitForPublisher() nsq.WaitForTopicsCreated(partitions, metal.Topics) if err := nsq.CreateEndpoints(viper.GetString("nsqlookupd-addr")); err != nil { @@ -455,7 +447,7 @@ func waitForPartitions() metal.Partitions { for { partitions, err = ds.ListPartitions() if err != nil { - logger.Errorw("cannot list partitions", "error", err) + logger.Error("cannot list partitions", "error", err) time.Sleep(3 * time.Second) continue } @@ -468,7 +460,7 @@ func connectDataStore(opts ...dsConnectOpt) error { dbAdapter := viper.GetString("db") if dbAdapter == "rethinkdb" { ds = datastore.New( - logger.Named("datastore"), + logger.WithGroup("datastore"), viper.GetString("db-addr"), viper.GetString("db-name"), viper.GetString("db-user"), @@ -522,27 +514,27 @@ func initMasterData() { ca := viper.GetString("masterdata-capath") if ca == "" { - logger.Fatal("no masterdata-api capath given") + log.Fatal("no masterdata-api capath given") } certpath := viper.GetString("masterdata-certpath") if certpath == "" { - logger.Fatal("no masterdata-api certpath given") + log.Fatal("no masterdata-api certpath given") } certkeypath := viper.GetString("masterdata-certkeypath") if certkeypath == "" { - logger.Fatal("no masterdata-api certkeypath given") + log.Fatal("no masterdata-api certkeypath given") } hostname := viper.GetString("masterdata-hostname") if hostname == "" { - logger.Fatal("no masterdata-hostname given") + log.Fatal("no masterdata-hostname given") } port := viper.GetInt("masterdata-port") if port == 0 { - logger.Fatal("no masterdata-port given") + log.Fatal("no masterdata-port given") } var err error @@ -553,7 +545,7 @@ func initMasterData() { cancel() break } - logger.Errorw("unable to initialize masterdata-api client, retrying...", "error", err) + logger.Error("unable to initialize masterdata-api client, retrying...", "error", err) time.Sleep(3 * time.Second) } @@ -572,7 +564,7 @@ func initIpam() { viper.GetString("ipam-db-name"), goipam.SSLModeDisable) if err != nil { - logger.Errorw("cannot connect to db in root command metal-api/internal/main.initIpam()", "error", err) + logger.Error("cannot connect to db in root command metal-api/internal/main.initIpam()", "error", err) time.Sleep(3 * time.Second) initIpam() return @@ -583,31 +575,31 @@ func initIpam() { ipamInstance := goipam.New() ipamer = ipam.New(ipamInstance) default: - logger.Errorw("database not supported", "db", dbAdapter) + logger.Error("database not supported", "db", dbAdapter) } logger.Info("ipam initialized") } -func initAuth(lg *zap.SugaredLogger) security.UserGetter { +func initAuth(lg *slog.Logger) security.UserGetter { var auths []security.CredsOpt providerTenant := viper.GetString("provider-tenant") grpr, err := grp.NewGrpr(grp.Config{ProviderTenant: providerTenant}) if err != nil { - logger.Fatalw("error creating grpr", "error", err) + log.Fatalf("error creating grpr: %s", err) } plugin := sec.NewPlugin(grpr) issuerCacheInterval, err := time.ParseDuration(viper.GetString("issuercache-interval")) if err != nil { - logger.Fatalw("error parsing issuercache-interval", "error", err) + log.Fatalf("error parsing issuercache-interval: %s", err) } // create multi issuer cache that holds all trusted issuers from masterdata, in this case: only provider tenant // FIXME create a slog.Logger instance with the same log level as configured for zap and pass this logger instance issuerCache, err := security.NewMultiIssuerCache(nil, func() ([]*security.IssuerConfig, error) { - logger.Infow("loading tenants for issuercache", "providerTenant", providerTenant) + logger.Info("loading tenants for issuercache", "providerTenant", providerTenant) // get provider tenant from masterdata ts, err := mdc.Tenant().Find(context.Background(), &v1.TenantFindRequest{ @@ -645,7 +637,7 @@ func initAuth(lg *zap.SugaredLogger) security.UserGetter { }, security.IssuerReloadInterval(issuerCacheInterval)) if err != nil || issuerCache == nil { - logger.Fatalw("error creating dynamic oidc resolver", "error", err) + log.Fatalf("error creating dynamic oidc resolver: %s", err) } logger.Info("dynamic oidc resolver successfully initialized") @@ -655,7 +647,7 @@ func initAuth(lg *zap.SugaredLogger) security.UserGetter { if dexAddr != "" { dx, err := security.NewDex(dexAddr) if err != nil { - logger.Fatalw("dex not reachable", "error", err) + log.Fatalf("dex not reachable: %s", err) } if dx != nil { // use custom user extractor and group processor @@ -663,7 +655,7 @@ func initAuth(lg *zap.SugaredLogger) security.UserGetter { ugsOpts = append(ugsOpts, security.UserGetterProxyMapping(dexAddr, dexClientID, dx)) logger.Info("dex successfully configured") } else { - logger.Fatal("dex is configured, but not initialized") + log.Fatal("dex is configured, but not initialized") } } @@ -679,7 +671,7 @@ func initAuth(lg *zap.SugaredLogger) security.UserGetter { mackey := viper.GetString(fmt.Sprintf("hmac-%s-key", u)) lf, err := time.ParseDuration(viper.GetString(lfkey)) if err != nil { - lg.Warnw("illegal value for hmac lifetime, use 30secs as default", "error", err, "val", lfkey) + lg.Warn("illegal value for hmac lifetime, use 30secs as default", "error", err, "val", lfkey) lf = 30 * time.Second } @@ -698,7 +690,7 @@ func initAuth(lg *zap.SugaredLogger) security.UserGetter { func initRestServices(audit auditing.Auditing, withauth bool, ipmiSuperUser metal.MachineIPMISuperUser) *restfulspec.Config { service.BasePath = viper.GetString("base-path") if !strings.HasPrefix(service.BasePath, "/") || !strings.HasSuffix(service.BasePath, "/") { - logger.Fatal("base path must start and end with a slash") + log.Fatal("base path must start and end with a slash") } var p bus.Publisher @@ -707,9 +699,9 @@ func initRestServices(audit auditing.Auditing, withauth bool, ipmiSuperUser meta p = nsqer.Publisher ep = nsqer.Endpoints } - ipService, err := service.NewIP(logger.Named("ip-service"), ds, ep, ipamer, mdc) + ipService, err := service.NewIP(logger.WithGroup("ip-service"), ds, ep, ipamer, mdc) if err != nil { - logger.Fatal(err) + log.Fatal(err) } var s3Client *s3client.Client @@ -720,15 +712,15 @@ func initRestServices(audit auditing.Auditing, withauth bool, ipmiSuperUser meta s3FirmwareBucket := viper.GetString("s3-firmware-bucket") s3Client, err = s3client.New(s3Address, s3Key, s3Secret, s3FirmwareBucket) if err != nil { - logger.Fatal(err) + log.Fatal(err) } - logger.Infow("connected to s3 server that provides firmwares", "address", s3Address) + logger.Info("connected to s3 server that provides firmwares", "address", s3Address) } else { - logger.Info("s3 server that provides firmware is disabled") + logger.Debug("s3 server that provides firmware is disabled") } - firmwareService, err := service.NewFirmware(logger.Named("firmware-service"), ds, s3Client) + firmwareService, err := service.NewFirmware(logger.WithGroup("firmware-service"), ds, s3Client) if err != nil { - logger.Fatal(err) + log.Fatal(err) } var userGetter security.UserGetter if withauth { @@ -736,57 +728,61 @@ func initRestServices(audit auditing.Auditing, withauth bool, ipmiSuperUser meta } reasonMinLength := viper.GetUint("password-reason-minlength") - machineService, err := service.NewMachine(logger.Named("machine-service"), ds, p, ep, ipamer, mdc, s3Client, userGetter, reasonMinLength, headscaleClient, ipmiSuperUser) + machineService, err := service.NewMachine(logger.WithGroup("machine-service"), ds, p, ep, ipamer, mdc, s3Client, userGetter, reasonMinLength, headscaleClient, ipmiSuperUser) if err != nil { - logger.Fatal(err) + log.Fatal(err) } - firewallService, err := service.NewFirewall(logger.Named("firewall-service"), ds, p, ipamer, ep, mdc, userGetter, headscaleClient) + firewallService, err := service.NewFirewall(logger.WithGroup("firewall-service"), ds, p, ipamer, ep, mdc, userGetter, headscaleClient) if err != nil { - logger.Fatal(err) + log.Fatal(err) } - healthService, err := rest.NewHealth(logger.Desugar(), service.BasePath, ds) + healthService, err := rest.NewHealth(logger, service.BasePath, ds) // FIXME if err != nil { - logger.Fatal(err) + log.Fatal(err) } minClientVersion, err := semver.NewVersion(viper.GetString("minimum-client-version")) if err != nil { - logger.Fatalf("given minimum client version is not semver parsable: %w", err) + log.Fatalf("given minimum client version is not semver parsable: %s", err) } - restful.DefaultContainer.Add(service.NewAudit(logger.Named("audit-service"), audit)) - restful.DefaultContainer.Add(service.NewPartition(logger.Named("partition-service"), ds, nsqer)) - restful.DefaultContainer.Add(service.NewImage(logger.Named("image-service"), ds)) - restful.DefaultContainer.Add(service.NewSize(logger.Named("size-service"), ds, mdc)) - restful.DefaultContainer.Add(service.NewSizeImageConstraint(logger.Named("size-image-constraint-service"), ds)) - restful.DefaultContainer.Add(service.NewNetwork(logger.Named("network-service"), ds, ipamer, mdc)) + restful.DefaultContainer.Add(service.NewAudit(logger.WithGroup("audit-service"), audit)) + restful.DefaultContainer.Add(service.NewPartition(logger.WithGroup("partition-service"), ds, nsqer)) + restful.DefaultContainer.Add(service.NewImage(logger.WithGroup("image-service"), ds)) + restful.DefaultContainer.Add(service.NewSize(logger.WithGroup("size-service"), ds, mdc)) + restful.DefaultContainer.Add(service.NewSizeImageConstraint(logger.WithGroup("size-image-constraint-service"), ds)) + restful.DefaultContainer.Add(service.NewNetwork(logger.WithGroup("network-service"), ds, ipamer, mdc)) restful.DefaultContainer.Add(ipService) restful.DefaultContainer.Add(firmwareService) restful.DefaultContainer.Add(machineService) - restful.DefaultContainer.Add(service.NewProject(logger.Named("project-service"), ds, mdc)) - restful.DefaultContainer.Add(service.NewTenant(logger.Named("tenant-service"), mdc)) - restful.DefaultContainer.Add(service.NewUser(logger.Named("user-service"), userGetter)) + restful.DefaultContainer.Add(service.NewProject(logger.WithGroup("project-service"), ds, mdc)) + restful.DefaultContainer.Add(service.NewTenant(logger.WithGroup("tenant-service"), mdc)) + restful.DefaultContainer.Add(service.NewUser(logger.WithGroup("user-service"), userGetter)) restful.DefaultContainer.Add(firewallService) - restful.DefaultContainer.Add(service.NewFilesystemLayout(logger.Named("filesystem-layout-service"), ds)) - restful.DefaultContainer.Add(service.NewSwitch(logger.Named("switch-service"), ds)) + restful.DefaultContainer.Add(service.NewFilesystemLayout(logger.WithGroup("filesystem-layout-service"), ds)) + restful.DefaultContainer.Add(service.NewSwitch(logger.WithGroup("switch-service"), ds)) restful.DefaultContainer.Add(healthService) - restful.DefaultContainer.Add(service.NewVPN(logger.Named("vpn-service"), headscaleClient)) + restful.DefaultContainer.Add(service.NewVPN(logger.WithGroup("vpn-service"), headscaleClient)) restful.DefaultContainer.Add(rest.NewVersion(moduleName, service.BasePath, minClientVersion.Original())) - restful.DefaultContainer.Filter(rest.RequestLoggerFilter(logger)) + restful.DefaultContainer.Filter(rest.RequestLoggerFilter(logger)) // FIXME restful.DefaultContainer.Filter(metrics.RestfulMetrics) if withauth { - restful.DefaultContainer.Filter(rest.UserAuth(userGetter, logger)) + restful.DefaultContainer.Filter(rest.UserAuth(userGetter, logger)) // FIXME providerTenant := viper.GetString("provider-tenant") excludedPathSuffixes := []string{"liveliness", "health", "version", "apidocs.json"} - ensurer := service.NewTenantEnsurer(logger.Named("tenant-ensurer-filter"), []string{providerTenant}, excludedPathSuffixes) + ensurer := service.NewTenantEnsurer(logger.WithGroup("tenant-ensurer-filter"), []string{providerTenant}, excludedPathSuffixes) restful.DefaultContainer.Filter(ensurer.EnsureAllowedTenantFilter) } if audit != nil { - restful.DefaultContainer.Filter(auditing.HttpFilter(audit, logger.Named("audit-middleware"))) + httpFilter, err := auditing.HttpFilter(audit, logger.WithGroup("audit-middleware")) + if err != nil { + log.Fatalf("unable to create http filter for auditing: %s", err) + } + restful.DefaultContainer.Filter(httpFilter) // FIXME } config := restfulspec.Config{ @@ -810,7 +806,7 @@ func initHeadscale() error { viper.GetString("headscale-addr"), viper.GetString("headscale-cp-addr"), viper.GetString("headscale-api-key"), - logger.Named("headscale"), + logger.WithGroup("headscale"), ) if err != nil || headscaleClient == nil { return fmt.Errorf("failed to init headscale client %w", err) @@ -921,16 +917,16 @@ func evaluateVPNConnected() error { err := ds.UpdateMachine(&old, &m) if err != nil { errs = append(errs, err) - logger.Errorw("unable to update vpn connected state, continue anyway", "machine", m.ID, "error", err) + logger.Error("unable to update vpn connected state, continue anyway", "machine", m.ID, "error", err) continue } - logger.Infow("updated vpn connected state", "machine", m.ID, "connected", connected) + logger.Info("updated vpn connected state", "machine", m.ID, "connected", connected) } return errors.Join(errs...) } // might return (nil, nil) if auditing is disabled! -func createAuditingClient(log *zap.SugaredLogger) (auditing.Auditing, error) { +func createAuditingClient(log *slog.Logger) (auditing.Auditing, error) { isEnabled := viper.GetBool("auditing-enabled") if !isEnabled { log.Warn("auditing is disabled, can be enabled by setting --auditing-enabled=true") @@ -944,7 +940,7 @@ func createAuditingClient(log *zap.SugaredLogger) (auditing.Auditing, error) { IndexPrefix: viper.GetString("auditing-index-prefix"), RotationInterval: auditing.Interval(viper.GetString("auditing-index-interval")), Keep: viper.GetInt64("auditing-keep"), - Log: log, + Log: log, //FIXME } return auditing.New(c) } @@ -954,7 +950,7 @@ func run() error { audit, err := createAuditingClient(logger) if err != nil { - logger.Fatalw("cannot create auditing client", "error", err) + log.Fatalf("cannot create auditing client:%s ", err) } initRestServices(audit, true, ipmiSuperUser) @@ -981,7 +977,7 @@ func run() error { response.WriteHeader(serviceErr.Code) err := response.WriteAsJson(httperrors.NewHTTPError(serviceErr.Code, fmt.Errorf(serviceErr.Message))) if err != nil { - logger.Error("Failed to send response", zap.Error(err)) + logger.Error("Failed to send response", "error", err) return } }) @@ -991,9 +987,9 @@ func run() error { p = nsqer.Publisher } - c, err := bus.NewConsumer(logger.Desugar(), publisherTLSConfig, viper.GetString("nsqlookupd-addr")) + c, err := bus.NewConsumer(logger, publisherTLSConfig, viper.GetString("nsqlookupd-addr")) if err != nil { - logger.Fatalw("cannot connect to NSQ", "error", err) + log.Fatalf("cannot connect to NSQ: %s", err) } go func() { @@ -1013,7 +1009,7 @@ func run() error { IPMISuperUser: ipmiSuperUser, }) if err != nil { - logger.Fatalw("error running grpc server", "error", err) + log.Fatalf("error running grpc server:%s", err) } }() @@ -1024,7 +1020,7 @@ func run() error { ReadHeaderTimeout: time.Minute, } - logger.Infow("start metal api", "version", v.V.String(), "address", addr, "base-path", service.BasePath) + logger.Info("start metal api", "version", v.V.String(), "address", addr, "base-path", service.BasePath) err = server.ListenAndServe() if err != nil && !errors.Is(err, http.ErrServerClosed) { diff --git a/go.mod b/go.mod index 184b5b579..ffcbf4330 100644 --- a/go.mod +++ b/go.mod @@ -5,34 +5,32 @@ go 1.22 require ( github.com/Masterminds/semver/v3 v3.2.1 github.com/avast/retry-go/v4 v4.5.1 - github.com/aws/aws-sdk-go v1.44.326 + github.com/aws/aws-sdk-go v1.50.31 github.com/dustin/go-humanize v1.0.1 github.com/emicklei/go-restful-openapi/v2 v2.9.1 - github.com/emicklei/go-restful/v3 v3.11.2 - github.com/go-openapi/spec v0.20.14 + github.com/emicklei/go-restful/v3 v3.11.3 + github.com/go-openapi/spec v0.21.0 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 - github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 + github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 github.com/juanfont/headscale v0.22.3 github.com/looplab/fsm v0.3.0 github.com/metal-stack/go-ipam v1.8.5 - github.com/metal-stack/masterdata-api v0.10.3 - github.com/metal-stack/metal-lib v0.14.4 + github.com/metal-stack/masterdata-api v0.11.1 + github.com/metal-stack/metal-lib v0.14.5 github.com/metal-stack/security v0.7.2 github.com/metal-stack/v v1.0.3 github.com/nsqio/go-nsq v1.1.0 - github.com/prometheus/client_golang v1.18.0 + github.com/prometheus/client_golang v1.19.0 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 - github.com/stretchr/testify v1.8.4 - github.com/testcontainers/testcontainers-go v0.27.0 + github.com/stretchr/testify v1.9.0 + github.com/testcontainers/testcontainers-go v0.29.1 github.com/undefinedlabs/go-mpatch v1.0.7 - go.uber.org/zap v1.26.0 - golang.org/x/crypto v0.19.0 + golang.org/x/crypto v0.21.0 golang.org/x/sync v0.6.0 - google.golang.org/grpc v1.61.1 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.2 ) @@ -45,7 +43,7 @@ replace ( ) require ( - connectrpc.com/connect v1.14.0 // indirect + connectrpc.com/connect v1.15.0 // indirect dario.cat/mergo v1.0.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect @@ -75,25 +73,26 @@ require ( github.com/fxamacker/cbor/v2 v2.5.0 // indirect github.com/glebarez/go-sqlite v1.20.3 // indirect github.com/glebarez/sqlite v1.7.0 // indirect - github.com/go-jose/go-jose/v3 v3.0.1 // indirect + github.com/go-jose/go-jose/v3 v3.0.3 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-openapi/errors v0.21.0 // indirect - github.com/go-openapi/jsonpointer v0.20.2 // indirect - github.com/go-openapi/jsonreference v0.20.4 // indirect - github.com/go-openapi/runtime v0.27.1 // indirect - github.com/go-openapi/strfmt v0.22.0 // indirect - github.com/go-openapi/swag v0.22.9 // indirect + github.com/go-openapi/errors v0.22.0 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/runtime v0.28.0 // indirect + github.com/go-openapi/strfmt v0.23.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/gofrs/uuid/v5 v5.0.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1 github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -111,12 +110,12 @@ require ( github.com/josharian/native v1.1.1-0.20230202152459-5c7d0dd6ab86 // indirect github.com/jsimonetti/rtnetlink v1.4.1 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.6 // indirect + github.com/klauspost/compress v1.17.7 // indirect github.com/lestrrat-go/blackmagic v1.0.2 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect - github.com/lestrrat-go/httprc v1.0.4 // indirect + github.com/lestrrat-go/httprc v1.0.5 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect - github.com/lestrrat-go/jwx/v2 v2.0.19 // indirect + github.com/lestrrat-go/jwx/v2 v2.0.21 // indirect github.com/lestrrat-go/option v1.0.1 // indirect github.com/lib/pq v1.10.9 // indirect github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed // indirect @@ -126,7 +125,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mdlayher/netlink v1.7.2 // indirect github.com/mdlayher/socket v0.5.0 // indirect - github.com/meilisearch/meilisearch-go v0.26.1 // indirect + github.com/meilisearch/meilisearch-go v0.26.2 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moby/patternmatcher v0.6.0 // indirect @@ -138,17 +137,17 @@ require ( github.com/morikuni/aec v1.0.0 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc6 // indirect + github.com/opencontainers/image-spec v1.1.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/philip-bui/grpc-zerolog v1.0.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.46.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect + github.com/prometheus/client_model v0.6.0 // indirect + github.com/prometheus/common v0.50.0 // indirect + github.com/prometheus/procfs v0.13.0 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rs/zerolog v1.32.0 // indirect @@ -156,14 +155,14 @@ require ( github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/samber/lo v1.39.0 // indirect github.com/segmentio/asm v1.2.0 // indirect - github.com/shirou/gopsutil/v3 v3.24.1 // indirect + github.com/shirou/gopsutil/v3 v3.24.2 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/objx v0.5.1 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a // indirect github.com/tklauser/go-sysconf v0.3.13 // indirect @@ -172,29 +171,28 @@ require ( github.com/valyala/fasthttp v1.52.0 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.mongodb.org/mongo-driver v1.13.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.mongodb.org/mongo-driver v1.14.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 go.uber.org/multierr v1.11.0 // indirect go4.org/intern v0.0.0-20230205224052-192e9f60865c // indirect go4.org/mem v0.0.0-20220726221520-4f986261bf13 // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 // indirect - golang.org/x/exp v0.0.0-20240213143201-ec583247a57a - golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 + golang.org/x/mod v0.16.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect; indirecct - golang.org/x/tools v0.18.0 // indirect + golang.org/x/tools v0.19.0 // indirect golang.zx2c4.com/wireguard/windows v0.5.3 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240213162025-012b6fc9bca9 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240304212257-790db918fca8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 // indirect gopkg.in/cenkalti/backoff.v2 v2.2.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index 880b6210f..dba901480 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,8 @@ cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIA cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -connectrpc.com/connect v1.14.0 h1:PDS+J7uoz5Oui2VEOMcfz6Qft7opQM9hPiKvtGC01pA= -connectrpc.com/connect v1.14.0/go.mod h1:uoAq5bmhhn43TwhaKdGKN/bZcGtzPW1v+ngDTn5u+8s= +connectrpc.com/connect v1.15.0 h1:lFdeCbZrVVDydAqwr4xGV2y+ULn+0Z73s5JBj2LikWo= +connectrpc.com/connect v1.15.0/go.mod h1:bQmjpDY8xItMnttnurVgOkHUBMRT9cpsNi2O4AjKhmA= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= @@ -89,8 +89,8 @@ github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevB github.com/avast/retry-go/v4 v4.5.1 h1:AxIx0HGi4VZ3I02jr78j5lZ3M6x1E0Ivxa6b0pUUh7o= github.com/avast/retry-go/v4 v4.5.1/go.mod h1:/sipNsvNB3RRuT5iNcb6h73nw3IBmXJ/H3XrCQYSOpc= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/aws/aws-sdk-go v1.44.326 h1:/6xD/9mKZ2RMTDfbhh9qCxw+CaTbJRvfHJ/NHPFbI38= -github.com/aws/aws-sdk-go v1.44.326/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.50.31 h1:gx2NRLLEDUmQFC4YUsfMUKkGCwpXVO8ijUecq/nOQGA= +github.com/aws/aws-sdk-go v1.50.31/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -254,8 +254,8 @@ github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT github.com/emicklei/go-restful-openapi/v2 v2.9.1 h1:Of8B1rXdG81il5TTiSY+9Qrh7pYOr8aLdynHIpvo7fM= github.com/emicklei/go-restful-openapi/v2 v2.9.1/go.mod h1:VKNgZyYviM1hnyrjD9RDzP2RuE94xTXxV+u6MGN4v4k= github.com/emicklei/go-restful/v3 v3.7.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/emicklei/go-restful/v3 v3.11.2 h1:1onLa9DcsMYO9P+CXaL0dStDqQ2EHHXLiz+BtnqkLAU= -github.com/emicklei/go-restful/v3 v3.11.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.11.3 h1:yagOQz/38xJmcNeZJtrUcKjkHRltIaIFXKWeG1SkWGE= +github.com/emicklei/go-restful/v3 v3.11.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -282,8 +282,8 @@ github.com/glebarez/go-sqlite v1.20.3/go.mod h1:u3N6D/wftiAzIOJtZl6BmedqxmmkDfH3 github.com/glebarez/sqlite v1.7.0 h1:A7Xj/KN2Lvie4Z4rrgQHY8MsbebX3NyWsL3n2i82MVI= github.com/glebarez/sqlite v1.7.0/go.mod h1:PkeevrRlF/1BhQBCnzcMWzgrIk7IOop+qS2jUYLfHhk= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA= -github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= +github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k= +github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -300,37 +300,37 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-openapi/analysis v0.21.5 h1:3tHfEBh6Ia8eKc4M7khOGjPOAlWKJ10d877Cr9teujI= -github.com/go-openapi/analysis v0.21.5/go.mod h1:25YcZosX9Lwz2wBsrFrrsL8bmjjXdlyP6zsr2AMy29M= -github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= -github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= +github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU= +github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= -github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= -github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= -github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= -github.com/go-openapi/loads v0.21.3 h1:8sSH2FIm/SnbDUGv572md4YqVMFne/a9Eubvcd3anew= -github.com/go-openapi/loads v0.21.3/go.mod h1:Y3aMR24iHbKHppOj91nQ/SHc0cuPbAr4ndY4a02xydc= -github.com/go-openapi/runtime v0.27.1 h1:ae53yaOoh+fx/X5Eaq8cRmavHgDma65XPZuvBqvJYto= -github.com/go-openapi/runtime v0.27.1/go.mod h1:fijeJEiEclyS8BRurYE1DE5TLb9/KZl6eAdbzjsrlLU= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco= +github.com/go-openapi/loads v0.22.0/go.mod h1:yLsaTCS92mnSAZX5WWoxszLj0u+Ojl+Zs5Stn1oF+rs= +github.com/go-openapi/runtime v0.28.0 h1:gpPPmWSNGo214l6n8hzdXYhPuJcGtziTOgUpvsFWGIQ= +github.com/go-openapi/runtime v0.28.0/go.mod h1:QN7OzcS+XuYmkQLw05akXk0jRH/eZ3kb18+1KwW9gyc= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= -github.com/go-openapi/spec v0.20.14 h1:7CBlRnw+mtjFGlPDRZmAMnq35cRzI91xj03HVyUi/Do= -github.com/go-openapi/spec v0.20.14/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw= -github.com/go-openapi/strfmt v0.22.0 h1:Ew9PnEYc246TwrEspvBdDHS4BVKXy/AOVsfqGDgAcaI= -github.com/go-openapi/strfmt v0.22.0/go.mod h1:HzJ9kokGIju3/K6ap8jL+OlGAbjpSv27135Yr9OivU4= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= +github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= -github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= -github.com/go-openapi/validate v0.22.4 h1:5v3jmMyIPKTR8Lv9syBAIRxG6lY0RqeBPB1LKEijzk8= -github.com/go-openapi/validate v0.22.4/go.mod h1:qm6O8ZIcPVdSY5219468Jv7kBdGvkiZLPOmqnqTUZ2A= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58= +github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ= github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= @@ -384,8 +384,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -436,9 +436,10 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 h1:f4tggROQKKcnh4eItay6z/HbHLqghBxS8g7pyMhmDio= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0/go.mod h1:hKAkSgNkL0FII46ZkJcpVEAai4KV+swlIWCKfekd1pA= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1 h1:HcUWd006luQPljE73d5sk+/VgYPGUReEVz2y1/qylwY= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1/go.mod h1:w9Y7gY31krpLmrVU5ZPG9H7l9fZuRu5/3R3S3FMtVQ4= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is= @@ -512,11 +513,10 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.6/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.17.6 h1:60eq2E/jlfwQXtvZEeBUYADs+BwKBWURIY+Gj2eRGjI= -github.com/klauspost/compress v1.17.6/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -536,12 +536,12 @@ github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= -github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8= -github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= +github.com/lestrrat-go/httprc v1.0.5 h1:bsTfiH8xaKOJPrg1R+E3iE/AWZr/x0Phj9PBTG/OLUk= +github.com/lestrrat-go/httprc v1.0.5/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.19 h1:ekv1qEZE6BVct89QA+pRF6+4pCpfVrOnEJnTnT4RXoY= -github.com/lestrrat-go/jwx/v2 v2.0.19/go.mod h1:l3im3coce1lL2cDeAjqmaR+Awx+X8Ih+2k8BuHNJ4CU= +github.com/lestrrat-go/jwx/v2 v2.0.21 h1:jAPKupy4uHgrHFEdjVjNkUgoBKtVDgrQPB/h55FHrR0= +github.com/lestrrat-go/jwx/v2 v2.0.21/go.mod h1:09mLW8zto6bWL9GbwnqAli+ArLf+5M33QLQPDggkUWM= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -581,14 +581,14 @@ github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/ github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw= github.com/mdlayher/socket v0.5.0 h1:ilICZmJcQz70vrWVes1MFera4jGiWNocSkykwwoy3XI= github.com/mdlayher/socket v0.5.0/go.mod h1:WkcBFfvyG8QENs5+hfQPl1X6Jpd2yeLIYgrGFmJiJxI= -github.com/meilisearch/meilisearch-go v0.26.1 h1:3bmo2uLijX7kvBmiZ9LupVfC95TFcRJDgrRTzbOoE4A= -github.com/meilisearch/meilisearch-go v0.26.1/go.mod h1:SxuSqDcPBIykjWz1PX+KzsYzArNLSCadQodWs8extS0= +github.com/meilisearch/meilisearch-go v0.26.2 h1:3gTlmiV1dHHumVUhYdJbvh3camiNiyqQ1hNveVsU2OE= +github.com/meilisearch/meilisearch-go v0.26.2/go.mod h1:SxuSqDcPBIykjWz1PX+KzsYzArNLSCadQodWs8extS0= github.com/metal-stack/go-ipam v1.8.5 h1:XE1XfaU6Ck1Ucc7svTO25dlT7kEcE1oxOM3lBrWIQmE= github.com/metal-stack/go-ipam v1.8.5/go.mod h1:JgsddJabu8A7lWD+4MJKqbQhmSA/zhBbO+Bp8pLhRZM= -github.com/metal-stack/masterdata-api v0.10.3 h1:Y/P3CU1b13a7oLmVYK6ZAHV2dMUYk+a3QWJQnXj+vRw= -github.com/metal-stack/masterdata-api v0.10.3/go.mod h1:ubIFC++2Csgx884Lol38AfY3MlAMlOXsTFHFIenI234= -github.com/metal-stack/metal-lib v0.14.4 h1:vm2868vcua6khoyWL7d0to8Hq5RayrjMse0FZTyWEec= -github.com/metal-stack/metal-lib v0.14.4/go.mod h1:Z3PAh8dkyWC4B19fXsu6EYwXXee0Lk9JZbjoHPLbDbc= +github.com/metal-stack/masterdata-api v0.11.1 h1:RRlML1bUS+aoPgMwbqWQazrlMOlLy2QbUoDwoUAJ6kY= +github.com/metal-stack/masterdata-api v0.11.1/go.mod h1:9T0UUAWU0+G2jKRFuA1mlTS2vexWiGdaBj1AJQGFQ6Q= +github.com/metal-stack/metal-lib v0.14.5 h1:qoD5w4oU8rVnhjEtfCgOdWho3OQCrVQnHl9Yj26kjeM= +github.com/metal-stack/metal-lib v0.14.5/go.mod h1:C2y2o2I4VQOc0lXbC2c+6WbL+3lcRfiV1TG/LpnpKrI= github.com/metal-stack/security v0.7.2 h1:kUdWej+a0+YPBGt4fT56Mu8cWX/tOjeKL/FWNlUuoe8= github.com/metal-stack/security v0.7.2/go.mod h1:dTidiZIEzZajwqizrOCTJbmjQSYVbe1tG52IoMlnKZo= github.com/metal-stack/v v1.0.3 h1:Sh2oBlnxrCUD+mVpzfC8HiqL045YWkxs0gpTvkjppqs= @@ -619,7 +619,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= @@ -659,8 +658,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= -github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -693,29 +692,29 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b h1:0LFwY6Q3gMACTjAbMZBjXAqTOzOwFaj2Ld6cjeQ7Rig= -github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= -github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= +github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.46.0 h1:doXzt5ybi1HBKpsZOL0sSkaNHJJqkyfEWZGGqqScV0Y= -github.com/prometheus/common v0.46.0/go.mod h1:Tp0qkxpb9Jsg54QMe+EAmqXkSV7Evdy1BTn+g2pa/hQ= +github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= +github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -725,8 +724,8 @@ github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= +github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= github.com/puzpuzpuz/xsync/v2 v2.5.1/go.mod h1:gD2H2krq/w52MfPLE+Uy64TzJDVY7lP2znR9qmR35kU= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -753,8 +752,8 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= -github.com/shirou/gopsutil/v3 v3.24.1 h1:R3t6ondCEvmARp3wxODhXMTLC/klMa87h2PHUw5m7QI= -github.com/shirou/gopsutil/v3 v3.24.1/go.mod h1:UU7a2MSBQa+kW1uuDq8DeEBS8kmrnQwsv2b5O513rwU= +github.com/shirou/gopsutil/v3 v3.24.2 h1:kcR0erMbLg5/3LcInpw0X/rrPSqq4CDPyI6A6ZRC18Y= +github.com/shirou/gopsutil/v3 v3.24.2/go.mod h1:tSg/594BcA+8UdQU2XcW803GWYgdtauFFPgJCJKZlVk= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -797,8 +796,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= -github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -810,8 +809,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -821,8 +821,8 @@ github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a h1:SJy1Pu0eH1C29X github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a/go.mod h1:DFSS3NAGHthKo1gTlmEcSBiZrRJXi28rLNd/1udP1c8= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= github.com/testcontainers/testcontainers-go v0.10.0/go.mod h1:zFYk0JndthnMHEwtVRHCpLwIP/Ik1G7mvIAQ2MdZ+Ig= -github.com/testcontainers/testcontainers-go v0.27.0 h1:IeIrJN4twonTDuMuBNQdKZ+K97yd7VrmNGu+lDpYcDk= -github.com/testcontainers/testcontainers-go v0.27.0/go.mod h1:+HgYZcd17GshBUZv9b+jKFJ198heWPQq3KQIp2+N+7U= +github.com/testcontainers/testcontainers-go v0.29.1 h1:z8kxdFlovA2y97RWx98v/TQ+tR+SXZm6p35M+xB92zk= +github.com/testcontainers/testcontainers-go v0.29.1/go.mod h1:SnKnKQav8UcgtKqjp/AD8bE1MqZm+3TDb/B8crE3XnI= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= @@ -851,18 +851,13 @@ github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= @@ -871,42 +866,38 @@ github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= -go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= -go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= +go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= +go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= -go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= -go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU= -go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= -go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= -go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= -go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= -go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= -go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= go4.org/intern v0.0.0-20210108033219-3eb7198706b2/go.mod h1:vLqJ+12kCw61iCWsPto0EOHhBS+o4rO5VIucbc9g2Cc= go4.org/intern v0.0.0-20230205224052-192e9f60865c h1:b8WZ7Ja8nKegYxfwDLLwT00ZKv4lXAQrw8LYPK+cHSI= go4.org/intern v0.0.0-20230205224052-192e9f60865c/go.mod h1:RJ0SVrOMpxLhgb5noIV+09zI1RsRlMsbUcSxpWHqbrE= @@ -927,18 +918,17 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw= golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -957,9 +947,10 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1000,15 +991,16 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1093,15 +1085,17 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1113,6 +1107,7 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1159,8 +1154,9 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= -golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1209,12 +1205,10 @@ google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= -google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= -google.golang.org/genproto/googleapis/api v0.0.0-20240213162025-012b6fc9bca9 h1:4++qSzdWBUy9/2x8L5KZgwZw+mjJZ2yDSCGMVM0YzRs= -google.golang.org/genproto/googleapis/api v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:PVreiBMirk8ypES6aw9d4p6iiBNSIfZEBqr3UGoAi2E= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 h1:hZB7eLIaYlW9qXRfCq/qDaPdbeY3757uARz5Vvfv+cY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:YUWgXUFRPfoYK1IHMuxH5K6nPEXSCzIMljnQ59lLRCk= +google.golang.org/genproto/googleapis/api v0.0.0-20240304212257-790db918fca8 h1:8eadJkXbwDEMNwcB5O0s5Y5eCfyuCLdvaiOIaGTrWmQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240304212257-790db918fca8/go.mod h1:O1cOfN1Cy6QEYr7VxtjOyP5AdAuR0aJ/MYZaaof623Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 h1:IR+hp6ypxjH24bkMfEJ0yHR21+gwPWdV+/IBrPQyn3k= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1230,8 +1224,8 @@ google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= -google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1244,8 +1238,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/cenkalti/backoff.v2 v2.2.1 h1:eJ9UAg01/HIHG987TwxvnzK2MgxXq97YY6rYDpY9aII= diff --git a/test/integration.go b/test/integration.go index 1395d3fab..9411d019e 100644 --- a/test/integration.go +++ b/test/integration.go @@ -28,7 +28,7 @@ func StartRethink(t testing.TB) (container testcontainers.Container, c *Connecti log = testcontainers.TestLogger(t) } req := testcontainers.ContainerRequest{ - Image: "rethinkdb:2.4.0", + Image: "rethinkdb:2.4.4-bookworm-slim", ExposedPorts: []string{"8080/tcp", "28015/tcp"}, Env: map[string]string{"RETHINKDB_PASSWORD": "rethink"}, WaitingFor: wait.ForAll( @@ -67,7 +67,7 @@ func StartRethink(t testing.TB) (container testcontainers.Container, c *Connecti func StartPostgres() (container testcontainers.Container, c *ConnectionDetails, err error) { ctx := context.Background() req := testcontainers.ContainerRequest{ - Image: "postgres:13-alpine", + Image: "postgres:16-alpine", ExposedPorts: []string{"5432/tcp"}, Env: map[string]string{"POSTGRES_PASSWORD": "password"}, WaitingFor: wait.ForAll( @@ -113,7 +113,7 @@ func StartMeilisearch(t testing.TB) (container testcontainers.Container, c *Conn meiliContainer, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ ContainerRequest: testcontainers.ContainerRequest{ - Image: "getmeili/meilisearch:v1.1.1", + Image: "getmeili/meilisearch:v1.3.4", ExposedPorts: []string{"7700/tcp"}, Env: map[string]string{ "MEILI_MASTER_KEY": meilisearchMasterKey,