lablup / backend.ai

Backend.AI is a streamlined, container-based computing cluster platform that hosts popular computing/ML frameworks and diverse programming languages, with pluggable heterogeneous accelerator support including CUDA GPU, ROCm GPU, TPU, IPU and other NPUs.
https://www.backend.ai
GNU Lesser General Public License v3.0
509 stars 152 forks source link

Attach unique identifier for low-level error logs #536

Open achimnol opened 2 years ago

achimnol commented 2 years ago

As we target multi-tenancy with appropriately abstracted hardware resources, sometimes exposing too much details about low-level exceptions may impact the security.

Let's create and attach unique identifiers for all exceptions displayed to users so that admins and our support team can search them easily. It would be just enough to use UUID with efficient 22-byte encoding with a prefix like "bai-err-". Let's also attach the relevant request information (the query params and headers) to these exception logs for easier inspection.

jangjichang commented 2 years ago

link UUID with efficient 22-byte encoding cannot found.

it seems internal repository.

achimnol commented 2 years ago

link UUID with efficient 22-byte encoding cannot found.

it seems internal repository.

It's just:

>>> from base64 import urlsafe_b64decode, urlsafe_b64encode
>>> import uuid
>>> urlsafe_b64encode(uuid.uuid4().bytes)[0:22]
b'QGPAkw1pQyWsBkUgpNvhng'
>>> uuid.UUID(bytes=urlsafe_b64decode(b'QGPAkw1pQyWsBkUgpNvhng=='))
UUID('4063c093-0d69-4325-ac06-4520a4dbe19e')