apache / apache/dubbo-go

[Observability] Add dynamic log-level regression tests for trace-aware Zap and Logrus loggers

Open
#3,721 2 comments 0 reactions 1 assignee Claimed by @AsperforMias View on GitHub
✏️ Feature 3.3.3
Dominant language
Go
Stars
5k
Forks
1k
Avg merge
3d 6h
Merged PRs (30d)
29

Description

## Parent and scope

Parent roadmap: #3562, Workstream 2 — verify that trace integration preserves dynamic logger controls.

The logger integration has existed since #3195. The historical concern in #3292 needs a current behavioral regression test, not an assumption that the API is missing.

At the triage baseline `develop@5f54b6a8cc9702abb320aa324784176689878ed0`, both `ZapCtxLogger` and `LogrusCtxLogger` embed `*gost.DubboLogger`. The pinned gost v1.14.5 already provides `SetLoggerLevel`, so the method can be promoted through the wrapper. Existing facade mocks and fixed-level context-logger tests do not establish runtime level-change behavior for the real adapters.

## Deliverables

- [ ] Add table-driven behavioral coverage for both Zap and Logrus with trace integration enabled, using the existing logger factory/facade paths where applicable.
- [ ] Change the level on the same logger instance from info to debug to warn. Assert actual captured output: debug is initially suppressed, becomes visible after the change, and info/debug are suppressed at warn.
- [ ] Exercise both ordinary logging methods and context-aware methods, including representative formatted calls.
- [ ] Verify invalid levels report failure and preserve the previous effective threshold.
- [ ] For context-aware calls that are emitted, assert the exact trace ID, span ID and trace flags from a deterministic valid span context. Verify a context without a valid span does not introduce bogus correlation fields.
- [ ] Restore global logger state after facade tests and avoid parallel tests that mutate that shared state.

## Acceptance criteria

Tests must use real adapters and captured output, not only mocked `SetLoggerLevel` return values. Use deterministic in-memory fixtures with no external Collector/backend or timing sleeps. Tests should detect an ignored level update or lost context correlation.

Run the relevant logger package tests and race checks with the repository-supported toolchain; report the commands and results in the PR. If the tests expose a defect, provide a focused reproducer and the smallest compatibility fix. A new bug is not presumed by this issue.

## Starting points and boundaries

Start with `logger/logger.go`, `logger/core/zap/{zap.go,ctx_logger.go,ctx_logger_test.go}`, `logger/core/logrus/{logrus.go,ctx_logger.go,ctx_logger_test.go}`, and gost's `log/logger/logger.go`.

Do not change default logging/filter activation (#3568), RPC error taxonomy, span lifecycle/propagation (#3338 / #3551), or AccessLog shutdown (#3701).

The [2026-09-05 weekly report](https://github.com/apache/dubbo-go/discussions/3719) retains umbrella observability owners. As of 2026-09-07, no separate public claim or open PR was found for this specific regression-test task. It is initially unassigned.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.