Verified Commit 2d5b121e authored by Elliot Forbes's avatar Elliot Forbes 2️⃣ Committed by GitLab
Browse files

feat: update field constants from labkit-spec v1.0

parent 07c30231
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -102,6 +102,22 @@ module Labkit
    # Name of the service or component emitting the log event.
    SERVICE_NAME = "service_name"

    # GitLab organization numeric ID.
    GL_ORGANIZATION_ID = "gl_organization_id"

    # GitLab project path.
    GL_PROJECT_PATH = "gl_project_path"

    # The endpoint_id of the current endpoint to be passed as caller_id when
    # calling another service.
    ENDPOINT_ID = "endpoint_id"

    # The ID of the caller of the current service.
    CALLER_ID = "caller_id"

    # The endpoint_id of the original caller at the root of the call chain.
    ROOT_CALLER_ID = "root_caller_id"

    # 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
@@ -135,6 +151,8 @@ module Labkit
        Fields::LOG_MESSAGE => %w[msg custom_message extra.message fields.message graphql.message reason color_message exception.gitaly],
        Fields::CLASS_NAME => %w[class author_class exception.class extra.class extra.class_name],
        Fields::SERVICE_NAME => %w[service grpc.service_name auth_service type component subcomponent],
        Fields::GL_ORGANIZATION_ID => %w[organization_id],
        Fields::GL_PROJECT_PATH => %w[project_path full_path root_pipeline_project_path requested_project_path auth_project_path extra.gl_project_path],
      }.freeze

      class << self