Commit 9e024f08 authored by Matias Alvarez's avatar Matias Alvarez
Browse files

feat: Add logging field variant versions

parent 0f417f20
Loading
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -118,6 +118,44 @@ module Labkit
    # The endpoint_id of the original caller at the root of the call chain.
    ROOT_CALLER_ID = "root_caller_id"

    # Maps each field constant to its logging field variant version.
    # A version of 0 means the field is not yet assigned to any variant.
    VARIANT_VERSION = {
      CORRELATION_ID => 1,
      GL_USER_ID => 1,
      GL_USER_NAME => 1,
      DUO_WORKFLOW_DEFINITION => 0,
      ERROR_TYPE => 0,
      ERROR_MESSAGE => 1,
      HTTP_STATUS_CODE => 1,
      HTTP_METHOD => 0,
      HTTP_URL => 0,
      DURATION_S => 1,
      REMOTE_IP => 1,
      TCP_ADDRESS => 0,
      HTTP_URI => 0,
      HTTP_HOST => 0,
      HTTP_PROTO => 0,
      REMOTE_ADDR => 0,
      HTTP_REFERRER => 0,
      HTTP_USER_AGENT => 0,
      WRITTEN_BYTES => 0,
      CONTENT_TYPE => 0,
      TTFB_S => 0,
      GL_PROJECT_ID => 1,
      GL_PIPELINE_ID => 1,
      TIMESTAMP => 0,
      SEVERITY => 0,
      LOG_MESSAGE => 1,
      CLASS_NAME => 0,
      SERVICE_NAME => 0,
      GL_ORGANIZATION_ID => 1,
      GL_PROJECT_PATH => 1,
      ENDPOINT_ID => 0,
      CALLER_ID => 1,
      ROOT_CALLER_ID => 0,
    }.freeze

    # Get the constant name for a field value
    # @param field_value [String] The field value (e.g., "gl_user_id")
    # @return [String, nil] The constant name (e.g., "GL_USER_ID") or nil if not found