Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor: reduce max number of allowed labels in counters from 8 to 6 [DAT-146] #12704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions localstack-core/localstack/utils/analytics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ def __init__(self, namespace: str, name: str, labels: list[str]):
if any(not label for label in labels):
raise ValueError("Labels must be non-empty strings.")

if len(labels) > 8:
raise ValueError("A maximum of 8 labels are allowed.")
if len(labels) > 6:
raise ValueError("Too many labels: counters allow a maximum of 6.")

self._type = "counter"
self._labels = labels
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/utils/analytics/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ def increment():


def test_max_labels_limit():
with pytest.raises(ValueError, match="A maximum of 8 labels are allowed."):
with pytest.raises(ValueError, match="Too many labels: counters allow a maximum of 6."):
Counter(
namespace="test_namespace",
name="test_counter",
labels=["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8", "l9"],
labels=["l1", "l2", "l3", "l4", "l5", "l6", "l7"],
)


Expand Down
Loading