diff --git a/localstack-core/localstack/utils/analytics/metrics.py b/localstack-core/localstack/utils/analytics/metrics.py index e0fa8d47048d9..87a52e593547e 100644 --- a/localstack-core/localstack/utils/analytics/metrics.py +++ b/localstack-core/localstack/utils/analytics/metrics.py @@ -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 diff --git a/tests/unit/utils/analytics/test_metrics.py b/tests/unit/utils/analytics/test_metrics.py index bad18c47657a0..cc15499768381 100644 --- a/tests/unit/utils/analytics/test_metrics.py +++ b/tests/unit/utils/analytics/test_metrics.py @@ -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"], )