gitlab-labkit 2.3.1 → 2.6.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.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +3 -3
- data/.pre-commit-config.yaml +1 -1
- data/config/user_experience_slis/schema.json +31 -2
- data/lib/labkit/fields.rb +18 -0
- data/lib/labkit/user_experience_sli/README.md +16 -0
- data/lib/labkit/user_experience_sli/experience.rb +3 -1
- data/lib/labkit/user_experience_sli/registry.rb +8 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 15a3589c7770e0c9368d19d4acb2365fb627f40a7a2c3dd65c03057399585036
|
|
4
|
+
data.tar.gz: 2f45f67fd34c8031306f1cf7197e69f82d19215dc3fdb6fcb38ff1ff0b5fd804
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6858aecff6a32e4ca9b3b9c4b512b43de320b9f7b838348bb83de3d878a910b20169f64634c41bea4bdfa9f67db94ee2bf84864353e453296f8d40fd8d1934a
|
|
7
|
+
data.tar.gz: e4a9d5ac76d5e4b43220a469d7557c1bbfffb4fe9abb171978ee427981623ef4b1f1a20cde3c9b8c818b83e268eb0b509201a53f4aa47b74e924127ae03186b5
|
data/.gitlab-ci.yml
CHANGED
|
@@ -19,13 +19,13 @@ include:
|
|
|
19
19
|
# It includes standard checks, gitlab-scanners, validations and release processes
|
|
20
20
|
# common to all projects using this template library.
|
|
21
21
|
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/templates/standard.md
|
|
22
|
-
- component: $CI_SERVER_FQDN/gitlab-com/gl-infra/common-ci-tasks/standard-build@v4.
|
|
22
|
+
- component: $CI_SERVER_FQDN/gitlab-com/gl-infra/common-ci-tasks/standard-build@v4.8
|
|
23
23
|
|
|
24
24
|
# Runs rspec tests and rubocop on the project
|
|
25
25
|
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/templates/ruby.md
|
|
26
|
-
- component: $CI_SERVER_FQDN/gitlab-com/gl-infra/common-ci-tasks/ruby-build@v4.
|
|
26
|
+
- component: $CI_SERVER_FQDN/gitlab-com/gl-infra/common-ci-tasks/ruby-build@v4.8
|
|
27
27
|
|
|
28
|
-
- component: $CI_SERVER_FQDN/gitlab-com/gl-infra/common-ci-tasks/danger@v4.
|
|
28
|
+
- component: $CI_SERVER_FQDN/gitlab-com/gl-infra/common-ci-tasks/danger@v4.8
|
|
29
29
|
|
|
30
30
|
# Attach a redis service to the rspec job from common-ci-tasks/ruby-build.
|
|
31
31
|
# GitLab merges keys when a local job has the same name as an included one,
|
data/.pre-commit-config.yaml
CHANGED
|
@@ -25,7 +25,7 @@ repos:
|
|
|
25
25
|
# Documentation available at
|
|
26
26
|
# https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/docs/pre-commit.md
|
|
27
27
|
- repo: https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks
|
|
28
|
-
rev: v4.
|
|
28
|
+
rev: v4.8 # renovate:managed
|
|
29
29
|
|
|
30
30
|
hooks:
|
|
31
31
|
- id: shellcheck # Run shellcheck for changed Shell files
|
|
@@ -21,15 +21,44 @@
|
|
|
21
21
|
"sync_fast",
|
|
22
22
|
"sync_slow",
|
|
23
23
|
"async_fast",
|
|
24
|
-
"async_slow"
|
|
24
|
+
"async_slow",
|
|
25
|
+
"custom"
|
|
25
26
|
],
|
|
26
27
|
"description": "Urgency level for this user experience"
|
|
28
|
+
},
|
|
29
|
+
"apdex_threshold_s": {
|
|
30
|
+
"type": "number",
|
|
31
|
+
"exclusiveMinimum": 0,
|
|
32
|
+
"maximum": 600,
|
|
33
|
+
"description": "Custom Apdex threshold duration in seconds. Required when urgency is custom."
|
|
27
34
|
}
|
|
28
35
|
},
|
|
29
36
|
"required": [
|
|
30
37
|
"description",
|
|
31
38
|
"feature_category",
|
|
32
39
|
"urgency"
|
|
40
|
+
],
|
|
41
|
+
"allOf": [
|
|
42
|
+
{
|
|
43
|
+
"if": {
|
|
44
|
+
"properties": {
|
|
45
|
+
"urgency": {
|
|
46
|
+
"const": "custom"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"then": {
|
|
51
|
+
"required": [
|
|
52
|
+
"apdex_threshold_s"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"else": {
|
|
56
|
+
"not": {
|
|
57
|
+
"required": [
|
|
58
|
+
"apdex_threshold_s"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
33
63
|
]
|
|
34
64
|
}
|
|
35
|
-
|
data/lib/labkit/fields.rb
CHANGED
|
@@ -21,6 +21,10 @@ module Labkit
|
|
|
21
21
|
# filtering in Kibana and Grafana.
|
|
22
22
|
DUO_WORKFLOW_DEFINITION = "duo_workflow_definition"
|
|
23
23
|
|
|
24
|
+
# Unique identifier for a Duo Workflow instance. Identifies a specific
|
|
25
|
+
# workflow run, enabling per-workflow tracing in logs.
|
|
26
|
+
DUO_WORKFLOW_ID = "duo_workflow_id"
|
|
27
|
+
|
|
24
28
|
# Error type or classification (e.g. "NoMethodError", "ValidationError").
|
|
25
29
|
ERROR_TYPE = "error_type"
|
|
26
30
|
|
|
@@ -86,6 +90,12 @@ module Labkit
|
|
|
86
90
|
# GitLab pipeline numeric ID.
|
|
87
91
|
GL_PIPELINE_ID = "gl_pipeline_id"
|
|
88
92
|
|
|
93
|
+
# GitLab namespace numeric ID.
|
|
94
|
+
GL_NAMESPACE_ID = "gl_namespace_id"
|
|
95
|
+
|
|
96
|
+
# GitLab root (top-level) namespace numeric ID.
|
|
97
|
+
GL_ROOT_NAMESPACE_ID = "gl_root_namespace_id"
|
|
98
|
+
|
|
89
99
|
# Log event timestamp in ISO 8601 format (e.g. "2026-04-02T12:00:00.000Z").
|
|
90
100
|
TIMESTAMP = "timestamp"
|
|
91
101
|
|
|
@@ -118,6 +128,10 @@ module Labkit
|
|
|
118
128
|
# The endpoint_id of the original caller at the root of the call chain.
|
|
119
129
|
ROOT_CALLER_ID = "root_caller_id"
|
|
120
130
|
|
|
131
|
+
# GitLab SentNotification record numeric ID associated with an incoming
|
|
132
|
+
# email reply.
|
|
133
|
+
GL_SENT_NOTIFICATION_ID = "gl_sent_notification_id"
|
|
134
|
+
|
|
121
135
|
# Maps each field constant to its logging field variant version.
|
|
122
136
|
# A version of 0 means the field is not yet assigned to any variant.
|
|
123
137
|
VARIANT_VERSION = {
|
|
@@ -125,6 +139,7 @@ module Labkit
|
|
|
125
139
|
GL_USER_ID => 1,
|
|
126
140
|
GL_USER_NAME => 1,
|
|
127
141
|
DUO_WORKFLOW_DEFINITION => 0,
|
|
142
|
+
DUO_WORKFLOW_ID => 0,
|
|
128
143
|
ERROR_TYPE => 0,
|
|
129
144
|
ERROR_MESSAGE => 1,
|
|
130
145
|
HTTP_STATUS_CODE => 1,
|
|
@@ -144,6 +159,8 @@ module Labkit
|
|
|
144
159
|
TTFB_S => 0,
|
|
145
160
|
GL_PROJECT_ID => 1,
|
|
146
161
|
GL_PIPELINE_ID => 1,
|
|
162
|
+
GL_NAMESPACE_ID => 0,
|
|
163
|
+
GL_ROOT_NAMESPACE_ID => 0,
|
|
147
164
|
TIMESTAMP => 0,
|
|
148
165
|
SEVERITY => 0,
|
|
149
166
|
LOG_MESSAGE => 1,
|
|
@@ -154,6 +171,7 @@ module Labkit
|
|
|
154
171
|
ENDPOINT_ID => 0,
|
|
155
172
|
CALLER_ID => 1,
|
|
156
173
|
ROOT_CALLER_ID => 0,
|
|
174
|
+
GL_SENT_NOTIFICATION_ID => 0,
|
|
157
175
|
}.freeze
|
|
158
176
|
|
|
159
177
|
# Get the constant name for a field value
|
|
@@ -107,6 +107,22 @@ https://docs.gitlab.com/development/feature_categorization/#feature-categorizati
|
|
|
107
107
|
| `sync_slow` | A user is awaiting a synchronous response which needs to be returned before they can continue with their action, but which the user may accept a slower response | Displaying a full-text search response while displaying an amusement animation | 5s |
|
|
108
108
|
| `async_fast` | An async process which may block a user from continuing with their user journey | MR diff update after git push | 15s |
|
|
109
109
|
| `async_slow` | An async process which will not block a user and will not be immediately noticed as being slow | Notification following an assignment | 5m |
|
|
110
|
+
| `custom` | A user experience whose acceptable duration does not match the predefined urgency buckets | Creating a merge request with an accepted threshold of 90s | Set by `apdex_threshold_s` |
|
|
111
|
+
|
|
112
|
+
**Custom Apdex thresholds**
|
|
113
|
+
|
|
114
|
+
Use `urgency: "custom"` when none of the predefined thresholds accurately represents the expected user experience. Custom urgency requires `apdex_threshold_s`.
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
description: "Creating a new merge request in a project"
|
|
118
|
+
feature_category: "code_review_workflow"
|
|
119
|
+
urgency: "custom"
|
|
120
|
+
apdex_threshold_s: 90
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`apdex_threshold_s` is measured in seconds, must be greater than `0`, and cannot exceed `600`.
|
|
124
|
+
|
|
125
|
+
Prefer the predefined urgency values unless the SLI would otherwise be permanently red or permanently green because the predefined thresholds do not match the experience.
|
|
110
126
|
|
|
111
127
|
## Usage
|
|
112
128
|
|
|
@@ -209,7 +209,9 @@ module Labkit
|
|
|
209
209
|
end
|
|
210
210
|
|
|
211
211
|
def urgency_threshold
|
|
212
|
-
|
|
212
|
+
# Definitions are loaded through the registry, which validates the schema before instantiating them.
|
|
213
|
+
# The schema guarantees experience with custom urgency provide apdex_threshold_s.
|
|
214
|
+
@definition.apdex_threshold_s || URGENCY_THRESHOLDS_IN_SECONDS[@definition.urgency.to_sym]
|
|
213
215
|
end
|
|
214
216
|
|
|
215
217
|
def elapsed_time
|
|
@@ -8,7 +8,11 @@ require 'labkit/json_schema/ref_resolver'
|
|
|
8
8
|
|
|
9
9
|
module Labkit
|
|
10
10
|
module UserExperienceSli
|
|
11
|
-
Definition = Data.define(:user_experience_id, :description, :feature_category, :urgency)
|
|
11
|
+
Definition = Data.define(:user_experience_id, :description, :feature_category, :urgency, :apdex_threshold_s) do
|
|
12
|
+
def initialize(user_experience_id:, description:, feature_category:, urgency:, apdex_threshold_s: nil)
|
|
13
|
+
super
|
|
14
|
+
end
|
|
15
|
+
end
|
|
12
16
|
|
|
13
17
|
class Registry
|
|
14
18
|
extend Forwardable
|
|
@@ -78,15 +82,16 @@ module Labkit
|
|
|
78
82
|
content = YAML.safe_load(file_path.read)
|
|
79
83
|
return nil unless content.is_a?(Hash)
|
|
80
84
|
|
|
81
|
-
return Definition.new(user_experience_id: experience_id, **content) if schema.valid?(content)
|
|
85
|
+
return Definition.new(user_experience_id: experience_id, **content.transform_keys(&:to_sym)) if schema.valid?(content)
|
|
82
86
|
|
|
83
87
|
warn("Invalid schema for #{file_path}")
|
|
84
|
-
|
|
85
88
|
nil
|
|
86
89
|
rescue Psych::SyntaxError => e
|
|
87
90
|
warn("Invalid definition file #{file_path}: #{e.message}")
|
|
91
|
+
nil
|
|
88
92
|
rescue StandardError => e
|
|
89
93
|
warn("Unexpected error processing #{file_path}: #{e.message}")
|
|
94
|
+
nil
|
|
90
95
|
end
|
|
91
96
|
|
|
92
97
|
def schema
|