constants.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. from enum import Enum
  2. # A set containing the standard attributes of a LogRecord. This is used to
  3. # help us determine which attributes constitute Ray or user-provided context. It is
  4. # also be used to determine whether a attribute is a standard python logging attribute.
  5. # http://docs.python.org/library/logging.html#logrecord-attributes
  6. LOGRECORD_STANDARD_ATTRS = {
  7. "args",
  8. "asctime",
  9. "created",
  10. "exc_info",
  11. "exc_text",
  12. "filename",
  13. "funcName",
  14. "levelname",
  15. "levelno",
  16. "lineno",
  17. "message",
  18. "module",
  19. "msecs",
  20. "msg",
  21. "name",
  22. "pathname",
  23. "process",
  24. "processName",
  25. "relativeCreated",
  26. "stack_info",
  27. "thread",
  28. "threadName",
  29. "taskName",
  30. }
  31. LOGGER_FLATTEN_KEYS = {
  32. "ray_serve_extra_fields",
  33. }
  34. class LogKey(str, Enum):
  35. # Core context
  36. JOB_ID = "job_id"
  37. WORKER_ID = "worker_id"
  38. NODE_ID = "node_id"
  39. ACTOR_ID = "actor_id"
  40. TASK_ID = "task_id"
  41. ACTOR_NAME = "actor_name"
  42. TASK_NAME = "task_name"
  43. TASK_FUNCTION_NAME = "task_func_name"
  44. # Logger built-in context
  45. ASCTIME = "asctime"
  46. LEVELNAME = "levelname"
  47. MESSAGE = "message"
  48. FILENAME = "filename"
  49. LINENO = "lineno"
  50. EXC_TEXT = "exc_text"
  51. PROCESS = "process"
  52. # Ray logging context
  53. TIMESTAMP_NS = "timestamp_ns"