Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2023-09-25 12:55:10 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-09-29 09:01:44 +0300
commit9a5893ddba90a1e8e2ebb743042cbacdce74b468 (patch)
tree1807b402439540cfa69b278091ec2dc1660ecd16 /internal/praefect
parentabbea97311cbc4fd77c565b561d2af3e0c0197b4 (diff)
global: Trivial conversions to use context-aware logging
Start using the new context-aware logging facilities in places where we have a logger available.
Diffstat (limited to 'internal/praefect')
-rw-r--r--internal/praefect/datastore/storage_provider_test.go13
-rw-r--r--internal/praefect/service/server/info.go3
2 files changed, 8 insertions, 8 deletions
diff --git a/internal/praefect/datastore/storage_provider_test.go b/internal/praefect/datastore/storage_provider_test.go
index 0a01348b3..758524660 100644
--- a/internal/praefect/datastore/storage_provider_test.go
+++ b/internal/praefect/datastore/storage_provider_test.go
@@ -25,13 +25,14 @@ func TestCachingStorageProvider_GetSyncedNodes(t *testing.T) {
db := testdb.New(t)
rs := NewPostgresRepositoryStore(db, nil)
+ logger := testhelper.SharedLogger(t)
t.Run("unknown virtual storage", func(t *testing.T) {
ctx := testhelper.Context(t)
require.NoError(t, rs.CreateRepository(ctx, 1, "unknown", "/repo/path", "replica-path", "g1", []string{"g2", "g3"}, nil, true, false))
- cache, err := NewCachingConsistentStoragesGetter(log.FromContext(ctx), rs, []string{"vs"})
+ cache, err := NewCachingConsistentStoragesGetter(logger, rs, []string{"vs"})
require.NoError(t, err)
cache.Connected()
@@ -55,7 +56,7 @@ func TestCachingStorageProvider_GetSyncedNodes(t *testing.T) {
require.NoError(t, rs.CreateRepository(ctx, 1, "vs", "/repo/path", "replica-path", "g1", []string{"g2", "g3"}, nil, true, false))
- cache, err := NewCachingConsistentStoragesGetter(log.FromContext(ctx), rs, []string{"vs"})
+ cache, err := NewCachingConsistentStoragesGetter(logger, rs, []string{"vs"})
require.NoError(t, err)
cache.Connected()
@@ -180,7 +181,7 @@ func TestCachingStorageProvider_GetSyncedNodes(t *testing.T) {
require.NoError(t, rs.CreateRepository(ctx, 1, "vs", "/repo/path/1", "replica-path-1", "g1", []string{"g2", "g3"}, nil, true, false))
require.NoError(t, rs.CreateRepository(ctx, 2, "vs", "/repo/path/2", "replica-path-2", "g1", []string{"g2"}, nil, true, false))
- cache, err := NewCachingConsistentStoragesGetter(log.FromContext(ctx), rs, []string{"vs"})
+ cache, err := NewCachingConsistentStoragesGetter(logger, rs, []string{"vs"})
require.NoError(t, err)
cache.Connected()
@@ -230,7 +231,7 @@ func TestCachingStorageProvider_GetSyncedNodes(t *testing.T) {
require.NoError(t, rs.CreateRepository(ctx, 1, "vs", "/repo/path", "replica-path", "g1", []string{"g2", "g3"}, nil, true, false))
- cache, err := NewCachingConsistentStoragesGetter(log.FromContext(ctx), rs, []string{"vs"})
+ cache, err := NewCachingConsistentStoragesGetter(logger, rs, []string{"vs"})
require.NoError(t, err)
cache.Connected()
@@ -266,7 +267,7 @@ func TestCachingStorageProvider_GetSyncedNodes(t *testing.T) {
require.NoError(t, rs.CreateRepository(ctx, 1, "vs", "/repo/path/1", "replica-path-1", "g1", nil, nil, true, false))
require.NoError(t, rs.CreateRepository(ctx, 2, "vs", "/repo/path/2", "replica-path-2", "g1", nil, nil, true, false))
- cache, err := NewCachingConsistentStoragesGetter(log.FromContext(ctx), rs, []string{"vs"})
+ cache, err := NewCachingConsistentStoragesGetter(logger, rs, []string{"vs"})
require.NoError(t, err)
cache.Connected()
@@ -331,7 +332,7 @@ func TestCachingStorageProvider_GetSyncedNodes(t *testing.T) {
},
}
- cache, err := NewCachingConsistentStoragesGetter(log.FromContext(ctx), mockRepositoryStore, []string{"storage-1", "storage-2"})
+ cache, err := NewCachingConsistentStoragesGetter(logger, mockRepositoryStore, []string{"storage-1", "storage-2"})
require.NoError(t, err)
cache.Connected()
diff --git a/internal/praefect/service/server/info.go b/internal/praefect/service/server/info.go
index 644007a37..5ce46d28b 100644
--- a/internal/praefect/service/server/info.go
+++ b/internal/praefect/service/server/info.go
@@ -6,7 +6,6 @@ import (
"github.com/google/uuid"
"gitlab.com/gitlab-org/gitaly/v16/internal/grpc/metadata"
- "gitlab.com/gitlab-org/gitaly/v16/internal/log"
"gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"
"google.golang.org/grpc"
)
@@ -52,7 +51,7 @@ func (s *Server) ServerInfo(ctx context.Context, in *gitalypb.ServerInfoRequest)
client := gitalypb.NewServerServiceClient(conn)
resp, err := client.ServerInfo(ctx, &gitalypb.ServerInfoRequest{})
if err != nil {
- log.FromContext(ctx).WithField("storage", storage).WithError(err).Error("error getting server info")
+ s.logger.WithField("storage", storage).WithError(err).ErrorContext(ctx, "error getting server info")
return
}