Skip to content

Enhance counter polling implementation#73

Merged
r12f merged 1 commit intoAzure:202412from
justin-wong-ce:counterEnhance
Aug 4, 2025
Merged

Enhance counter polling implementation#73
r12f merged 1 commit intoAzure:202412from
justin-wong-ce:counterEnhance

Conversation

@justin-wong-ce
Copy link
Copy Markdown
Contributor

Add feature to allow different sets of supported counters for different interfaces.

Currently, if an interface has less supported counters than other interfaces on a switch, the interface with fewer supported counters will not have their counters polled to COUNTERS_DB - it will remain as a N/A in show interface counters.

This change will allow counters to be polled successfully for those interfaces with fewer supported counters by recognizing what can be polled and what cannot be when syncd initializes.

Instead of directly modifying existing functions, parallel functions are created with the new logic that uses the new data structures std::map<sai_object_id_t, size_t> m_objectSupportedCountersGroupMap and std::vector<std::set<StatType>> m_supportedCounterGroups. This is so that in the case the new method fails initialisation, it will fallback to the old method.

The parallel methods are:

bulkAddObject -> bulkAddObjectWithCounterGroups
addObject -> addObjectWithCounterGroups
updateSupportedCounters -> updateSupportedCounterGroups

This change does not involve BulkStatContext code path. However, the data structure it relies on is no longer populated in the parallel functions. It will use the largest CounterGroup in m_supportedCounterGroups instead of m_supportedCounters.

Testing: WIP. Review opened first for early feedback.

Add feature to allow different sets of supported counters for different
interfaces.

Currently, if an interface has less supported counters than other
interfaces on a switch, the interface with fewer supported counters will
not have their counters polled to COUNTERS_DB - it will remain as a
`N/A` in `show interface counters`.

This change will allow counters to be polled successfuly for those
interfaces with fewer supported counters by recognizing what can be
polled and what cannot be when syncd initializes.
@r12f r12f merged commit 6039c6b into Azure:202412 Aug 4, 2025
4 checks passed
mssonicbld added a commit that referenced this pull request Aug 5, 2025
```<br>* 4fd6cc6 - (HEAD -> 202503) Merge branch '202412' of https://github.com/Azure/sonic-sairedis.msft into 202503 (2025-08-05) [Sonic Automation]
* 6039c6b - (base/202412) Enhance counter polling implementation (#73) (2025-08-04) [Justin Wong]<br>```
r12f added a commit to r12f/sonic-sairedis.msft that referenced this pull request Aug 14, 2025
r12f added a commit that referenced this pull request Aug 15, 2025
mssonicbld added a commit that referenced this pull request Aug 16, 2025
```<br>* 7a3919d - (HEAD -> 202503) Merge branch '202412' of https://github.com/Azure/sonic-sairedis.msft into 202503 (2025-08-16) [Sonic Automation]
* 2b3cbce - (base/202412, test, 202412) Revert "Enhance counter polling implementation (#73)" (#81) (2025-08-14) [Riff]<br>```
yejianquan added a commit to sonic-net/sonic-swss that referenced this pull request Sep 3, 2025
…for-port-cntrs

Temporarily disable bulk init requests for PORT counters

Add temporary fix for https://github.com/aristanetworks/sonic-qual.msft/issues/655

This forces each port to be processed individually, avoiding capability mismatch between different ports in bulk requests

What I did
Temporarily disable bulk init requests for PORT counters.

Why I did it
When swss requests bulk initialization of PORT counters, corresponding component in sonic-sairedis assumes all the requested ports support same attributes, which is not the case for SFP/mgmt ports of Arista switches and was causing these ports to be completely skipped. This is supposed to be fixed by Azure/sonic-sairedis.msft#73 but it needs a re-work as its breaking non-Broadcom platform.

So, we're temporarily disabling this flow.

How I verified it
Verified countersDB is now having all the supported counters for SFP ports.

Details if related
relevant threads: #558, #629, 655

signed-off-by: jianquanye@microsoft.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants