Verified Commit 4bf347fa authored by Peter Leitzen's avatar Peter Leitzen Committed by GitLab
Browse files

Merge branch 'ef-enrich-labkit-fields' into 'master'

feat(fields): add error, HTTP, duration, remote IP, and TCP address fields

See merge request !245

Merged-by: default avatarPeter Leitzen <pleitzen@gitlab.com>
Approved-by: default avatarPeter Leitzen <pleitzen@gitlab.com>
Reviewed-by: Bob Van Landuyt's avatarBob Van Landuyt <bob@gitlab.com>
Reviewed-by: default avatarGitLab Duo <gitlab-duo@gitlab.com>
Co-authored-by: Elliot Forbes's avatare_forbes <eforbes@gitlab.com>
parents b0ee8f30 89aba412
Loading
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -44,10 +44,45 @@ module Labkit
    # captures the user's username for logging purposes.
    GL_USER_NAME = "gl_user_name"

    # ErrorType - a string field that should contain the error type or classification
    # (e.g., "NoMethodError", "ValidationError").
    ERROR_TYPE = "error_type"

    # ErrorMessage - a string field that should contain the detailed error message
    # (e.g., "undefined method `boom!' for nil").
    ERROR_MESSAGE = "error_message"

    # HTTPStatusCode - an integer field that
    # captures the HTTP status code of requests for logging purposes.
    HTTP_STATUS_CODE = "status"

    # HTTPMethod - a string field that captures the HTTP method
    # (e.g., "GET", "POST") of a request for logging purposes.
    HTTP_METHOD = "method"

    # HTTPURL - a string field that captures the URL of an HTTP request
    # (scheme, host, and path only - query strings should be omitted
    # to avoid logging sensitive data) for logging purposes.
    # (e.g. "https://example.com/foo") Query strings and fragments (anchors)
    # must be omitted to avoid logging sensitive information such as tokens
    # or passwords that may appear in query parameters.
    HTTP_URL = "url"

    # DurationS - a float field that captures the duration of any operation
    # in seconds for logging purposes. It is not limited to HTTP requests and
    # can be used for any timed operation (e.g. database queries, background
    # jobs, external API calls).
    DURATION_S = "duration_s"

    # RemoteIP - a string field that captures the remote IP
    # address of a request for logging purposes.
    REMOTE_IP = "remote_ip"

    # TCPAddress - a string field that captures the TCP address a service or
    # component is listening on, in "host:port" format
    # (e.g. "0.0.0.0:8080" or "127.0.0.1:9090").
    TCP_ADDRESS = "tcp_address"

    # New fields being added to this section should have
    # the appropriate doc comments added above. These
    # should clearly indicate what the intended use of the