Skip to content

Commit

Permalink
ir/node: disable log sampling
Browse files Browse the repository at this point in the history
The default Zap config is:

> Sampling is enabled at 100:100 by default, meaning that after the first 100 log entries with the same level and message in the same second, it will log every 100th entry with the same level and message in the same second. You may disable this behavior by setting Sampling to nil.

It leads to message loss too easily and we care a lot about each and every
object. Notice that it was disabled in NeoGo as well
in a52e016c22de2269fcc7362f33317cebfa7e8e4c (nspcc-dev/neo-go#598).

Signed-off-by: Roman Khimov <[email protected]>
  • Loading branch information
roman-khimov committed Nov 13, 2024
1 parent 007e992 commit 0ffbfc1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ attribute, which is used for container domain name in NNS contracts (#2954)
- Metabase is refilled if an object exists in write-cache but is missing in metabase (#2977)
- Pprof and metrics services stop at the end of SN's application lifecycle (#2976)
- Reject configuration with unknown fields (#2981)
- Log sampling is disabled by default now (#3011)

### Removed
- Support for node.key configuration (#2959)
Expand Down
1 change: 1 addition & 0 deletions cmd/neofs-ir/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func main() {
c := zap.NewProductionConfig()
c.Level = logLevel
c.Encoding = cfg.GetString("logger.encoding")
c.Sampling = nil

Check warning on line 69 in cmd/neofs-ir/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-ir/main.go#L69

Added line #L69 was not covered by tests
if term.IsTerminal(int(os.Stdout.Fd())) {
c.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
} else {
Expand Down
1 change: 1 addition & 0 deletions cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ func initCfg(appCfg *config.Config) *cfg {
logCfg := zap.NewProductionConfig()
logCfg.Level = c.internals.logLevel
logCfg.Encoding = c.logger.encoding
logCfg.Sampling = nil

Check warning on line 573 in cmd/neofs-node/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/config.go#L573

Added line #L573 was not covered by tests
if term.IsTerminal(int(os.Stdout.Fd())) {
logCfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
} else {
Expand Down

0 comments on commit 0ffbfc1

Please sign in to comment.