Skip to content

chore: track token issuer

Jan Provaznik requested to merge jp-track-direct into main

What does this merge request do and why?

Related to #428 (closed)

How to set up and validate locally

  1. Logging: verify that for incomming requests there is token_issuer included in logs
  2. Snowplow event: if no snowplow client is set, you can stub it with a snippet below and verify content of snowplow event in logs
diff --git a/ai_gateway/tracking/instrumentator.py b/ai_gateway/tracking/instrumentator.py
index 4e94d8d1..45754c3a 100644
--- a/ai_gateway/tracking/instrumentator.py
+++ b/ai_gateway/tracking/instrumentator.py
@@ -1,4 +1,5 @@
-from ai_gateway.tracking.snowplow import Client, SnowplowEvent
+import structlog
 
 __all__ = ["SnowplowInstrumentator"]
 
@@ -11,4 +12,6 @@ class SnowplowInstrumentator:
         self,
         snowplow_event: SnowplowEvent,
     ) -> None:
+        log = structlog.stdlib.get_logger("instrumentator")
+        log.debug("instrumentator:", ev1=snowplow_event)
         self.client.track(snowplow_event)

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
Edited by Jan Provaznik

Merge request reports