fields

package
v1.41.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package fields is intended to be the SSOT for Go applications for all of the field names used within our observability setup.

This is intended to help enforce consistency across components when it comes to field names.

Labkit-Ruby: https://gitlab.com/gitlab-org/ruby/gems/labkit-ruby/-/blob/master/lib/labkit/fields.rb?ref_type=heads

For Engineers Looking to add fields:

Please see the handbook page for more information https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/observability_field_standardisation/

Note: this Go package sets the standards for all Labkit variants. Other Labkit variants will be derived from the fields defined within this package to ensure consistency.

Index

Constants

View Source
const (
	// correlation_id - string
	// This field is used to correlate
	// the logs emitted by all of our systems.
	// This should be present in all log line
	// emissions.
	CorrelationID = "correlation_id"

	// GitLabUserID - an integer field that
	// captures the user's numeric ID for logging purposes.
	GitLabUserID = "gl_user_id"

	// GitLabUserName - a string field that
	// captures the user's username for logging purposes.
	GitLabUserName = "gl_user_name"

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

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

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

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

	// HTTPURL - a string field that captures the URL of an HTTP request for
	// logging purposes. This should contain only the scheme, host, and path
	// (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.
	HTTPURL = "url"

	// DurationS - a float64 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). Using float64 allows sub-second precision to
	// be captured, e.g. 0.032 for a 32ms operation.
	DurationS = "duration_s"

	// RemoteIP - a string field that captures the remote IP
	// address of a request for logging purposes.
	RemoteIP = "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").
	TCPAddress = "tcp_address"
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL