Skip to content

Support limiting stats number per scope#42168

Merged
kyessenov merged 9 commits into
envoyproxy:mainfrom
TAOXUY:cardinality
Jan 22, 2026
Merged

Support limiting stats number per scope#42168
kyessenov merged 9 commits into
envoyproxy:mainfrom
TAOXUY:cardinality

Conversation

@TAOXUY
Copy link
Copy Markdown
Contributor

@TAOXUY TAOXUY commented Nov 21, 2025

Commit Message: add support for limiting the max number of stats(counter/gauge/histogram) per scope. This helps with memory explosion caused by high cardinality stats.
Risk Level: low
Testing: unit test covered
Docs Changes: no doc update as it is a library support for internal usage
Release Notes: updated
Platform Specific Features: no

@TAOXUY
Copy link
Copy Markdown
Contributor Author

TAOXUY commented Nov 21, 2025

@kyessenov

@TAOXUY TAOXUY changed the title Support limiting stats cardinality per scope Support limiting stats number per scope Nov 21, 2025
Comment thread source/common/stats/isolated_store_impl.h Outdated
@adisuissa
Copy link
Copy Markdown
Contributor

Assigning @kyessenov for a first-pass review.
/assign @kyessenov

@TAOXUY
Copy link
Copy Markdown
Contributor Author

TAOXUY commented Nov 25, 2025

/retest

@phlax
Copy link
Copy Markdown
Member

phlax commented Dec 8, 2025

@TAOXUY needs main merge

@kyessenov i think this is awaiting further review

@kyessenov
Copy link
Copy Markdown
Contributor

Sorry for the delay. Jason is on my team, and we chat offline about it.
/wait

Copy link
Copy Markdown
Contributor

@kyessenov kyessenov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main comment is that I'm not sure we can get away with per-scope limit - you can have multiple scopes per listener, and we need some way to impose a global limit since this is ultimately a global constraint. Otherwise, implementation is fine, but we need public doc for the new overflow stat.

Comment thread envoy/stats/scope.h Outdated
Comment thread envoy/stats/scope.h Outdated
Comment thread source/common/stats/thread_local_store.cc Outdated
Comment thread source/common/stats/thread_local_store.cc Outdated
Comment thread source/common/stats/thread_local_store.cc
Comment thread source/common/stats/thread_local_store.cc
@TAOXUY
Copy link
Copy Markdown
Contributor Author

TAOXUY commented Jan 10, 2026

/retest

Copy link
Copy Markdown
Contributor

@kyessenov kyessenov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there!

Comment thread changelogs/current.yaml Outdated
Comment thread docs/root/configuration/observability/statistics.rst Outdated
Comment thread source/common/stats/isolated_store_impl.cc Outdated
Comment thread source/common/stats/isolated_store_impl.h Outdated
Comment thread source/common/stats/thread_local_store.cc
Comment thread source/common/stats/thread_local_store.cc Outdated
Comment thread source/common/stats/thread_local_store.cc
Comment thread source/common/stats/thread_local_store.cc
Comment thread source/common/stats/thread_local_store.cc Outdated
@kyessenov
Copy link
Copy Markdown
Contributor

/wait

@TAOXUY
Copy link
Copy Markdown
Contributor Author

TAOXUY commented Jan 18, 2026

/wait

Have to force push after rebasing. @kyessenov you can see the last commit for the diff.

@TAOXUY
Copy link
Copy Markdown
Contributor Author

TAOXUY commented Jan 19, 2026

/retest

Comment thread source/common/stats/thread_local_store.cc
@TAOXUY
Copy link
Copy Markdown
Contributor Author

TAOXUY commented Jan 21, 2026

/retest

Signed-off-by: Xuyang Tao <taoxuy@google.com>
Signed-off-by: Xuyang Tao <taoxuy@google.com>
Signed-off-by: Xuyang Tao <taoxuy@google.com>
Signed-off-by: Xuyang Tao <taoxuy@google.com>
Signed-off-by: Xuyang Tao <taoxuy@google.com>
Signed-off-by: Xuyang Tao <taoxuy@google.com>
Signed-off-by: Xuyang Tao <taoxuy@google.com>
Signed-off-by: Xuyang Tao <taoxuy@google.com>
@TAOXUY
Copy link
Copy Markdown
Contributor Author

TAOXUY commented Jan 21, 2026

/retest

kyessenov
kyessenov previously approved these changes Jan 22, 2026
Signed-off-by: Xuyang Tao <taoxuy@google.com>
@TAOXUY
Copy link
Copy Markdown
Contributor Author

TAOXUY commented Jan 22, 2026

/retest

@kyessenov kyessenov merged commit 7746944 into envoyproxy:main Jan 22, 2026
25 checks passed
shane-yuan pushed a commit to shane-yuan/envoy that referenced this pull request Feb 11, 2026
Commit Message: add support for limiting the max number of
stats(counter/gauge/histogram) per scope. This helps with memory
explosion caused by high cardinality stats.
Risk Level: low
Testing: unit test covered
Docs Changes: no doc update as it is a library support for internal
usage
Release Notes: updated
Platform Specific Features: no

---------

Signed-off-by: Xuyang Tao <taoxuy@google.com>
grnmeira pushed a commit to grnmeira/envoy that referenced this pull request Mar 20, 2026
Commit Message: add support for limiting the max number of
stats(counter/gauge/histogram) per scope. This helps with memory
explosion caused by high cardinality stats.
Risk Level: low
Testing: unit test covered
Docs Changes: no doc update as it is a library support for internal
usage
Release Notes: updated
Platform Specific Features: no

---------

Signed-off-by: Xuyang Tao <taoxuy@google.com>
Signed-off-by: Gustavo <grnmeira@gmail.com>
wbpcode pushed a commit to wbpcode/envoy that referenced this pull request Mar 23, 2026
Commit Message: add support for limiting the max number of
stats(counter/gauge/histogram) per scope. This helps with memory
explosion caused by high cardinality stats.
Risk Level: low
Testing: unit test covered
Docs Changes: no doc update as it is a library support for internal
usage
Release Notes: updated
Platform Specific Features: no

---------

Signed-off-by: Xuyang Tao <taoxuy@google.com>
wbpcode pushed a commit to wbpcode/envoy that referenced this pull request Mar 27, 2026
Commit Message: add support for limiting the max number of
stats(counter/gauge/histogram) per scope. This helps with memory
explosion caused by high cardinality stats.
Risk Level: low
Testing: unit test covered
Docs Changes: no doc update as it is a library support for internal
usage
Release Notes: updated
Platform Specific Features: no

---------

Signed-off-by: Xuyang Tao <taoxuy@google.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.

4 participants