From 4cb419eab80d6d0f078d7f184f83c4bffbe4b3a1 Mon Sep 17 00:00:00 2001 From: Josh Purtell Date: Tue, 17 Dec 2024 17:02:42 -0800 Subject: [PATCH] produce uuid ' --- synth_sdk/tracing/utils.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/synth_sdk/tracing/utils.py b/synth_sdk/tracing/utils.py index 5c5e6e7..9c7bb1e 100644 --- a/synth_sdk/tracing/utils.py +++ b/synth_sdk/tracing/utils.py @@ -1,11 +1,9 @@ -import hashlib +import uuid def get_system_id(system_name: str) -> str: - """Create a deterministic system_instance_id from system_name using SHA-256.""" + """Create a deterministic system_instance_id from system_name using UUID5.""" if not system_name: raise ValueError("system_name cannot be empty") - # Create SHA-256 hash of system_name - hash_object = hashlib.sha256(system_name.encode()) - # Take the first 16 characters of the hex digest for a shorter but still unique ID - return hash_object.hexdigest()[:16] + system_id = uuid.uuid5(uuid.NAMESPACE_DNS, system_name) + return str(system_id)