{"record":{"id":"4effef29e9a1f2e4","repo":"netdata/netdata","slug":"protocols-sampling-cache-max-entries-per-stream-mu","errorCode":null,"errorMessage":"protocols.sampling_cache_max_entries_per_stream must be greater than 0","messagePattern":"protocols\\.sampling_cache_max_entries_per_stream must be greater than 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/crates/netflow-plugin/src/plugin_config/validation/listener.rs","lineNumber":46,"sourceCode":"        || cfg.protocols.ipfix\n        || cfg.protocols.sflow)\n    {\n        anyhow::bail!(\"at least one protocol must be enabled\");\n    }\n\n    if cfg\n        .protocols\n        .v9_template_lifetime\n        .get()\n        .is_some_and(|lifetime| lifetime.is_zero())\n    {\n        anyhow::bail!(\"protocols.v9_template_lifetime must be greater than 0 or null\");\n    }\n    if cfg.protocols.sampling_cache_max_entries == 0 {\n        anyhow::bail!(\"protocols.sampling_cache_max_entries must be greater than 0\");\n    }\n    if cfg.protocols.sampling_cache_max_entries_per_stream == 0 {\n        anyhow::bail!(\"protocols.sampling_cache_max_entries_per_stream must be greater than 0\");\n    }\n\n    Ok(())\n}\n","sourceCodeStart":28,"sourceCodeEnd":51,"githubUrl":"https://github.com/netdata/netdata/blob/4864de85e26f6734d92cfc27ccbeff5921f49938/src/crates/netflow-plugin/src/plugin_config/validation/listener.rs#L28-L51","documentation":"The per-stream companion to sampling_cache_max_entries bounds sampler cache entries keyed per observation stream (source observation domain / exporter stream). Like the global cap, 0 would make the cache unusable, so validate_listener_and_protocols() fails fast when it is 0.","triggerScenarios":"PluginConfig loaded with protocols.sampling_cache_max_entries_per_stream == 0 — set explicitly, defaulted from a missing key, or copy-pasted from a config block where the global entries were tuned to 0.","commonSituations":"Adjusting sampling cache settings and zeroing both fields; config generated for large deployments where the author misunderstood 0 as 'auto'; forgetting this second field exists after an upgrade split the single cache setting into global and per-stream.","solutions":["Set protocols.sampling_cache_max_entries_per_stream to a positive integer (e.g. 1000)","Keep it <= sampling_cache_max_entries so the per-stream cap is meaningful","If the key was absent, add it next to sampling_cache_max_entries under 'protocols:'"],"exampleFix":"# before\nprotocols:\n  sampling_cache_max_entries: 10000\n  sampling_cache_max_entries_per_stream: 0\n\n# after\nprotocols:\n  sampling_cache_max_entries: 10000\n  sampling_cache_max_entries_per_stream: 1000","handlingStrategy":"validation","validationCode":"fn per_stream_entries_ok(cfg: &PluginConfig) -> bool {\n    cfg.protocols.sampling_cache_max_entries_per_stream > 0\n        && cfg.protocols.sampling_cache_max_entries_per_stream <= cfg.protocols.sampling_cache_max_entries\n}","typeGuard":null,"tryCatchPattern":"Fatal config error; fix both sampling cache fields together.","preventionTips":["Tune the global and per-stream cache caps in the same edit","After upgrades, diff your config against the new stock config for added fields"],"tags":["rust","netdata","netflow","config","cache","validation"],"backgroundTag":null,"analyzedSha":"4864de85e26f6734d92cfc27ccbeff5921f49938","analyzedAt":"2026-08-15T09:12:38.226Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}