centive-sdk 2.2.0.dev4__py3-none-any.whl → 2.2.0.dev5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- centive_sdk/resources/async_sessions.py +13 -0
- centive_sdk/resources/telemetry_batcher.py +26 -7
- {centive_sdk-2.2.0.dev4.dist-info → centive_sdk-2.2.0.dev5.dist-info}/METADATA +1 -1
- {centive_sdk-2.2.0.dev4.dist-info → centive_sdk-2.2.0.dev5.dist-info}/RECORD +6 -6
- {centive_sdk-2.2.0.dev4.dist-info → centive_sdk-2.2.0.dev5.dist-info}/WHEEL +0 -0
- {centive_sdk-2.2.0.dev4.dist-info → centive_sdk-2.2.0.dev5.dist-info}/licenses/LICENSE +0 -0
|
@@ -416,6 +416,19 @@ class AsyncSessions:
|
|
|
416
416
|
error_detail = self._extract_error_message(response)
|
|
417
417
|
raise AuthError(f"Authentication failed: {error_detail}", request_id=request_id)
|
|
418
418
|
|
|
419
|
+
elif response.status_code == 404:
|
|
420
|
+
# Not transient, so it must not be retried: the route is
|
|
421
|
+
# absent on this deployment. That is the shape of a Centive
|
|
422
|
+
# backend older than the SDK — /anam/events does not exist
|
|
423
|
+
# before page tracking — and of a trigger-session for a user
|
|
424
|
+
# with no session in this org. Retrying either one three
|
|
425
|
+
# times, then opening a circuit breaker, spends requests and
|
|
426
|
+
# fills logs to reach the same answer.
|
|
427
|
+
error_detail = self._extract_error_message(response)
|
|
428
|
+
raise ValidationError(
|
|
429
|
+
f"Not found (404): {error_detail}", request_id=request_id
|
|
430
|
+
)
|
|
431
|
+
|
|
419
432
|
elif response.status_code in [400, 413, 422]:
|
|
420
433
|
# 413 is "payload over the API's size caps": retrying the
|
|
421
434
|
# same body cannot succeed, so it is a validation failure.
|
|
@@ -95,6 +95,7 @@ class TelemetryBatcher:
|
|
|
95
95
|
self._wake = asyncio.Event()
|
|
96
96
|
self._running = False
|
|
97
97
|
self._auth_error_logged = False
|
|
98
|
+
self._missing_endpoint_logged = False
|
|
98
99
|
self.on_context: Optional[ContextCallable] = None
|
|
99
100
|
|
|
100
101
|
# ------------------------------------------------------------------ state
|
|
@@ -246,15 +247,33 @@ class TelemetryBatcher:
|
|
|
246
247
|
safe_log(self._logger, "error", f"telemetry rejected: invalid API key ({e})")
|
|
247
248
|
return False
|
|
248
249
|
except ValidationError as e:
|
|
249
|
-
# 400 / 413 / 422:
|
|
250
|
+
# 400 / 404 / 413 / 422: the payload or the route was wrong, and
|
|
251
|
+
# retrying cannot change either.
|
|
250
252
|
self._stats.dropped_non_retryable += len(batch)
|
|
251
253
|
self._stats.last_error = "ValidationError"
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
254
|
+
if "(404)" in str(e):
|
|
255
|
+
# A Centive deployment older than this SDK: page tracking has
|
|
256
|
+
# no endpoint to reach there. Said once, plainly, because the
|
|
257
|
+
# fix is a backend upgrade and not something a retry reaches.
|
|
258
|
+
# Not fatal: everything else the SDK does still works, and a
|
|
259
|
+
# rolling upgrade can bring the endpoint up under us, so later
|
|
260
|
+
# batches keep trying quietly.
|
|
261
|
+
if not self._missing_endpoint_logged:
|
|
262
|
+
self._missing_endpoint_logged = True
|
|
263
|
+
safe_log(
|
|
264
|
+
self._logger,
|
|
265
|
+
"warning",
|
|
266
|
+
"this Centive deployment has no product-events endpoint; page "
|
|
267
|
+
"events are being discarded. Everything else is unaffected. "
|
|
268
|
+
"Set telemetry_enabled=False to stop sending them.",
|
|
269
|
+
)
|
|
270
|
+
else:
|
|
271
|
+
safe_log(
|
|
272
|
+
self._logger,
|
|
273
|
+
"warning",
|
|
274
|
+
f"telemetry batch rejected by API, dropped: {e}",
|
|
275
|
+
{"events": len(batch)},
|
|
276
|
+
)
|
|
258
277
|
return True
|
|
259
278
|
except Exception as e: # unknown: treat as retryable but bounded by the breaker
|
|
260
279
|
self._breaker.record_failure()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: centive-sdk
|
|
3
|
-
Version: 2.2.0.
|
|
3
|
+
Version: 2.2.0.dev5
|
|
4
4
|
Summary: Python SDK for Centive backend integration
|
|
5
5
|
Project-URL: Homepage, https://github.com/TheAgenticAI/centive-backend-sdk
|
|
6
6
|
Project-URL: Repository, https://github.com/TheAgenticAI/centive-backend-sdk
|
|
@@ -11,13 +11,13 @@ centive_sdk/models/__init__.py,sha256=-ledNpbOi1Q14ELhvlDbGPF37N3yv5XJ-QsH2I6UMV
|
|
|
11
11
|
centive_sdk/models/requests.py,sha256=6KW5KEjyMAy-DAppTssu5b-LSf1doKtMnOfng5O3tNc,7153
|
|
12
12
|
centive_sdk/models/responses.py,sha256=zCYPB0aL2DXn-z0Febkuxo3DdZ_5sdpdGy2Jtf8Ubs8,2519
|
|
13
13
|
centive_sdk/resources/__init__.py,sha256=GLutz38X4F4FwPfSZy35EkWTV7l7t9RgcBKwXmz2X_Y,179
|
|
14
|
-
centive_sdk/resources/async_sessions.py,sha256=
|
|
14
|
+
centive_sdk/resources/async_sessions.py,sha256=m0_gj2wLabs3BTe6rZuo9WGgSwEMJLmdKW8_s4T7KRM,21500
|
|
15
15
|
centive_sdk/resources/async_telemetry.py,sha256=wT12g9rG2dp_ml5YpAYCxobLlhfcsyy-LHty4bwwFZI,2431
|
|
16
16
|
centive_sdk/resources/message_accumulator.py,sha256=Or3sMGkXG9upeQ9sm8YWL_V5vvsxtnE9tu52VBUUGgY,19261
|
|
17
17
|
centive_sdk/resources/sessions.py,sha256=Ipg4bpmpejA5WoALbT49ah0c3I7x4OgPn9tSmfW8JAw,16741
|
|
18
|
-
centive_sdk/resources/telemetry_batcher.py,sha256=
|
|
18
|
+
centive_sdk/resources/telemetry_batcher.py,sha256=OkOv2Iir6E_9mdtAKvelol3RaveGSlH-ckIoE2cQYCc,14629
|
|
19
19
|
centive_sdk/resources/websocket_server.py,sha256=iGS48oB4myV-sI0nArlBE3Y0fe_GlfBClFtVAPzrvdU,59760
|
|
20
|
-
centive_sdk-2.2.0.
|
|
21
|
-
centive_sdk-2.2.0.
|
|
22
|
-
centive_sdk-2.2.0.
|
|
23
|
-
centive_sdk-2.2.0.
|
|
20
|
+
centive_sdk-2.2.0.dev5.dist-info/METADATA,sha256=6hTQ3pohxlZnB5dEEwBLq5vngFLK5LhX7NXgPMp9HOM,36427
|
|
21
|
+
centive_sdk-2.2.0.dev5.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
22
|
+
centive_sdk-2.2.0.dev5.dist-info/licenses/LICENSE,sha256=9dFibPr7z9srhWwd35lQL2MX1Kx2qivEZdVQb9L8Q-Q,1064
|
|
23
|
+
centive_sdk-2.2.0.dev5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|