Skip to content

Commit 1383adc

Browse files
authored
Merge branch 'main' into dominik/eng-9263-utilize-engines-support-for-field-args-on-required-fields-on
2 parents 6dc5405 + 65efe37 commit 1383adc

File tree

5 files changed

+119
-5
lines changed

5 files changed

+119
-5
lines changed

router/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Binaries are attached to the github release otherwise all images can be found [h
44
All notable changes to this project will be documented in this file.
55
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
66

7+
## [0.301.1](https://github.com/wundergraph/cosmo/compare/router@0.301.0...router@0.301.1) (2026-04-07)
8+
9+
### Bug Fixes
10+
11+
* change failed query to debug instead of warn ([#2745](https://github.com/wundergraph/cosmo/issues/2745)) ([329e5cc](https://github.com/wundergraph/cosmo/commit/329e5cc13168e2aa87aa38bb04bc7fb34092bfae)) (@alepane21)
12+
* change failed request query parse log to warn instead of error ([#2743](https://github.com/wundergraph/cosmo/issues/2743)) ([09e4653](https://github.com/wundergraph/cosmo/commit/09e4653a6a38136a0ba4870d38c00d253b4b6cac)) (@alepane21)
13+
* make cache warmer debug logs info logs ([#2746](https://github.com/wundergraph/cosmo/issues/2746)) ([ef1f9cf](https://github.com/wundergraph/cosmo/commit/ef1f9cf48774f975ae5d6519d1bad28c78767211)) (@SkArchon)
14+
715
# [0.301.0](https://github.com/wundergraph/cosmo/compare/router@0.300.1...router@0.301.0) (2026-04-06)
816

917
### Features

router/core/cache_warmup.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func WarmupCaches(ctx context.Context, cfg *CacheWarmupConfig) (err error) {
6262
if cfg.Timeout <= 0 {
6363
w.timeout = time.Second * 30
6464
}
65-
w.log.Debug("Warmup started",
65+
w.log.Info("Warmup started",
6666
zap.Int("workers", cfg.Workers),
6767
zap.Int("items_per_second", cfg.ItemsPerSecond),
6868
zap.Duration("timeout", cfg.Timeout),
@@ -84,7 +84,7 @@ func WarmupCaches(ctx context.Context, cfg *CacheWarmupConfig) (err error) {
8484
)
8585
return err
8686
}
87-
w.log.Debug("Warmup completed",
87+
w.log.Info("Warmup completed",
8888
zap.Int("processed_items", completed),
8989
zap.Duration("duration", time.Since(start)),
9090
)
@@ -119,7 +119,7 @@ func (w *cacheWarmup) run(ctx context.Context) (int, error) {
119119
}
120120

121121
if len(items) == 0 {
122-
w.log.Debug("No items to process")
122+
w.log.Info("No items to process")
123123
return 0, nil
124124
}
125125

router/core/cache_warmup_test.go

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import (
77
"time"
88

99
"github.com/stretchr/testify/assert"
10+
"github.com/stretchr/testify/require"
1011
nodev1 "github.com/wundergraph/cosmo/router/gen/proto/wg/cosmo/node/v1"
1112
"go.uber.org/zap"
13+
"go.uber.org/zap/zapcore"
14+
"go.uber.org/zap/zaptest/observer"
1215
)
1316

1417
type CacheWarmupMockSource struct {
@@ -330,4 +333,107 @@ func TestCacheWarmup(t *testing.T) {
330333
assert.Len(t, processor.processedItems, 0)
331334
processor.mux.Unlock()
332335
})
336+
t.Run("logs warmup started and completed at info level", func(t *testing.T) {
337+
t.Parallel()
338+
core, logs := observer.New(zapcore.InfoLevel)
339+
logger := zap.New(core)
340+
source := &CacheWarmupMockSource{
341+
items: []*nodev1.Operation{
342+
{
343+
Request: &nodev1.OperationRequest{
344+
Query: "query { foo }",
345+
},
346+
},
347+
},
348+
}
349+
processor := &CacheWarmupMockProcessor{
350+
mux: sync.Mutex{},
351+
}
352+
cfg := &CacheWarmupConfig{
353+
Log: logger,
354+
Source: source,
355+
Processor: processor,
356+
ItemsPerSecond: 0,
357+
Workers: 2,
358+
Timeout: time.Second,
359+
}
360+
ctx, cancel := context.WithCancel(context.Background())
361+
defer cancel()
362+
err := WarmupCaches(ctx, cfg)
363+
require.NoError(t, err)
364+
365+
infoLogs := logs.FilterLevelExact(zapcore.InfoLevel)
366+
messages := make([]string, infoLogs.Len())
367+
for i, entry := range infoLogs.All() {
368+
messages[i] = entry.Message
369+
}
370+
require.Contains(t, messages, "Warmup started")
371+
require.Contains(t, messages, "Warmup completed")
372+
})
373+
t.Run("logs no items to process at info level", func(t *testing.T) {
374+
t.Parallel()
375+
core, logs := observer.New(zapcore.InfoLevel)
376+
logger := zap.New(core)
377+
source := &CacheWarmupMockSource{}
378+
processor := &CacheWarmupMockProcessor{
379+
mux: sync.Mutex{},
380+
}
381+
cfg := &CacheWarmupConfig{
382+
Log: logger,
383+
Source: source,
384+
Processor: processor,
385+
ItemsPerSecond: 0,
386+
Workers: 2,
387+
Timeout: time.Second,
388+
}
389+
ctx, cancel := context.WithCancel(context.Background())
390+
defer cancel()
391+
err := WarmupCaches(ctx, cfg)
392+
require.NoError(t, err)
393+
394+
infoLogs := logs.FilterLevelExact(zapcore.InfoLevel)
395+
messages := make([]string, infoLogs.Len())
396+
for i, entry := range infoLogs.All() {
397+
messages[i] = entry.Message
398+
}
399+
require.Contains(t, messages, "No items to process")
400+
})
401+
t.Run("warmup started and completed not logged at debug level", func(t *testing.T) {
402+
t.Parallel()
403+
// With a DebugLevel observer, Info messages are captured too,
404+
// but the key assertion is that the entries themselves are at InfoLevel, not DebugLevel.
405+
core, logs := observer.New(zapcore.DebugLevel)
406+
logger := zap.New(core)
407+
source := &CacheWarmupMockSource{
408+
items: []*nodev1.Operation{
409+
{
410+
Request: &nodev1.OperationRequest{
411+
Query: "query { foo }",
412+
},
413+
},
414+
},
415+
}
416+
processor := &CacheWarmupMockProcessor{
417+
mux: sync.Mutex{},
418+
}
419+
cfg := &CacheWarmupConfig{
420+
Log: logger,
421+
Source: source,
422+
Processor: processor,
423+
ItemsPerSecond: 0,
424+
Workers: 2,
425+
Timeout: time.Second,
426+
}
427+
ctx, cancel := context.WithCancel(context.Background())
428+
defer cancel()
429+
err := WarmupCaches(ctx, cfg)
430+
require.NoError(t, err)
431+
432+
// Verify that "Warmup started" and "Warmup completed" are logged at Info, not Debug
433+
for _, entry := range logs.All() {
434+
if entry.Message == "Warmup started" || entry.Message == "Warmup completed" || entry.Message == "No items to process" {
435+
require.Equal(t, zapcore.InfoLevel, entry.Level, "expected %q to be logged at Info level", entry.Message)
436+
}
437+
}
438+
})
333439
}

router/internal/requestlogger/requestlogger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func (al *accessLogger) getRequestFields(r *http.Request, logger *zap.Logger) []
233233
if err != nil {
234234
// We ignore logging the err since it could leak partial sensitive data
235235
// such as %pa from "%password"
236-
logger.Warn("Failed to parse query parameters")
236+
logger.Debug("Failed to parse query parameters")
237237
// Since we wanted to ignore some values but we cant parse it
238238
// we default to a safer skip all
239239
query = ""

router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "router",
3-
"version": "0.301.0",
3+
"version": "0.301.1",
44
"private": true,
55
"description": "The WunderGraph Router",
66
"keywords": [

0 commit comments

Comments
 (0)