gitlab-labkit 0.16.0 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +8 -3
- data/.rubocop.yml +13 -127
- data/.rubocop_todo.yml +238 -0
- data/Rakefile +3 -1
- data/gitlab-labkit.gemspec +4 -5
- data/lib/gitlab-labkit.rb +0 -2
- data/lib/labkit/context.rb +4 -1
- data/lib/labkit/correlation/grpc/client_interceptor.rb +1 -4
- data/lib/labkit/correlation/grpc/server_interceptor.rb +0 -3
- data/lib/labkit/excon_publisher.rb +3 -1
- data/lib/labkit/logging/grpc/server_interceptor.rb +2 -0
- data/lib/labkit/logging/sanitizer.rb +7 -3
- data/lib/labkit/middleware/sidekiq/context/server.rb +2 -1
- data/lib/labkit/tracing.rb +0 -2
- data/lib/labkit/tracing/abstract_instrumenter.rb +0 -1
- data/lib/labkit/tracing/external_http/request_instrumenter.rb +2 -0
- data/lib/labkit/tracing/grpc/client_interceptor.rb +1 -3
- data/lib/labkit/tracing/grpc/server_interceptor.rb +0 -3
- data/lib/labkit/tracing/rack_middleware.rb +0 -1
- data/lib/labkit/tracing/rails/active_record/sql_instrumenter.rb +6 -1
- data/lib/labkit/tracing/tracing_common.rb +2 -1
- data/lib/labkit/tracing/tracing_utils.rb +1 -0
- metadata +24 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eed1c5eae7363851222a82aaeae8088a5227912d0d01d1f1b30e3e0514a25e2
|
4
|
+
data.tar.gz: 44167dc3c31083dcb58028c7851106ba47dcd8ac590a02e3306d3f8ef741fd41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44f99cd2425d95c738d522c496d37319f318360d5c79be3ab3822f38bd95c7aec7f40fb307c2435c28bb43642539d7c84f5501d1f83c4f1905f5cc6fd645f0f9
|
7
|
+
data.tar.gz: 5603763f8cee8f7fff87d963ef87e66989a5860d4d6dc58d35c5530383bfd7c99f88a62e768982e87e1b7a9fc56f20f0101db9a140a2765818d39807c9f2e14a
|
data/.gitlab-ci.yml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
default:
|
2
|
+
image: ruby:2.7
|
3
|
+
|
1
4
|
workflow:
|
2
5
|
rules:
|
3
6
|
# For merge requests, create a pipeline.
|
@@ -22,9 +25,11 @@ test:2.6:
|
|
22
25
|
image: ruby:2.6
|
23
26
|
<<: *test_definition
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
static-analysis:
|
29
|
+
before_script:
|
30
|
+
- bundle install
|
31
|
+
script:
|
32
|
+
- rake verify
|
28
33
|
|
29
34
|
deploy:
|
30
35
|
stage: deploy
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
inherit_gem:
|
4
|
+
gitlab-styles:
|
5
|
+
- rubocop-default.yml
|
3
6
|
|
4
|
-
|
5
|
-
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.7
|
6
9
|
|
7
10
|
Style/HashSyntax:
|
8
11
|
EnforcedStyle: no_mixed_keys
|
@@ -28,11 +31,11 @@ Style/StringLiterals:
|
|
28
31
|
Style/StringLiteralsInInterpolation:
|
29
32
|
EnforcedStyle: double_quotes
|
30
33
|
|
31
|
-
Style/
|
34
|
+
Style/Lambda:
|
32
35
|
Enabled: false
|
33
36
|
|
34
|
-
Layout/
|
35
|
-
Enabled:
|
37
|
+
Layout/LineLength:
|
38
|
+
Enabled: false
|
36
39
|
|
37
40
|
Layout/SpaceInLambdaLiteral:
|
38
41
|
Enabled: No
|
@@ -43,69 +46,6 @@ Layout/SpaceInsideBlockBraces:
|
|
43
46
|
Layout/FirstParameterIndentation:
|
44
47
|
Enabled: No
|
45
48
|
|
46
|
-
Metrics/AbcSize:
|
47
|
-
Enabled: true
|
48
|
-
Max: 54.28
|
49
|
-
|
50
|
-
Metrics/BlockLength:
|
51
|
-
Enabled: false
|
52
|
-
|
53
|
-
Metrics/BlockNesting:
|
54
|
-
Enabled: true
|
55
|
-
Max: 4
|
56
|
-
|
57
|
-
Metrics/ClassLength:
|
58
|
-
Enabled: false
|
59
|
-
|
60
|
-
Metrics/CyclomaticComplexity:
|
61
|
-
Enabled: true
|
62
|
-
Max: 13
|
63
|
-
|
64
|
-
Metrics/LineLength:
|
65
|
-
Enabled: false
|
66
|
-
|
67
|
-
Metrics/MethodLength:
|
68
|
-
Enabled: false
|
69
|
-
|
70
|
-
Metrics/ModuleLength:
|
71
|
-
Enabled: false
|
72
|
-
|
73
|
-
Metrics/ParameterLists:
|
74
|
-
Enabled: true
|
75
|
-
Max: 8
|
76
|
-
|
77
|
-
Metrics/PerceivedComplexity:
|
78
|
-
Enabled: true
|
79
|
-
Max: 14
|
80
|
-
|
81
|
-
RSpec/AnyInstance:
|
82
|
-
Enabled: false
|
83
|
-
|
84
|
-
RSpec/BeEql:
|
85
|
-
Enabled: true
|
86
|
-
|
87
|
-
RSpec/BeforeAfterAll:
|
88
|
-
Enabled: false
|
89
|
-
|
90
|
-
RSpec/DescribeClass:
|
91
|
-
Enabled: false
|
92
|
-
|
93
|
-
RSpec/DescribeMethod:
|
94
|
-
Enabled: false
|
95
|
-
|
96
|
-
RSpec/DescribeSymbol:
|
97
|
-
Enabled: true
|
98
|
-
|
99
|
-
RSpec/DescribedClass:
|
100
|
-
Enabled: true
|
101
|
-
|
102
|
-
RSpec/EmptyExampleGroup:
|
103
|
-
Enabled: true
|
104
|
-
|
105
|
-
RSpec/ExampleLength:
|
106
|
-
Enabled: false
|
107
|
-
Max: 5
|
108
|
-
|
109
49
|
RSpec/ExampleWording:
|
110
50
|
Enabled: false
|
111
51
|
CustomTransform:
|
@@ -114,63 +54,9 @@ RSpec/ExampleWording:
|
|
114
54
|
not: does not
|
115
55
|
IgnoredWords: []
|
116
56
|
|
117
|
-
|
118
|
-
Enabled: true
|
119
|
-
|
120
|
-
RSpec/ExpectOutput:
|
57
|
+
Lint/HashCompareByIdentity: # (new in 0.93)
|
121
58
|
Enabled: true
|
122
|
-
|
123
|
-
RSpec/FilePath:
|
59
|
+
Lint/RedundantSafeNavigation: # (new in 0.93)
|
124
60
|
Enabled: true
|
125
|
-
|
126
|
-
|
127
|
-
RSpec/Focus:
|
128
|
-
Enabled: true
|
129
|
-
|
130
|
-
RSpec/HookArgument:
|
131
|
-
Enabled: true
|
132
|
-
EnforcedStyle: implicit
|
133
|
-
|
134
|
-
RSpec/ImplicitExpect:
|
135
|
-
Enabled: true
|
136
|
-
EnforcedStyle: is_expected
|
137
|
-
|
138
|
-
RSpec/InstanceVariable:
|
139
|
-
Enabled: false
|
140
|
-
|
141
|
-
RSpec/LeadingSubject:
|
142
|
-
Enabled: false
|
143
|
-
|
144
|
-
RSpec/LetSetup:
|
145
|
-
Enabled: false
|
146
|
-
|
147
|
-
RSpec/MessageChain:
|
148
|
-
Enabled: false
|
149
|
-
|
150
|
-
RSpec/MessageSpies:
|
151
|
-
Enabled: false
|
152
|
-
|
153
|
-
RSpec/MultipleDescribes:
|
154
|
-
Enabled: false
|
155
|
-
|
156
|
-
RSpec/MultipleExpectations:
|
157
|
-
Enabled: false
|
158
|
-
|
159
|
-
RSpec/NamedSubject:
|
160
|
-
Enabled: false
|
161
|
-
|
162
|
-
RSpec/NestedGroups:
|
163
|
-
Enabled: false
|
164
|
-
|
165
|
-
RSpec/NotToNot:
|
166
|
-
EnforcedStyle: not_to
|
61
|
+
Style/ClassEqualityComparison: # (new in 0.93)
|
167
62
|
Enabled: true
|
168
|
-
|
169
|
-
RSpec/RepeatedDescription:
|
170
|
-
Enabled: false
|
171
|
-
|
172
|
-
RSpec/SubjectStub:
|
173
|
-
Enabled: false
|
174
|
-
|
175
|
-
RSpec/VerifiedDoubles:
|
176
|
-
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,238 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2021-04-18 00:00:00 UTC using RuboCop version 0.93.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 51
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
CodeReuse/ActiveRecord:
|
12
|
+
Exclude:
|
13
|
+
- 'spec/labkit/correlation/grpc/client_interceptor_spec.rb'
|
14
|
+
- 'spec/labkit/correlation/grpc/server_interceptor_spec.rb'
|
15
|
+
- 'spec/labkit/middleware/rack_spec.rb'
|
16
|
+
- 'spec/labkit/middleware/sidekiq/client_spec.rb'
|
17
|
+
- 'spec/labkit/middleware/sidekiq/context/server_spec.rb'
|
18
|
+
- 'spec/labkit/middleware/sidekiq/server_spec.rb'
|
19
|
+
- 'spec/labkit/middleware/sidekiq/tracing/client_spec.rb'
|
20
|
+
- 'spec/labkit/middleware/sidekiq/tracing/server_spec.rb'
|
21
|
+
- 'spec/labkit/tracing/factory_spec.rb'
|
22
|
+
- 'spec/labkit/tracing/grpc/client_interceptor_spec.rb'
|
23
|
+
- 'spec/labkit/tracing/grpc/server_interceptor_spec.rb'
|
24
|
+
- 'spec/labkit/tracing_spec.rb'
|
25
|
+
- 'spec/support/tracing/shared_examples.rb'
|
26
|
+
|
27
|
+
# Offense count: 1
|
28
|
+
# Configuration parameters: Include.
|
29
|
+
# Include: **/*.gemspec
|
30
|
+
Gemspec/RequiredRubyVersion:
|
31
|
+
Exclude:
|
32
|
+
- 'gitlab-labkit.gemspec'
|
33
|
+
|
34
|
+
# Offense count: 1
|
35
|
+
# Cop supports --auto-correct.
|
36
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
37
|
+
# SupportedHashRocketStyles: key, separator, table
|
38
|
+
# SupportedColonStyles: key, separator, table
|
39
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
40
|
+
Layout/HashAlignment:
|
41
|
+
Exclude:
|
42
|
+
- 'spec/labkit/context_spec.rb'
|
43
|
+
|
44
|
+
# Offense count: 1
|
45
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
46
|
+
Exclude:
|
47
|
+
- 'spec/labkit/tracing/redis/redis_interceptor_helper_spec.rb'
|
48
|
+
|
49
|
+
# Offense count: 4
|
50
|
+
Lint/ConstantDefinitionInBlock:
|
51
|
+
Exclude:
|
52
|
+
- 'spec/labkit/middleware/sidekiq/client_spec.rb'
|
53
|
+
- 'spec/labkit/middleware/sidekiq/context/client_spec.rb'
|
54
|
+
- 'spec/labkit/middleware/sidekiq/context/server_spec.rb'
|
55
|
+
- 'spec/labkit/middleware/sidekiq/server_spec.rb'
|
56
|
+
|
57
|
+
# Offense count: 1
|
58
|
+
# Cop supports --auto-correct.
|
59
|
+
# Configuration parameters: AllowedMethods.
|
60
|
+
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
|
61
|
+
Lint/RedundantSafeNavigation:
|
62
|
+
Exclude:
|
63
|
+
- 'lib/labkit/tracing.rb'
|
64
|
+
|
65
|
+
# Offense count: 1
|
66
|
+
# Cop supports --auto-correct.
|
67
|
+
# Configuration parameters: PreferredName.
|
68
|
+
Naming/RescuedExceptionsVariableName:
|
69
|
+
Exclude:
|
70
|
+
- 'lib/labkit/logging/grpc/server_interceptor.rb'
|
71
|
+
|
72
|
+
# Offense count: 2
|
73
|
+
Performance/MethodObjectAsBlock:
|
74
|
+
Exclude:
|
75
|
+
- 'lib/labkit/context.rb'
|
76
|
+
|
77
|
+
# Offense count: 1
|
78
|
+
# Configuration parameters: Prefixes.
|
79
|
+
# Prefixes: when, with, without
|
80
|
+
RSpec/ContextWording:
|
81
|
+
Exclude:
|
82
|
+
- 'spec/labkit/middleware/sidekiq/server_spec.rb'
|
83
|
+
|
84
|
+
# Offense count: 3
|
85
|
+
# Cop supports --auto-correct.
|
86
|
+
# Configuration parameters: SkipBlocks, EnforcedStyle.
|
87
|
+
# SupportedStyles: described_class, explicit
|
88
|
+
RSpec/DescribedClass:
|
89
|
+
Exclude:
|
90
|
+
- 'spec/labkit/tracing_spec.rb'
|
91
|
+
|
92
|
+
# Offense count: 2
|
93
|
+
# Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
94
|
+
RSpec/FilePath:
|
95
|
+
Exclude:
|
96
|
+
- 'spec/labkit/httpclient_publisher_spec.rb'
|
97
|
+
- 'spec/logging/sanitizer_spec.rb'
|
98
|
+
|
99
|
+
# Offense count: 3
|
100
|
+
# Cop supports --auto-correct.
|
101
|
+
# Configuration parameters: EnforcedStyle.
|
102
|
+
# SupportedStyles: single_line_only, single_statement_only, disallow
|
103
|
+
RSpec/ImplicitSubject:
|
104
|
+
Exclude:
|
105
|
+
- 'spec/labkit/correlation/correlation_id_spec.rb'
|
106
|
+
|
107
|
+
# Offense count: 4
|
108
|
+
RSpec/LeakyConstantDeclaration:
|
109
|
+
Exclude:
|
110
|
+
- 'spec/labkit/middleware/sidekiq/client_spec.rb'
|
111
|
+
- 'spec/labkit/middleware/sidekiq/context/client_spec.rb'
|
112
|
+
- 'spec/labkit/middleware/sidekiq/context/server_spec.rb'
|
113
|
+
- 'spec/labkit/middleware/sidekiq/server_spec.rb'
|
114
|
+
|
115
|
+
# Offense count: 2
|
116
|
+
# Cop supports --auto-correct.
|
117
|
+
RSpec/LetBeforeExamples:
|
118
|
+
Exclude:
|
119
|
+
- 'spec/labkit/tracing_spec.rb'
|
120
|
+
|
121
|
+
# Offense count: 18
|
122
|
+
# Configuration parameters: AllowSubject.
|
123
|
+
RSpec/MultipleMemoizedHelpers:
|
124
|
+
Max: 7
|
125
|
+
|
126
|
+
# Offense count: 15
|
127
|
+
# Cop supports --auto-correct.
|
128
|
+
RSpec/ScatteredLet:
|
129
|
+
Exclude:
|
130
|
+
- 'spec/labkit/excon_publisher_spec.rb'
|
131
|
+
- 'spec/labkit/httpclient_publisher_spec.rb'
|
132
|
+
- 'spec/labkit/net_http_publisher_spec.rb'
|
133
|
+
|
134
|
+
# Offense count: 1
|
135
|
+
# Cop supports --auto-correct.
|
136
|
+
Rails/NegateInclude:
|
137
|
+
Exclude:
|
138
|
+
- 'spec/labkit/correlation/grpc/client_interceptor_spec.rb'
|
139
|
+
|
140
|
+
# Offense count: 3
|
141
|
+
# Cop supports --auto-correct.
|
142
|
+
# Configuration parameters: Include.
|
143
|
+
# Include: **/Rakefile, **/*.rake
|
144
|
+
Rails/RakeEnvironment:
|
145
|
+
Exclude:
|
146
|
+
- 'lib/capistrano/tasks/**/*.rake'
|
147
|
+
- 'Rakefile'
|
148
|
+
|
149
|
+
# Offense count: 1
|
150
|
+
# Configuration parameters: AllowedChars.
|
151
|
+
Style/AsciiComments:
|
152
|
+
Exclude:
|
153
|
+
- 'spec/support/grpc_service/test_service_impl.rb'
|
154
|
+
|
155
|
+
# Offense count: 1
|
156
|
+
# Cop supports --auto-correct.
|
157
|
+
Style/CaseLikeIf:
|
158
|
+
Exclude:
|
159
|
+
- 'lib/labkit/excon_publisher.rb'
|
160
|
+
|
161
|
+
# Offense count: 23
|
162
|
+
# Cop supports --auto-correct.
|
163
|
+
Style/ExplicitBlockArgument:
|
164
|
+
Exclude:
|
165
|
+
- 'lib/labkit/correlation/grpc/server_interceptor.rb'
|
166
|
+
- 'lib/labkit/logging/grpc/server_interceptor.rb'
|
167
|
+
- 'lib/labkit/middleware/sidekiq/client.rb'
|
168
|
+
- 'lib/labkit/middleware/sidekiq/context/server.rb'
|
169
|
+
- 'lib/labkit/middleware/sidekiq/server.rb'
|
170
|
+
- 'lib/labkit/middleware/sidekiq/tracing/server.rb'
|
171
|
+
- 'lib/labkit/tracing/grpc/client_interceptor.rb'
|
172
|
+
- 'lib/labkit/tracing/grpc/server_interceptor.rb'
|
173
|
+
- 'lib/labkit/tracing/redis/redis_interceptor_helper.rb'
|
174
|
+
|
175
|
+
# Offense count: 8
|
176
|
+
# Cop supports --auto-correct.
|
177
|
+
# Configuration parameters: EnforcedStyle.
|
178
|
+
# SupportedStyles: always, always_true, never
|
179
|
+
Style/FrozenStringLiteralComment:
|
180
|
+
Exclude:
|
181
|
+
- 'spec/labkit/tracing/rails/active_record/sql_instrumenter_spec.rb'
|
182
|
+
- 'spec/labkit/tracing/rails/active_support/cache_delete_instrumenter_spec.rb'
|
183
|
+
- 'spec/labkit/tracing/rails/active_support/cache_fetch_hit_instrumenter_spec.rb'
|
184
|
+
- 'spec/labkit/tracing/rails/active_support/cache_generate_instrumenter_spec.rb'
|
185
|
+
- 'spec/labkit/tracing/rails/active_support/cache_read_instrumenter_spec.rb'
|
186
|
+
- 'spec/labkit/tracing/rails/active_support/cache_write_instrumenter_spec.rb'
|
187
|
+
- 'spec/support/grpc_service/test_pb.rb'
|
188
|
+
- 'tools/update-changelog.rb'
|
189
|
+
|
190
|
+
# Offense count: 2
|
191
|
+
# Cop supports --auto-correct.
|
192
|
+
Style/GlobalStdStream:
|
193
|
+
Exclude:
|
194
|
+
- 'lib/labkit/tracing/jaeger_factory.rb'
|
195
|
+
|
196
|
+
# Offense count: 3
|
197
|
+
# Cop supports --auto-correct.
|
198
|
+
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
199
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
200
|
+
Style/HashSyntax:
|
201
|
+
Exclude:
|
202
|
+
- 'spec/labkit/excon_publisher_spec.rb'
|
203
|
+
|
204
|
+
# Offense count: 16
|
205
|
+
# Cop supports --auto-correct.
|
206
|
+
# Configuration parameters: PreferredDelimiters.
|
207
|
+
Style/PercentLiteralDelimiters:
|
208
|
+
Exclude:
|
209
|
+
- 'spec/labkit/tracing/redis/redis_interceptor_helper_spec.rb'
|
210
|
+
|
211
|
+
# Offense count: 2
|
212
|
+
# Cop supports --auto-correct.
|
213
|
+
Style/RedundantBegin:
|
214
|
+
Exclude:
|
215
|
+
- 'Rakefile'
|
216
|
+
- 'spec/labkit/net_http_publisher_spec.rb'
|
217
|
+
|
218
|
+
# Offense count: 1
|
219
|
+
# Cop supports --auto-correct.
|
220
|
+
Style/RedundantRegexpEscape:
|
221
|
+
Exclude:
|
222
|
+
- 'lib/labkit/logging/sanitizer.rb'
|
223
|
+
|
224
|
+
# Offense count: 1
|
225
|
+
# Cop supports --auto-correct.
|
226
|
+
Style/StringConcatenation:
|
227
|
+
Exclude:
|
228
|
+
- 'lib/labkit/tracing/redis/redis_interceptor_helper.rb'
|
229
|
+
|
230
|
+
# Offense count: 28
|
231
|
+
# Cop supports --auto-correct.
|
232
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
233
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
234
|
+
Style/TrailingCommaInArrayLiteral:
|
235
|
+
Exclude:
|
236
|
+
- 'spec/labkit/excon_publisher_spec.rb'
|
237
|
+
- 'spec/labkit/httpclient_publisher_spec.rb'
|
238
|
+
- 'spec/labkit/net_http_publisher_spec.rb'
|
data/Rakefile
CHANGED
data/gitlab-labkit.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|tools)/}) }
|
18
18
|
spec.require_paths = ["lib"]
|
19
|
-
spec.required_ruby_version = ">= 2.
|
19
|
+
spec.required_ruby_version = ">= 2.6.0"
|
20
20
|
|
21
21
|
# Please maintain alphabetical order for dependencies
|
22
22
|
spec.add_runtime_dependency "actionpack", ">= 5.0.0", "< 7.0.0"
|
@@ -24,12 +24,13 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency "grpc", "~> 1.19" # Be sure to update the "grpc-tools" dev_depenency too
|
25
25
|
spec.add_runtime_dependency "jaeger-client", "~> 1.1"
|
26
26
|
spec.add_runtime_dependency "opentracing", "~> 0.4"
|
27
|
-
spec.add_runtime_dependency "pg_query", "~>
|
27
|
+
spec.add_runtime_dependency "gitlab-pg_query", "~> 2.0"
|
28
28
|
spec.add_runtime_dependency "redis", ">3.0.0", "<5.0.0"
|
29
29
|
|
30
30
|
# Please maintain alphabetical order for dev dependencies
|
31
31
|
spec.add_development_dependency "excon", "~> 0.78.1"
|
32
32
|
spec.add_development_dependency "faraday", "~> 1.2.0"
|
33
|
+
spec.add_development_dependency "gitlab-styles", "~> 6.2.0"
|
33
34
|
spec.add_development_dependency "grpc-tools", "~> 1.19"
|
34
35
|
spec.add_development_dependency "httparty", "~> 0.17.3"
|
35
36
|
spec.add_development_dependency "httpclient", "~> 2.8.3"
|
@@ -37,10 +38,8 @@ Gem::Specification.new do |spec|
|
|
37
38
|
spec.add_development_dependency "rack", "~> 2.0"
|
38
39
|
spec.add_development_dependency "rake", "~> 12.3"
|
39
40
|
spec.add_development_dependency "rest-client", "~> 2.1.0"
|
40
|
-
spec.add_development_dependency "rspec", "~> 3.
|
41
|
+
spec.add_development_dependency "rspec", "~> 3.10.0"
|
41
42
|
spec.add_development_dependency "rspec-parameterized", "~> 0.4"
|
42
|
-
spec.add_development_dependency "rubocop", "~> 0.65.0"
|
43
|
-
spec.add_development_dependency "rubocop-rspec", "~> 1.22.1"
|
44
43
|
spec.add_development_dependency "rufo", "0.9.0"
|
45
44
|
spec.add_development_dependency "sidekiq", "~> 5.2.7"
|
46
45
|
end
|
data/lib/gitlab-labkit.rb
CHANGED
data/lib/labkit/context.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support/core_ext/module/delegation"
|
4
|
+
require "active_support/core_ext/string/starts_ends_with"
|
5
|
+
|
3
6
|
module Labkit
|
4
7
|
# A context can be used to provide structured information on what resources
|
5
8
|
# GitLab is working on within a service.
|
@@ -23,7 +26,7 @@ module Labkit
|
|
23
26
|
RAW_KEYS = [CORRELATION_ID_KEY].freeze
|
24
27
|
HEADER_PREFIX = "X-Gitlab-"
|
25
28
|
KNOWN_KEYS = %w[user project root_namespace subscription_plan caller_id
|
26
|
-
remote_ip related_class feature_category].freeze
|
29
|
+
remote_ip related_class feature_category client_id].freeze
|
27
30
|
|
28
31
|
class << self
|
29
32
|
def with_context(attributes = {})
|
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
# Disable the UnusedMethodArgument linter, since we need to declare the kwargs
|
4
4
|
# in the methods, but we don't actually use them.
|
5
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
6
|
-
|
7
5
|
require "grpc"
|
6
|
+
require "singleton"
|
8
7
|
|
9
8
|
module Labkit
|
10
9
|
module Correlation
|
@@ -48,5 +47,3 @@ module Labkit
|
|
48
47
|
end
|
49
48
|
end
|
50
49
|
end
|
51
|
-
|
52
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
# Disable the UnusedMethodArgument linter, since we need to declare the kwargs
|
4
4
|
# in the methods, but we don't actually use them.
|
5
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
6
5
|
|
7
6
|
require "grpc"
|
8
7
|
|
@@ -51,5 +50,3 @@ module Labkit
|
|
51
50
|
end
|
52
51
|
end
|
53
52
|
end
|
54
|
-
|
55
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
@@ -99,10 +99,12 @@ module Labkit
|
|
99
99
|
query: generate_query_string(datum[:query]),
|
100
100
|
start_time: ::Labkit::System.monotonic_time,
|
101
101
|
}
|
102
|
+
|
102
103
|
unless datum[:proxy].nil?
|
103
104
|
payload[:proxy_host] = datum[:proxy][:host]
|
104
105
|
payload[:proxy_port] = datum[:proxy][:port]
|
105
106
|
end
|
107
|
+
|
106
108
|
payload
|
107
109
|
end
|
108
110
|
|
@@ -133,7 +135,7 @@ module Labkit
|
|
133
135
|
|
134
136
|
def nil_or_int(int)
|
135
137
|
int&.to_i
|
136
|
-
rescue
|
138
|
+
rescue StandardError
|
137
139
|
nil
|
138
140
|
end
|
139
141
|
|
@@ -19,9 +19,7 @@ module Labkit
|
|
19
19
|
|
20
20
|
def self.sanitize_field(content)
|
21
21
|
content = content.gsub(URL_REGEXP) { |url| mask_url(url) }
|
22
|
-
content
|
23
|
-
|
24
|
-
content
|
22
|
+
content.gsub(SCP_URL_REGEXP) { |scp_url| mask_scp_url(scp_url) }
|
25
23
|
end
|
26
24
|
|
27
25
|
def self.sanitize_sql(sql)
|
@@ -30,6 +28,12 @@ module Labkit
|
|
30
28
|
""
|
31
29
|
end
|
32
30
|
|
31
|
+
def self.sql_fingerprint(normalized_sql)
|
32
|
+
PgQuery.parse(normalized_sql)&.fingerprint
|
33
|
+
rescue PgQuery::ParseError
|
34
|
+
""
|
35
|
+
end
|
36
|
+
|
33
37
|
# Ensures that URLS are sanitized to hide credentials
|
34
38
|
def self.mask_url(url)
|
35
39
|
url = url.to_s.strip
|
@@ -8,7 +8,8 @@ module Labkit
|
|
8
8
|
# reinstantiate a context in which the job will run.
|
9
9
|
class Server
|
10
10
|
def call(_worker_class, job, _queue)
|
11
|
-
|
11
|
+
worker_name = (job["wrapped"].presence || job["class"]).to_s
|
12
|
+
data = job.merge(Labkit::Context.log_key(:caller_id) => worker_name)
|
12
13
|
|
13
14
|
Labkit::Context.with_context(data) do |_context|
|
14
15
|
yield
|
data/lib/labkit/tracing.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
# Disable the UnusedMethodArgument linter, since we need to declare the kwargs
|
4
4
|
# in the methods, but we don't actually use them.
|
5
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
6
5
|
require "opentracing"
|
7
6
|
require "grpc"
|
7
|
+
require "singleton"
|
8
8
|
|
9
9
|
module Labkit
|
10
10
|
module Tracing
|
@@ -45,5 +45,3 @@ module Labkit
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
|
-
|
49
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
# Disable the UnusedMethodArgument linter, since we need to declare the kwargs
|
4
4
|
# in the methods, but we don't actually use them.
|
5
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
6
5
|
|
7
6
|
require "opentracing"
|
8
7
|
require "grpc"
|
@@ -60,5 +59,3 @@ module Labkit
|
|
60
59
|
end
|
61
60
|
end
|
62
61
|
end
|
63
|
-
|
64
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
@@ -14,7 +14,11 @@ module Labkit
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def tags(payload)
|
17
|
-
|
17
|
+
if Labkit::Tracing.sampled? && payload[:sql]
|
18
|
+
sql = Labkit::Logging::Sanitizer.sanitize_sql(payload[:sql])
|
19
|
+
fingerprint = Labkit::Logging::Sanitizer.sql_fingerprint(sql)
|
20
|
+
end
|
21
|
+
|
18
22
|
{
|
19
23
|
"component" => COMPONENT_TAG,
|
20
24
|
"span.kind" => "client",
|
@@ -22,6 +26,7 @@ module Labkit
|
|
22
26
|
"db.connection_id" => payload[:connection_id],
|
23
27
|
"db.cached" => payload[:cached] || false,
|
24
28
|
"db.statement" => sql,
|
29
|
+
"db.statement_fingerprint" => fingerprint,
|
25
30
|
}
|
26
31
|
end
|
27
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-labkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Newdigate
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -93,19 +93,19 @@ dependencies:
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0.4'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
name: pg_query
|
96
|
+
name: gitlab-pg_query
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
101
|
+
version: '2.0'
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '
|
108
|
+
version: '2.0'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: redis
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,6 +154,20 @@ dependencies:
|
|
154
154
|
- - "~>"
|
155
155
|
- !ruby/object:Gem::Version
|
156
156
|
version: 1.2.0
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: gitlab-styles
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - "~>"
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: 6.2.0
|
164
|
+
type: :development
|
165
|
+
prerelease: false
|
166
|
+
version_requirements: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - "~>"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: 6.2.0
|
157
171
|
- !ruby/object:Gem::Dependency
|
158
172
|
name: grpc-tools
|
159
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -258,14 +272,14 @@ dependencies:
|
|
258
272
|
requirements:
|
259
273
|
- - "~>"
|
260
274
|
- !ruby/object:Gem::Version
|
261
|
-
version: 3.
|
275
|
+
version: 3.10.0
|
262
276
|
type: :development
|
263
277
|
prerelease: false
|
264
278
|
version_requirements: !ruby/object:Gem::Requirement
|
265
279
|
requirements:
|
266
280
|
- - "~>"
|
267
281
|
- !ruby/object:Gem::Version
|
268
|
-
version: 3.
|
282
|
+
version: 3.10.0
|
269
283
|
- !ruby/object:Gem::Dependency
|
270
284
|
name: rspec-parameterized
|
271
285
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,34 +294,6 @@ dependencies:
|
|
280
294
|
- - "~>"
|
281
295
|
- !ruby/object:Gem::Version
|
282
296
|
version: '0.4'
|
283
|
-
- !ruby/object:Gem::Dependency
|
284
|
-
name: rubocop
|
285
|
-
requirement: !ruby/object:Gem::Requirement
|
286
|
-
requirements:
|
287
|
-
- - "~>"
|
288
|
-
- !ruby/object:Gem::Version
|
289
|
-
version: 0.65.0
|
290
|
-
type: :development
|
291
|
-
prerelease: false
|
292
|
-
version_requirements: !ruby/object:Gem::Requirement
|
293
|
-
requirements:
|
294
|
-
- - "~>"
|
295
|
-
- !ruby/object:Gem::Version
|
296
|
-
version: 0.65.0
|
297
|
-
- !ruby/object:Gem::Dependency
|
298
|
-
name: rubocop-rspec
|
299
|
-
requirement: !ruby/object:Gem::Requirement
|
300
|
-
requirements:
|
301
|
-
- - "~>"
|
302
|
-
- !ruby/object:Gem::Version
|
303
|
-
version: 1.22.1
|
304
|
-
type: :development
|
305
|
-
prerelease: false
|
306
|
-
version_requirements: !ruby/object:Gem::Requirement
|
307
|
-
requirements:
|
308
|
-
- - "~>"
|
309
|
-
- !ruby/object:Gem::Version
|
310
|
-
version: 1.22.1
|
311
297
|
- !ruby/object:Gem::Dependency
|
312
298
|
name: rufo
|
313
299
|
requirement: !ruby/object:Gem::Requirement
|
@@ -348,6 +334,7 @@ files:
|
|
348
334
|
- ".gitlab/CODEOWNERS"
|
349
335
|
- ".rspec"
|
350
336
|
- ".rubocop.yml"
|
337
|
+
- ".rubocop_todo.yml"
|
351
338
|
- ".ruby-version"
|
352
339
|
- ".rufo"
|
353
340
|
- Gemfile
|
@@ -428,14 +415,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
428
415
|
requirements:
|
429
416
|
- - ">="
|
430
417
|
- !ruby/object:Gem::Version
|
431
|
-
version: 2.
|
418
|
+
version: 2.6.0
|
432
419
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
433
420
|
requirements:
|
434
421
|
- - ">="
|
435
422
|
- !ruby/object:Gem::Version
|
436
423
|
version: '0'
|
437
424
|
requirements: []
|
438
|
-
rubygems_version: 3.
|
425
|
+
rubygems_version: 3.1.6
|
439
426
|
signing_key:
|
440
427
|
specification_version: 4
|
441
428
|
summary: Instrumentation for GitLab
|