gitlab-labkit 0.42.2 → 1.0.1
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/.pre-commit-config.yaml +1 -1
- data/.rubocop_todo.yml +54 -15
- data/Rakefile +7 -1
- data/gitlab-labkit.gemspec +4 -4
- data/lib/labkit/fields.rb +20 -7
- metadata +17 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fcf883261bb809a67748d4f15c2a520ae392d3d069b5852cc20abf56e428b4e
|
|
4
|
+
data.tar.gz: ce56f2ec2b2dce0b420d0096ea6b4a48b54a91c350b802a245dcc0cae9219908
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70d57193fc2778250b004df0e39f7f98ff6f1bc5356d601f664b632cd6a7e9b4f2f772b6251406702b5cea84bda6fed02ad29d1ca196f2b29462e4887ded4b6e
|
|
7
|
+
data.tar.gz: 1cd77a020fe80b311512acf08b433913f0e9a06edce05a10961c018c19a1270c9420b477731cb88d4ceb5b641ee0a6d0ad4c34fc1bee528d2febae1f83a521dd
|
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:
|
|
28
|
+
rev: v3.0 # renovate:managed
|
|
29
29
|
|
|
30
30
|
hooks:
|
|
31
31
|
- id: shellcheck # Run shellcheck for changed Shell files
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2025-
|
|
3
|
+
# on 2025-11-17 07:59:08 UTC using RuboCop version 1.71.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -25,7 +25,7 @@ Fips/SHA1:
|
|
|
25
25
|
Exclude:
|
|
26
26
|
- 'spec/labkit/fips_spec.rb'
|
|
27
27
|
|
|
28
|
-
# Offense count:
|
|
28
|
+
# Offense count: 10
|
|
29
29
|
# This cop supports safe autocorrection (--autocorrect).
|
|
30
30
|
# Configuration parameters: Include.
|
|
31
31
|
# Include: **/*.gemspec
|
|
@@ -56,11 +56,26 @@ Layout/ClassStructure:
|
|
|
56
56
|
Exclude:
|
|
57
57
|
- 'lib/labkit/tracing/rack_middleware.rb'
|
|
58
58
|
|
|
59
|
-
# Offense count:
|
|
59
|
+
# Offense count: 2
|
|
60
60
|
# This cop supports safe autocorrection (--autocorrect).
|
|
61
61
|
Layout/EmptyLineAfterMagicComment:
|
|
62
62
|
Exclude:
|
|
63
63
|
- 'lib/labkit/logging/json_logger.rb'
|
|
64
|
+
- 'spec/support/grpc_service/test_pb.rb'
|
|
65
|
+
|
|
66
|
+
# Offense count: 1
|
|
67
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
68
|
+
Layout/EmptyLines:
|
|
69
|
+
Exclude:
|
|
70
|
+
- 'spec/support/grpc_service/test_pb.rb'
|
|
71
|
+
|
|
72
|
+
# Offense count: 1
|
|
73
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
74
|
+
# Configuration parameters: EnforcedStyle.
|
|
75
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
|
76
|
+
Layout/EmptyLinesAroundClassBody:
|
|
77
|
+
Exclude:
|
|
78
|
+
- 'spec/support/grpc_service/test_services_pb.rb'
|
|
64
79
|
|
|
65
80
|
# Offense count: 1
|
|
66
81
|
# This cop supports safe autocorrection (--autocorrect).
|
|
@@ -144,7 +159,8 @@ Lint/UnexpectedBlockArity:
|
|
|
144
159
|
|
|
145
160
|
# Offense count: 41
|
|
146
161
|
# This cop supports safe autocorrection (--autocorrect).
|
|
147
|
-
# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
|
162
|
+
# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
|
|
163
|
+
# NotImplementedExceptions: NotImplementedError
|
|
148
164
|
Lint/UnusedMethodArgument:
|
|
149
165
|
Exclude:
|
|
150
166
|
- 'lib/labkit/correlation/grpc/client_interceptor.rb'
|
|
@@ -254,7 +270,7 @@ RSpec/LetBeforeExamples:
|
|
|
254
270
|
Exclude:
|
|
255
271
|
- 'spec/labkit/tracing_spec.rb'
|
|
256
272
|
|
|
257
|
-
# Offense count:
|
|
273
|
+
# Offense count: 31
|
|
258
274
|
# Configuration parameters: AllowSubject.
|
|
259
275
|
RSpec/MultipleMemoizedHelpers:
|
|
260
276
|
Max: 8
|
|
@@ -326,7 +342,7 @@ Rails/NegateInclude:
|
|
|
326
342
|
Exclude:
|
|
327
343
|
- 'spec/labkit/correlation/grpc/client_interceptor_spec.rb'
|
|
328
344
|
|
|
329
|
-
# Offense count:
|
|
345
|
+
# Offense count: 2
|
|
330
346
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
331
347
|
# Configuration parameters: Include.
|
|
332
348
|
# Include: **/Rakefile, **/*.rake
|
|
@@ -361,6 +377,14 @@ Style/AsciiComments:
|
|
|
361
377
|
Exclude:
|
|
362
378
|
- 'spec/support/grpc_service/test_service_impl.rb'
|
|
363
379
|
|
|
380
|
+
# Offense count: 7
|
|
381
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
382
|
+
# Configuration parameters: EnforcedStyle.
|
|
383
|
+
# SupportedStyles: allow_single_line, allow_always, disallow
|
|
384
|
+
Style/EndlessMethod:
|
|
385
|
+
Exclude:
|
|
386
|
+
- 'lib/labkit/user_experience_sli/null.rb'
|
|
387
|
+
|
|
364
388
|
# Offense count: 3
|
|
365
389
|
# This cop supports safe autocorrection (--autocorrect).
|
|
366
390
|
# Configuration parameters: AllowedVars.
|
|
@@ -369,6 +393,15 @@ Style/FetchEnvVar:
|
|
|
369
393
|
- 'lib/labkit/tracing.rb'
|
|
370
394
|
- 'spec/helpers/stub_env.rb'
|
|
371
395
|
|
|
396
|
+
# Offense count: 5
|
|
397
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
398
|
+
Style/FileNull:
|
|
399
|
+
Exclude:
|
|
400
|
+
- 'spec/labkit/logging/json_logger_spec.rb'
|
|
401
|
+
- 'spec/labkit/middleware/sidekiq/user_experience_sli/client_spec.rb'
|
|
402
|
+
- 'spec/labkit/middleware/sidekiq/user_experience_sli/server_spec.rb'
|
|
403
|
+
- 'spec/spec_helper.rb'
|
|
404
|
+
|
|
372
405
|
# Offense count: 8
|
|
373
406
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
374
407
|
# Configuration parameters: EnforcedStyle.
|
|
@@ -381,7 +414,7 @@ Style/FrozenStringLiteralComment:
|
|
|
381
414
|
- 'spec/labkit/tracing/rails/active_support/cache_generate_instrumenter_spec.rb'
|
|
382
415
|
- 'spec/labkit/tracing/rails/active_support/cache_read_instrumenter_spec.rb'
|
|
383
416
|
- 'spec/labkit/tracing/rails/active_support/cache_write_instrumenter_spec.rb'
|
|
384
|
-
- 'spec/support/grpc_service/
|
|
417
|
+
- 'spec/support/grpc_service/test_services_pb.rb'
|
|
385
418
|
- 'tools/update-changelog.rb'
|
|
386
419
|
|
|
387
420
|
# Offense count: 2
|
|
@@ -397,7 +430,7 @@ Style/GuardClause:
|
|
|
397
430
|
Exclude:
|
|
398
431
|
- 'lib/labkit/logging/json_logger.rb'
|
|
399
432
|
|
|
400
|
-
# Offense count:
|
|
433
|
+
# Offense count: 33
|
|
401
434
|
# This cop supports safe autocorrection (--autocorrect).
|
|
402
435
|
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
403
436
|
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
@@ -408,7 +441,6 @@ Style/HashSyntax:
|
|
|
408
441
|
- 'lib/labkit/tracing/tracing_utils.rb'
|
|
409
442
|
- 'spec/labkit/tracing/rack_middleware_spec.rb'
|
|
410
443
|
- 'spec/labkit/tracing/redis/redis_interceptor_helper_spec.rb'
|
|
411
|
-
- 'spec/support/grpc_service/test_pb.rb'
|
|
412
444
|
- 'spec/support/tracing/shared_examples.rb'
|
|
413
445
|
|
|
414
446
|
# Offense count: 1
|
|
@@ -459,11 +491,12 @@ Style/RedundantBegin:
|
|
|
459
491
|
Exclude:
|
|
460
492
|
- 'spec/labkit/net_http_publisher_spec.rb'
|
|
461
493
|
|
|
462
|
-
# Offense count:
|
|
494
|
+
# Offense count: 4
|
|
463
495
|
# This cop supports safe autocorrection (--autocorrect).
|
|
464
496
|
Style/RedundantConstantBase:
|
|
465
497
|
Exclude:
|
|
466
498
|
- 'spec/labkit/logging/grpc/server_interceptor_spec.rb'
|
|
499
|
+
- 'spec/support/grpc_service/test_pb.rb'
|
|
467
500
|
|
|
468
501
|
# Offense count: 3
|
|
469
502
|
# This cop supports safe autocorrection (--autocorrect).
|
|
@@ -491,6 +524,12 @@ Style/RedundantReturn:
|
|
|
491
524
|
Exclude:
|
|
492
525
|
- 'lib/labkit/tracing/jaeger_factory.rb'
|
|
493
526
|
|
|
527
|
+
# Offense count: 1
|
|
528
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
529
|
+
Style/RedundantStringEscape:
|
|
530
|
+
Exclude:
|
|
531
|
+
- 'spec/support/grpc_service/test_pb.rb'
|
|
532
|
+
|
|
494
533
|
# Offense count: 3
|
|
495
534
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
496
535
|
# Configuration parameters: Mode.
|
|
@@ -519,7 +558,7 @@ Style/SymbolLiteral:
|
|
|
519
558
|
- 'lib/labkit/tracing/tracing_utils.rb'
|
|
520
559
|
- 'spec/support/tracing/shared_examples.rb'
|
|
521
560
|
|
|
522
|
-
# Offense count:
|
|
561
|
+
# Offense count: 42
|
|
523
562
|
# This cop supports safe autocorrection (--autocorrect).
|
|
524
563
|
# Configuration parameters: EnforcedStyleForMultiline.
|
|
525
564
|
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
@@ -545,16 +584,16 @@ Style/TrailingCommaInArrayLiteral:
|
|
|
545
584
|
- 'spec/labkit/tracing/rails/active_support/cache_generate_instrumenter_spec.rb'
|
|
546
585
|
- 'spec/labkit/tracing/rails/active_support/cache_write_instrumenter_spec.rb'
|
|
547
586
|
|
|
548
|
-
# Offense count:
|
|
587
|
+
# Offense count: 85
|
|
549
588
|
# This cop supports safe autocorrection (--autocorrect).
|
|
550
589
|
# Configuration parameters: EnforcedStyleForMultiline.
|
|
551
590
|
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
552
591
|
Style/TrailingCommaInHashLiteral:
|
|
553
592
|
Enabled: false
|
|
554
593
|
|
|
555
|
-
# Offense count:
|
|
594
|
+
# Offense count: 75
|
|
556
595
|
# This cop supports safe autocorrection (--autocorrect).
|
|
557
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
|
596
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
|
558
597
|
# URISchemes: http, https
|
|
559
598
|
Layout/LineLength:
|
|
560
|
-
Max:
|
|
599
|
+
Max: 567
|
data/Rakefile
CHANGED
|
@@ -18,7 +18,13 @@ end
|
|
|
18
18
|
desc "Generate test protobuf stubs"
|
|
19
19
|
task :gen_test_proto do
|
|
20
20
|
system "grpc_tools_ruby_protoc --ruby_out=. --grpc_out=. spec/support/grpc_service/test.proto"
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
# Fix require statement to use require_relative for test environment.
|
|
23
|
+
# This is a workaround for https://github.com/grpc/grpc/issues/29027.
|
|
24
|
+
services_file = "spec/support/grpc_service/test_services_pb.rb"
|
|
25
|
+
content = File.read(services_file)
|
|
26
|
+
content.gsub!(%r{^require ['"]spec/support/grpc_service/test_pb['"]$}, "require_relative 'test_pb'")
|
|
27
|
+
File.write(services_file, content)
|
|
22
28
|
end
|
|
23
29
|
|
|
24
30
|
task :fix => ["rubocop:autocorrect"]
|
data/gitlab-labkit.gemspec
CHANGED
|
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
# Please maintain alphabetical order for dependencies
|
|
23
23
|
spec.add_runtime_dependency "actionpack", ">= 5.0.0", "< 8.1.0"
|
|
24
24
|
spec.add_runtime_dependency "activesupport", ">= 5.0.0", "< 8.1.0"
|
|
25
|
-
spec.add_runtime_dependency "grpc", ">= 1.
|
|
26
|
-
spec.add_runtime_dependency "google-protobuf", "
|
|
25
|
+
spec.add_runtime_dependency "grpc", ">= 1.75" # Be sure to update the "grpc-tools" dev_dependency too
|
|
26
|
+
spec.add_runtime_dependency "google-protobuf", ">= 3.25", "< 5.0"
|
|
27
27
|
spec.add_runtime_dependency "jaeger-client", "~> 1.1.0"
|
|
28
28
|
spec.add_runtime_dependency 'json-schema', '~> 5.1'
|
|
29
29
|
spec.add_runtime_dependency "opentracing", "~> 0.4"
|
|
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
spec.add_development_dependency "excon", "~> 0.78.1"
|
|
36
36
|
spec.add_development_dependency "faraday", "~> 1.10.3"
|
|
37
37
|
spec.add_development_dependency "gitlab-dangerfiles", "~> 2.11.0"
|
|
38
|
-
spec.add_development_dependency "gitlab-styles", "~> 13.
|
|
39
|
-
spec.add_development_dependency "grpc-tools", ">= 1.
|
|
38
|
+
spec.add_development_dependency "gitlab-styles", "~> 13.1"
|
|
39
|
+
spec.add_development_dependency "grpc-tools", ">= 1.75"
|
|
40
40
|
spec.add_development_dependency "httparty", "~> 0.22.0"
|
|
41
41
|
spec.add_development_dependency "httpclient", "~> 2.9.0"
|
|
42
42
|
spec.add_development_dependency "irb", "~> 1.15.2"
|
data/lib/labkit/fields.rb
CHANGED
|
@@ -18,24 +18,37 @@ module Labkit
|
|
|
18
18
|
# data[Labkit::Fields::GL_USER_ID] = user.id
|
|
19
19
|
# ...
|
|
20
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/
|
|
21
30
|
module Fields
|
|
22
31
|
# correlation_id - string
|
|
23
32
|
#
|
|
33
|
+
# correlation_id - string
|
|
24
34
|
# This field is used to correlate
|
|
25
35
|
# the logs emitted by all of our systems.
|
|
26
|
-
#
|
|
27
36
|
# This should be present in all log line
|
|
28
37
|
# emissions.
|
|
29
38
|
CORRELATION_ID = "correlation_id"
|
|
30
39
|
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
# [endpoint_id, duration_s, status_code]
|
|
34
|
-
|
|
35
|
-
# gl_user_id - integer
|
|
40
|
+
# GitLabUserID - an integer field that
|
|
41
|
+
# captures the user's numeric ID for logging purposes.
|
|
36
42
|
GL_USER_ID = "gl_user_id"
|
|
37
43
|
|
|
38
|
-
#
|
|
44
|
+
# GitLabUserName - a string field that
|
|
45
|
+
# captures the user's username for logging purposes.
|
|
39
46
|
GL_USER_NAME = "gl_user_name"
|
|
47
|
+
|
|
48
|
+
# New fields being added to this section should have
|
|
49
|
+
# the appropriate doc comments added above. These
|
|
50
|
+
# should clearly indicate what the intended use of the
|
|
51
|
+
# field is and should be replicated across the labkit
|
|
52
|
+
# variations.
|
|
40
53
|
end
|
|
41
54
|
end
|
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: 0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Newdigate
|
|
@@ -55,28 +55,34 @@ dependencies:
|
|
|
55
55
|
requirements:
|
|
56
56
|
- - ">="
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
|
-
version: '1.
|
|
58
|
+
version: '1.75'
|
|
59
59
|
type: :runtime
|
|
60
60
|
prerelease: false
|
|
61
61
|
version_requirements: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements:
|
|
63
63
|
- - ">="
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: '1.
|
|
65
|
+
version: '1.75'
|
|
66
66
|
- !ruby/object:Gem::Dependency
|
|
67
67
|
name: google-protobuf
|
|
68
68
|
requirement: !ruby/object:Gem::Requirement
|
|
69
69
|
requirements:
|
|
70
|
-
- - "
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '3.25'
|
|
73
|
+
- - "<"
|
|
71
74
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '
|
|
75
|
+
version: '5.0'
|
|
73
76
|
type: :runtime
|
|
74
77
|
prerelease: false
|
|
75
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
76
79
|
requirements:
|
|
77
|
-
- - "
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.25'
|
|
83
|
+
- - "<"
|
|
78
84
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: '
|
|
85
|
+
version: '5.0'
|
|
80
86
|
- !ruby/object:Gem::Dependency
|
|
81
87
|
name: jaeger-client
|
|
82
88
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -221,28 +227,28 @@ dependencies:
|
|
|
221
227
|
requirements:
|
|
222
228
|
- - "~>"
|
|
223
229
|
- !ruby/object:Gem::Version
|
|
224
|
-
version: 13.
|
|
230
|
+
version: '13.1'
|
|
225
231
|
type: :development
|
|
226
232
|
prerelease: false
|
|
227
233
|
version_requirements: !ruby/object:Gem::Requirement
|
|
228
234
|
requirements:
|
|
229
235
|
- - "~>"
|
|
230
236
|
- !ruby/object:Gem::Version
|
|
231
|
-
version: 13.
|
|
237
|
+
version: '13.1'
|
|
232
238
|
- !ruby/object:Gem::Dependency
|
|
233
239
|
name: grpc-tools
|
|
234
240
|
requirement: !ruby/object:Gem::Requirement
|
|
235
241
|
requirements:
|
|
236
242
|
- - ">="
|
|
237
243
|
- !ruby/object:Gem::Version
|
|
238
|
-
version: '1.
|
|
244
|
+
version: '1.75'
|
|
239
245
|
type: :development
|
|
240
246
|
prerelease: false
|
|
241
247
|
version_requirements: !ruby/object:Gem::Requirement
|
|
242
248
|
requirements:
|
|
243
249
|
- - ">="
|
|
244
250
|
- !ruby/object:Gem::Version
|
|
245
|
-
version: '1.
|
|
251
|
+
version: '1.75'
|
|
246
252
|
- !ruby/object:Gem::Dependency
|
|
247
253
|
name: httparty
|
|
248
254
|
requirement: !ruby/object:Gem::Requirement
|