diff --git a/tests/unit-tests/client_telemetry_test.py b/tests/unit-tests/client_telemetry_test.py index 602b08c..4f627bd 100644 --- a/tests/unit-tests/client_telemetry_test.py +++ b/tests/unit-tests/client_telemetry_test.py @@ -36,7 +36,7 @@ def test_telemetry_headers(self): assert utils.PATTERNS_UUID4.match(headers1["x-xata-session-id"]) assert headers1["x-xata-client-id"] != headers1["x-xata-session-id"] assert "x-xata-agent" in headers1 - assert headers1["x-xata-agent"] == f"client=PY_SDK;version={__version__};" + assert headers1["x-xata-agent"] == f"client=PY_SDK; version={__version__}" api_key = "this-key-42" client2 = XataClient(api_key=api_key, workspace_id="ws_id") diff --git a/xata/client.py b/xata/client.py index 0c32c1b..1253c7a 100644 --- a/xata/client.py +++ b/xata/client.py @@ -127,7 +127,8 @@ def __init__( "connection": "keep-alive", "x-xata-client-id": str(uuid.uuid4()), "x-xata-session-id": str(uuid.uuid4()), - "x-xata-agent": f"client=PY_SDK;version={__version__};", + # the format is key1=value; key2=value (with spaces and no trailing ;) + "x-xata-agent": f"client=PY_SDK; version={__version__}", } # init namespaces diff --git a/xata/helpers.py b/xata/helpers.py index 608f5a4..f79d899 100644 --- a/xata/helpers.py +++ b/xata/helpers.py @@ -77,7 +77,7 @@ def __init__( raise Exception("batch size can not be less than one, default: %d" % BP_DEFAULT_BATCH_SIZE) self.client = client - telemetry = "%shelper=bp;v=%s" % (self.client.get_headers()["x-xata-agent"], BP_VERSION) + telemetry = "%s; helper=bp:%s" % (self.client.get_headers()["x-xata-agent"], BP_VERSION) self.client.set_header("x-xata-agent", telemetry) self.processing_timeout = processing_timeout @@ -321,7 +321,7 @@ def __init__( :param client: XataClient """ self.client = client - telemetry = "%shelper=trx;v=%s" % (self.client.get_headers()["x-xata-agent"], TRX_VERSION) + telemetry = "%s; helper=trx:%s" % (self.client.get_headers()["x-xata-agent"], TRX_VERSION) self.client.set_header("x-xata-agent", telemetry) self.logger = logging.getLogger(f"{__name__}.{self.__class__.__name__}")