Skip to content

Commit

Permalink
produce uuid
Browse files Browse the repository at this point in the history
'
  • Loading branch information
JoshuaPurtell committed Dec 18, 2024
1 parent 4b76c58 commit 4cb419e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions synth_sdk/tracing/utils.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 4cb419e

Please sign in to comment.