Skip to content

Commit 1633b5e

Browse files
committed
revert always adding | in case telemetry cant parse it
1 parent b5314ab commit 1633b5e

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

pymongo/pool_options.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -393,19 +393,18 @@ def _update_metadata(self, driver: DriverInfo) -> None:
393393

394394
metadata = copy.deepcopy(self.__metadata)
395395

396-
name = driver.name or ""
397-
version = driver.version or ""
398-
platform = driver.platform or ""
399-
400-
metadata["driver"]["name"] = "{}|{}".format(
401-
metadata["driver"]["name"],
402-
name,
403-
)
404-
metadata["driver"]["version"] = "{}|{}".format(
405-
metadata["driver"]["version"],
406-
version,
407-
)
408-
metadata["platform"] = "{}|{}".format(metadata["platform"], platform)
396+
if driver.name:
397+
metadata["driver"]["name"] = "{}|{}".format(
398+
metadata["driver"]["name"],
399+
driver.name,
400+
)
401+
if driver.version:
402+
metadata["driver"]["version"] = "{}|{}".format(
403+
metadata["driver"]["version"],
404+
driver.version,
405+
)
406+
if driver.platform:
407+
metadata["platform"] = "{}|{}".format(metadata["platform"], driver.platform)
409408

410409
self.__metadata = metadata
411410

test/asynchronous/test_client_metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ async def check_metadata_added(
112112
self.assertEqual(version, new_version)
113113
self.assertEqual(platform, new_platform)
114114
else:
115-
self.assertEqual(new_name, f"{name}|{add_name}" if add_name is not None else f"{name}|")
115+
self.assertEqual(new_name, f"{name}|{add_name}" if add_name is not None else name)
116116
self.assertEqual(
117117
new_version,
118-
f"{version}|{add_version}" if add_version is not None else f"{version}|",
118+
f"{version}|{add_version}" if add_version is not None else version,
119119
)
120120
self.assertEqual(
121121
new_platform,
122-
f"{platform}|{add_platform}" if add_platform is not None else f"{platform}|",
122+
f"{platform}|{add_platform}" if add_platform is not None else platform,
123123
)
124124

125125
metadata.pop("driver")

test/test_client_metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ def check_metadata_added(
112112
self.assertEqual(version, new_version)
113113
self.assertEqual(platform, new_platform)
114114
else:
115-
self.assertEqual(new_name, f"{name}|{add_name}" if add_name is not None else f"{name}|")
115+
self.assertEqual(new_name, f"{name}|{add_name}" if add_name is not None else name)
116116
self.assertEqual(
117117
new_version,
118-
f"{version}|{add_version}" if add_version is not None else f"{version}|",
118+
f"{version}|{add_version}" if add_version is not None else version,
119119
)
120120
self.assertEqual(
121121
new_platform,
122-
f"{platform}|{add_platform}" if add_platform is not None else f"{platform}|",
122+
f"{platform}|{add_platform}" if add_platform is not None else platform,
123123
)
124124

125125
metadata.pop("driver")

0 commit comments

Comments
 (0)