Repository navigation
fix(collector): warn once per subscription on missing content ID - #133
riccardo-negri wants to merge 2 commits into
Conversation
Push-updates for a subscription the collector could not resolve (it never saw the subscription-started, and the lookup by subscription ID failed) carry no content ID. Every such message fell back to the default schema and logged a WARN, so NetCalyx logged hundreds of these per minute.
28d8b1e to
76e9d65
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A moderate active issue remains because the deduplication key can suppress missing-content warnings for later subscription generations, so warnings are not reliably emitted once per subscription.
1 open issue
What changed in this PR
This pull request reduces repeated YANG Push warnings for unresolved content IDs by preserving subscription context and deduplicating warnings per peer/subscription pair.
Changes:
- Makes subscription metadata mandatory in the converter interface.
- Adds peer and subscription context to metrics and warning logs.
- Suppresses repeated missing-content-ID warnings while retaining fallback metrics.
| File | Description |
|---|---|
| crates/collector/src/yang_push/config.rs | Returns the enriched notification's subscription metadata directly instead of mapping empty values to None. |
| crates/collector/src/publishers/kafka_yang.rs | Updates converter and telemetry interfaces and adds deduplication for missing-content-ID warnings. |
Review effort: Lite
|
wouldn't it be nice to still have some logs that this is still happening? you could log 1/1000 msgs or something like this |
|
or later add a way to dump the new hashset so we can quickly see which subscriptions are doing schema_fallback |
|
@mxyns could you take a look again? In the future we can add a command to dump the hashset via the admin_api, but I would not do it in this PR. |
mxyns
left a comment
There was a problem hiding this comment.
looks good to me 🙂
i prefer this time based approach where logs are not suppressed forever
i still think resetting when we get a subscriptionstarted/modified (even though you might miss them) would be cool. you could then know directly for new (reconfigured) suscriptions if you miss it or not instead of having to wait for the rest of the 60mins.
at least now we will eventually get a warn and we can always implement a reset command with the admin_api if we need it (it could even do a reset action) 🙂
There was a problem hiding this comment.
Makes sense to avoid flooding with warns in general. In the future however as part of @ustorbeck work the whole contept of content_id optional will go away. Only valid yang messages will be sent to the yang topic, everything else to the json one.
Since you did the work now I would still merge now, but I'd not do additional customization on this throttling since we will remove it.

Push-updates for a subscription the collector could not resolve (it never saw the subscription-started, and the lookup by subscription ID failed) carry no content ID. Every such message fell back to the default schema and logged a WARN, so NetCalyx logged hundreds of these per minute.
The warning is now throttled per subscription (peer IP, subscription ID): it is logged at most once every 60 minutes for each subscription. The schema_fallbacks counter still counts every fallback, so the volume stays visible in the metrics. If a message for that subscription arrives with a content ID, the throttle is reset, so the warning fires immediately if the content ID goes missing again.
The throttle is time-based rather than once per subscription because routers reuse subscription IDs. A new subscription with the same ID would otherwise never be warned about. Resetting on subscription-started/modified notifications doesn't fix this reliably either: the warning happens mostly when the collector missed those notifications in the first place. Entries older than the interval are pruned whenever a warning is logged, so the map only holds subscriptions that warned recently.
The converter also mapped empty subscription info to None, so the warning and the publisher metrics showed no peer and no subscription ID. This was not needed as EnrichedNotification.subscription_info is not optional and we always get a filled SubscriptionInfo.