gitlab-labkit 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/labkit/fields.rb +56 -65
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0bb2d14be346d721a3bd2bc1341998a10f3d6befdb876314545f4dfb4d9f807
4
- data.tar.gz: 138b2737773ca89e9f7cde1f60085eaaebedfb23476f710a595672c2f9195a54
3
+ metadata.gz: 83ec781fd3b5955bb25dd8b3beb5719bd39fbb624db27ce3166227c9cc295aa7
4
+ data.tar.gz: 0d710400cece77eb16ab725ee1cb0b3eb0bfc833618a5218681865e72fd07aa6
5
5
  SHA512:
6
- metadata.gz: be04a46cb79b377100e72228c5a50c79c7d6cac89fb3c68b7e3f649aec625f3db48c441e0d9c9927d43fe8daabe6b2db45ea5f0aff2657ce77952f20bcfef046
7
- data.tar.gz: ab11eca1c5a11801cbeb3f24dd540e56a279df4e17383d61d7ecf05a1e945fb57eba165dd57a405f1f8cc456aa8b14492642e68dc09cf40a45b8fd3d2c13255c
6
+ metadata.gz: 576fc58fe5c6319f2a35a3ac3b83ad64f56e187ee0f5844b88e2fa37f8a0f2a7d0d0a1ea0e85640941d50331b187139b99033a4c5a5804b478aa3640108d48d7
7
+ data.tar.gz: b7fe82edce2720772c26f2f2057b139be363dc34adf77d860fdf11614500e45a9abff07319a912accf1f6e38f1833bbaa19d55b4217befe72e960821ea975a35
data/lib/labkit/fields.rb CHANGED
@@ -1,93 +1,84 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Code generated by labkit-spec. DO NOT EDIT.
4
+ #
5
+ # Source: schema/fields.yaml (version 1.0)
6
+
3
7
  module Labkit
4
- ##
5
- # Fields is intended to be a SSOT for all of the common field names that
6
- # we emit via any observability we add to our systems.
7
- #
8
- # These fields should span multiple services.
9
- #
10
- # The goal of this package is to reduce the likelihood for typos or
11
- # subtly different naming conventions. This will help to ensure we
12
- # are able to marry up logs between different systems as a request
13
- # is being processed.
14
- #
15
- # Usage:
16
- # require 'labkit/fields'
17
- # ...
18
- # data[Labkit::Fields::GL_USER_ID] = user.id
19
- # ...
20
- #
21
- # Labkit (Go): https://gitlab.com/gitlab-org/labkit/-/tree/master/fields?ref_type=heads
22
- #
23
- # For Engineers Looking to add fields:
24
- #
25
- # These fields are derived from the Go Labkit variant. Please ensure that you've made the
26
- # respective changes in that repository prior to including the fields in this package.
27
- #
28
- # Please see the handbook page for more information
29
- # https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/observability_field_standardisation/
30
8
  module Fields
31
- # correlation_id - string
32
- #
33
- # This field is used to correlate
34
- # the logs emitted by all of our systems.
35
- # This should be present in all log line
36
- # emissions.
9
+ # Unique identifier for correlating requests across services. Should be
10
+ # present in all log line emissions.
37
11
  CORRELATION_ID = "correlation_id"
38
12
 
39
- # GitLabUserID - an integer field that
40
- # captures the user's numeric ID for logging purposes.
13
+ # GitLab user numeric ID.
41
14
  GL_USER_ID = "gl_user_id"
42
15
 
43
- # GitLabUserName - a string field that
44
- # captures the user's username for logging purposes.
16
+ # GitLab username.
45
17
  GL_USER_NAME = "gl_user_name"
46
18
 
47
- # ErrorType - a string field that should contain the error type or classification
48
- # (e.g., "NoMethodError", "ValidationError").
19
+ # Duo Workflow definition identifier (e.g. "analytics_agent/v1"). Identifies
20
+ # which Duo Workflow agent originated a request, enabling per-agent
21
+ # filtering in Kibana and Grafana.
22
+ DUO_WORKFLOW_DEFINITION = "duo_workflow_definition"
23
+
24
+ # Error type or classification (e.g. "NoMethodError", "ValidationError").
49
25
  ERROR_TYPE = "error_type"
50
26
 
51
- # ErrorMessage - a string field that should contain the detailed error message
52
- # (e.g., "undefined method `boom!' for nil").
27
+ # Detailed error message (e.g. "undefined method 'boom!' for nil").
53
28
  ERROR_MESSAGE = "error_message"
54
29
 
55
- # HTTPStatusCode - an integer field that
56
- # captures the HTTP status code of requests for logging purposes.
30
+ # HTTP response status code.
57
31
  HTTP_STATUS_CODE = "status"
58
32
 
59
- # HTTPMethod - a string field that captures the HTTP method
60
- # (e.g., "GET", "POST") of a request for logging purposes.
33
+ # HTTP method (e.g. "GET", "POST").
61
34
  HTTP_METHOD = "method"
62
35
 
63
- # HTTPURL - a string field that captures the URL of an HTTP request
64
- # (scheme, host, and path only - query strings should be omitted
65
- # to avoid logging sensitive data) for logging purposes.
66
- # (e.g. "https://example.com/foo") Query strings and fragments (anchors)
67
- # must be omitted to avoid logging sensitive information such as tokens
68
- # or passwords that may appear in query parameters.
36
+ # URL of an HTTP request containing only scheme, host, and path (e.g.
37
+ # "https://example.com/foo"). Query strings and fragments must be omitted to
38
+ # avoid logging sensitive information.
69
39
  HTTP_URL = "url"
70
40
 
71
- # DurationS - a float field that captures the duration of any operation
72
- # in seconds for logging purposes. It is not limited to HTTP requests and
73
- # can be used for any timed operation (e.g. database queries, background
74
- # jobs, external API calls).
41
+ # Duration of any operation in seconds. Not limited to HTTP requests; can be
42
+ # used for database queries, background jobs, external API calls. Uses
43
+ # float64 for sub-second precision (e.g. 0.032 for 32ms).
75
44
  DURATION_S = "duration_s"
76
45
 
77
- # RemoteIP - a string field that captures the remote IP
78
- # address of a request for logging purposes.
46
+ # Remote IP address of a request.
79
47
  REMOTE_IP = "remote_ip"
80
48
 
81
- # TCPAddress - a string field that captures the TCP address a service or
82
- # component is listening on, in "host:port" format
83
- # (e.g. "0.0.0.0:8080" or "127.0.0.1:9090").
49
+ # TCP address a service is listening on, in "host:port" format (e.g.
50
+ # "0.0.0.0:8080").
84
51
  TCP_ADDRESS = "tcp_address"
85
52
 
86
- # New fields being added to this section should have
87
- # the appropriate doc comments added above. These
88
- # should clearly indicate what the intended use of the
89
- # field is and should be replicated across the labkit
90
- # variations.
53
+ # Request URI including path and query string with sensitive parameters
54
+ # masked (e.g. "?password=[FILTERED]").
55
+ HTTP_URI = "uri"
56
+
57
+ # HTTP Host header of a request (e.g. "api.gitlab.com").
58
+ HTTP_HOST = "host"
59
+
60
+ # HTTP protocol version (e.g. "HTTP/1.1", "HTTP/2.0").
61
+ HTTP_PROTO = "proto"
62
+
63
+ # Raw remote socket address in "host:port" format (e.g. "10.0.0.1:54321").
64
+ # Use remote_ip when only the IP is needed.
65
+ REMOTE_ADDR = "remote_addr"
66
+
67
+ # HTTP Referer header with sensitive query parameters masked.
68
+ HTTP_REFERRER = "referrer"
69
+
70
+ # HTTP User-Agent header.
71
+ HTTP_USER_AGENT = "user_agent"
72
+
73
+ # Number of bytes written to the HTTP response body.
74
+ WRITTEN_BYTES = "written_bytes"
75
+
76
+ # Content-Type of an HTTP response (e.g. "application/json").
77
+ CONTENT_TYPE = "content_type"
78
+
79
+ # Time to first byte of an HTTP response in seconds. Measures duration from
80
+ # request receipt to first response byte written.
81
+ TTFB_S = "ttfb_s"
91
82
 
92
83
  # Get the constant name for a field value
93
84
  # @param field_value [String] The field value (e.g., "gl_user_id")
@@ -107,7 +98,7 @@ module Labkit
107
98
 
108
99
  MAPPINGS = {
109
100
  Fields::GL_USER_ID => %w[user_id userid],
110
- Fields::HTTP_STATUS_CODE => %w[status_code extra.status status_text]
101
+ Fields::HTTP_STATUS_CODE => %w[status_code extra.status status_text],
111
102
  }.freeze
112
103
 
113
104
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-labkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newdigate