konlue opened a new pull request, #7766:
URL: https://github.com/apache/shenyu/pull/7766
Fixes #7750.
## Summary
Clearing a selector's logging configuration (empty or `{}` handle) left the
previous entry in `SELECT_API_CONFIG_MAP`, and because `isSampled` prefers the
per-selector sampler over the global one, the stale rate kept applying after
the operator cleared the override.
## Modifications
- In `handlerSelector`, the empty/`{}` handle branch now removes the
selector's entry from `SELECT_API_CONFIG_MAP` (same semantics as
`removeSelector`), so sampling falls back to the global/default configuration.
- Add `AbstractLogPluginDataHandlerTest` with a minimal concrete subclass:
`{}` and blank handles clear the stale entry; a configured handle is still
stored (regression).
## Verifying this change
- [x] Red-green: with the removal line removed,
`testHandlerSelectorClearsStaleEntryOnEmptyHandle` fails (the stale entry
survives); with the fix, 3/3 pass.
- [x] Full module tests pass:
```bash
./mvnw -B -ntp -pl
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common test
```
full module green, no regressions.
- [x] Checkstyle passes:
```bash
./mvnw -B -ntp -pl
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common
checkstyle:check
```
clean.
## Notes
Before this change, "clearing the override" was a no-op on the data-sync
path; now it restores global sampling, which is the behaviour the issue
expects. Client-resource lifecycle is untouched — `logCollector().close()`
remains confined to the plugin-enabled branch, so sampling-map cleanup and
collector ownership stay decoupled.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]