Skip to content

Added prevention for telemetry post if counters are empty #592

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 2 commits into from
Aug 4, 2025
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
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
10.4.0 (Aug 1, 2025)
10.4.0 (Aug 4, 2025)
- Added a new optional argument to the client `getTreatment` methods to allow passing additional evaluation options, such as a map of properties to append to the generated impressions sent to Split backend. Read more in our docs.

10.3.0 (Jun 17, 2025)
Expand Down
16 changes: 16 additions & 0 deletions splitio/engine/impressions/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ async def record_unique_keys(self, uniques):
:param uniques: unique keys disctionary
:type uniques: Dictionary {'feature_flag1': set(), 'feature_flag2': set(), .. }
"""
if len(uniques) == 0:
return

await self._telemtry_http_client.record_unique_keys({'keys': self._uniques_formatter(uniques)})


Expand Down Expand Up @@ -184,6 +187,9 @@ async def record_unique_keys(self, uniques):
:param uniques: unique keys disctionary
:type uniques: Dictionary {'feature_flag1': set(), 'feature_flag2': set(), .. }
"""
if len(uniques) == 0:
return True

bulk_mtks = _uniques_formatter(uniques)
try:
inserted = await self._redis_client.rpush(_MTK_QUEUE_KEY, *bulk_mtks)
Expand All @@ -202,6 +208,9 @@ async def flush_counters(self, to_send):
:param to_send: unique keys disctionary
:type to_send: Dictionary {'feature_flag1': set(), 'feature_flag2': set(), .. }
"""
if len(to_send) == 0:
return True

try:
resulted = 0
counted = 0
Expand Down Expand Up @@ -277,6 +286,7 @@ def flush_counters(self, to_send):
"""
if len(to_send) == 0:
return

try:
resulted = 0
for pf_count in to_send:
Expand Down Expand Up @@ -325,6 +335,9 @@ async def record_unique_keys(self, uniques):
:param uniques: unique keys disctionary
:type uniques: Dictionary {'feature_flag1': set(), 'feature_flag2': set(), .. }
"""
if len(uniques) == 0:
return True

bulk_mtks = _uniques_formatter(uniques)
try:
inserted = await self._adapter_client.push_items(self._prefix + _MTK_QUEUE_KEY, *bulk_mtks)
Expand All @@ -343,6 +356,9 @@ async def flush_counters(self, to_send):
:param to_send: unique keys disctionary
:type to_send: Dictionary {'feature_flag1': set(), 'feature_flag2': set(), .. }
"""
if len(to_send) == 0:
return True

try:
resulted = 0
for pf_count in to_send:
Expand Down
Loading