gitlab-labkit 0.0.6 → 0.1.0.pre.1.pre.gcb57c95
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 +1 -0
- data/.rubocop.yml +165 -4
- data/.rufo +3 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/Rakefile +26 -13
- data/gitlab-labkit.gemspec +24 -22
- data/lib/gitlab-labkit.rb +11 -6
- data/lib/labkit/correlation.rb +2 -1
- data/lib/labkit/correlation/correlation_id.rb +4 -2
- data/lib/labkit/logging.rb +3 -1
- data/lib/labkit/logging/sanitizer.rb +37 -9
- data/lib/labkit/tracing.rb +16 -26
- data/lib/labkit/tracing/common.rb +7 -6
- data/lib/labkit/tracing/factory.rb +7 -4
- data/lib/labkit/tracing/grpc_interceptor.rb +12 -7
- data/lib/labkit/tracing/jaeger_factory.rb +9 -9
- data/lib/labkit/tracing/rack_middleware.rb +9 -6
- data/lib/labkit/tracing/rails.rb +12 -0
- data/lib/labkit/tracing/rails/action_view_subscriber.rb +16 -14
- data/lib/labkit/tracing/rails/active_record_subscriber.rb +11 -9
- data/lib/labkit/tracing/rails/rails_common.rb +3 -1
- data/lib/labkit/tracing/sidekiq.rb +13 -0
- data/lib/labkit/tracing/sidekiq/client_middleware.rb +7 -4
- data/lib/labkit/tracing/sidekiq/server_middleware.rb +7 -4
- data/lib/labkit/tracing/sidekiq/sidekiq_common.rb +7 -6
- metadata +26 -24
- data/.prettierrc +0 -3
- data/package-lock.json +0 -22
- data/package.json +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdc219ab5591aa5c36aa15d9c25957a96f18641a75d0ebca11b21bb7c6d17ae9
|
4
|
+
data.tar.gz: cb403516333c2be36ac1a4e2ece02a941876b2f70a40a695ce8ef770bc66aa33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49907af513fabb133b8ab1efb8c1a070d6266a89d241a945933d02ac200608cdab7234e365458b71764b40833b48633329340c9b3390e1131998aead6203b866
|
7
|
+
data.tar.gz: e97d6bcb51c7f4c4705de887e5519b7c4678d2c00ebaa58fd48a35aadca8cdb666557b394de65cb5cbdf8d6e9f2fd1a5e9d0b5b1156220ef7bd1945672220108
|
data/.gitlab-ci.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,173 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
|
1
4
|
require:
|
2
5
|
- rubocop-rspec
|
3
6
|
|
4
|
-
inherit_gem:
|
5
|
-
gitlab-styles:
|
6
|
-
- rubocop-default.yml
|
7
|
-
|
8
7
|
Style/HashSyntax:
|
9
8
|
EnforcedStyle: no_mixed_keys
|
10
9
|
|
11
10
|
Style/SymbolLiteral:
|
12
11
|
Enabled: No
|
12
|
+
|
13
|
+
Style/TrailingCommaInArguments:
|
14
|
+
Enabled: No # Delegated to rufo
|
15
|
+
|
16
|
+
Style/TrailingCommaInHashLiteral:
|
17
|
+
Enabled: No # Delegated to rufo
|
18
|
+
|
19
|
+
Style/FrozenStringLiteralComment:
|
20
|
+
EnforcedStyle: always
|
21
|
+
|
22
|
+
Style/TrailingCommaInArrayLiteral:
|
23
|
+
EnforcedStyleForMultiline: comma
|
24
|
+
|
25
|
+
Style/StringLiterals:
|
26
|
+
EnforcedStyle: double_quotes
|
27
|
+
|
28
|
+
Style/StringLiteralsInInterpolation:
|
29
|
+
EnforcedStyle: double_quotes
|
30
|
+
|
31
|
+
Layout/MultilineMethodCallIndentation:
|
32
|
+
Enabled: No
|
33
|
+
|
34
|
+
Layout/SpaceInLambdaLiteral:
|
35
|
+
Enabled: No
|
36
|
+
|
37
|
+
Layout/SpaceInsideBlockBraces:
|
38
|
+
Enabled: No
|
39
|
+
|
40
|
+
Layout/FirstParameterIndentation:
|
41
|
+
Enabled: No
|
42
|
+
|
43
|
+
Metrics/AbcSize:
|
44
|
+
Enabled: true
|
45
|
+
Max: 54.28
|
46
|
+
|
47
|
+
Metrics/BlockLength:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Metrics/BlockNesting:
|
51
|
+
Enabled: true
|
52
|
+
Max: 4
|
53
|
+
|
54
|
+
Metrics/ClassLength:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Metrics/CyclomaticComplexity:
|
58
|
+
Enabled: true
|
59
|
+
Max: 13
|
60
|
+
|
61
|
+
Metrics/LineLength:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
Metrics/MethodLength:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
Metrics/ModuleLength:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
Metrics/ParameterLists:
|
71
|
+
Enabled: true
|
72
|
+
Max: 8
|
73
|
+
|
74
|
+
Metrics/PerceivedComplexity:
|
75
|
+
Enabled: true
|
76
|
+
Max: 14
|
77
|
+
|
78
|
+
RSpec/AnyInstance:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
RSpec/BeEql:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
RSpec/BeforeAfterAll:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
RSpec/DescribeClass:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
RSpec/DescribeMethod:
|
91
|
+
Enabled: false
|
92
|
+
|
93
|
+
RSpec/DescribeSymbol:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
RSpec/DescribedClass:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
RSpec/EmptyExampleGroup:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
RSpec/ExampleLength:
|
103
|
+
Enabled: false
|
104
|
+
Max: 5
|
105
|
+
|
106
|
+
RSpec/ExampleWording:
|
107
|
+
Enabled: false
|
108
|
+
CustomTransform:
|
109
|
+
be: is
|
110
|
+
have: has
|
111
|
+
not: does not
|
112
|
+
IgnoredWords: []
|
113
|
+
|
114
|
+
RSpec/ExpectActual:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
RSpec/ExpectOutput:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
RSpec/FilePath:
|
121
|
+
Enabled: true
|
122
|
+
IgnoreMethods: true
|
123
|
+
|
124
|
+
RSpec/Focus:
|
125
|
+
Enabled: true
|
126
|
+
|
127
|
+
RSpec/HookArgument:
|
128
|
+
Enabled: true
|
129
|
+
EnforcedStyle: implicit
|
130
|
+
|
131
|
+
RSpec/ImplicitExpect:
|
132
|
+
Enabled: true
|
133
|
+
EnforcedStyle: is_expected
|
134
|
+
|
135
|
+
RSpec/InstanceVariable:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
RSpec/LeadingSubject:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
RSpec/LetSetup:
|
142
|
+
Enabled: false
|
143
|
+
|
144
|
+
RSpec/MessageChain:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
RSpec/MessageSpies:
|
148
|
+
Enabled: false
|
149
|
+
|
150
|
+
RSpec/MultipleDescribes:
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
RSpec/MultipleExpectations:
|
154
|
+
Enabled: false
|
155
|
+
|
156
|
+
RSpec/NamedSubject:
|
157
|
+
Enabled: false
|
158
|
+
|
159
|
+
RSpec/NestedGroups:
|
160
|
+
Enabled: false
|
161
|
+
|
162
|
+
RSpec/NotToNot:
|
163
|
+
EnforcedStyle: not_to
|
164
|
+
Enabled: true
|
165
|
+
|
166
|
+
RSpec/RepeatedDescription:
|
167
|
+
Enabled: false
|
168
|
+
|
169
|
+
RSpec/SubjectStub:
|
170
|
+
Enabled: false
|
171
|
+
|
172
|
+
RSpec/VerifiedDoubles:
|
173
|
+
Enabled: false
|
data/.rufo
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016-2019 GitLab B.V.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# LabKit-Ruby 🔬🔬🔬🔬🔬
|
2
|
+
|
3
|
+
LabKit-Ruby is minimalist library to provide functionality for Ruby services at GitLab.
|
4
|
+
|
5
|
+
LabKit-Ruby is the Ruby companion for [LabKit](https://gitlab.com/gitlab-org/labkit), a minimalist library to provide functionality for Go services at GitLab.
|
6
|
+
|
7
|
+
LabKit-Ruby and LabKit are intended to provide similar functionality, but use the semantics of their respective languages, so are not intended to provide identical APIS.
|
8
|
+
|
9
|
+
## Documentation
|
10
|
+
|
11
|
+
API Documentation is available at [the Rubydoc site](https://www.rubydoc.info/gems/gitlab-labkit/).
|
12
|
+
|
13
|
+
## Functionality
|
14
|
+
|
15
|
+
LabKit-Ruby provides functionality in three areas:
|
16
|
+
|
17
|
+
1. `Labkit::Correlation` for handling and propagating Correlation-IDs.
|
18
|
+
1. `Labkit::Logging` for sanitizing log messages.
|
19
|
+
1. `Labkit::Tracing` for handling and propagating distributed traces.
|
20
|
+
|
21
|
+
## Developing
|
22
|
+
|
23
|
+
Anyone can contribute!
|
24
|
+
|
25
|
+
```console
|
26
|
+
$ git clone git@gitlab.com:gitlab-org/labkit-ruby.git
|
27
|
+
$ cd labkit-ruby
|
28
|
+
$ bundle install
|
29
|
+
|
30
|
+
$ # Autoformat code and auto-correct linters
|
31
|
+
$ bundle exec rake fix
|
32
|
+
|
33
|
+
$ # Run tests, linters
|
34
|
+
$ bundle exec rake verify
|
35
|
+
```
|
36
|
+
|
37
|
+
Note that LabKit-Ruby uses the [`rufo`](https://github.com/ruby-formatter/rufo) for auto-formatting. Please run `bundle exec rake fix` to auto-format your code before pushing.
|
38
|
+
|
39
|
+
Please also review the [development section of the LabKit (go) README](https://gitlab.com/gitlab-org/labkit#developing-labkit) for details of the LabKit architectural philosophy.
|
data/Rakefile
CHANGED
@@ -1,28 +1,41 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
+
require "rufo"
|
4
5
|
|
5
6
|
begin
|
6
|
-
require
|
7
|
+
require "rspec/core/rake_task"
|
7
8
|
RSpec::Core::RakeTask.new(:spec)
|
8
|
-
rescue LoadError
|
9
9
|
end
|
10
10
|
|
11
|
-
require
|
11
|
+
require "rubocop/rake_task"
|
12
12
|
RuboCop::RakeTask.new
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
desc "Alias for `rake rufo:run`"
|
15
|
+
task :format => ["rufo:run"]
|
16
|
+
|
17
|
+
namespace :rufo do
|
18
|
+
require "rufo"
|
19
|
+
|
20
|
+
def rufo_command(*switches, rake_args)
|
21
|
+
files_or_dirs = rake_args[:files_or_dirs] || "."
|
22
|
+
args = switches + files_or_dirs.split(" ")
|
23
|
+
Rufo::Command.run(args)
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Format Ruby code in current directory"
|
27
|
+
task :run, [:files_or_dirs] do |_task, rake_args|
|
28
|
+
rufo_command(rake_args)
|
29
|
+
end
|
18
30
|
|
19
|
-
|
20
|
-
|
21
|
-
|
31
|
+
desc "Check that no formatting changes are produced"
|
32
|
+
task :check, [:files_or_dirs] do |_task, rake_args|
|
33
|
+
rufo_command("--check", rake_args)
|
34
|
+
end
|
22
35
|
end
|
23
36
|
|
24
|
-
task :
|
37
|
+
task :fix => %w[rufo:run rubocop:auto_correct]
|
25
38
|
|
26
|
-
task :
|
39
|
+
task :verify => %w[spec rufo:check rubocop]
|
27
40
|
|
28
|
-
task :
|
41
|
+
task :default => %w[verify build]
|
data/gitlab-labkit.gemspec
CHANGED
@@ -1,31 +1,33 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
|
4
6
|
Gem::Specification.new do |spec|
|
5
|
-
spec.name
|
6
|
-
spec.version
|
7
|
-
spec.authors
|
8
|
-
spec.email
|
7
|
+
spec.name = "gitlab-labkit"
|
8
|
+
spec.version = `git describe --tags`.chomp.gsub(/^v/,"")
|
9
|
+
spec.authors = ["Andrew Newdigate"]
|
10
|
+
spec.email = ["andrew@gitlab.com"]
|
9
11
|
|
10
|
-
spec.summary
|
11
|
-
spec.homepage
|
12
|
-
spec.license
|
12
|
+
spec.summary = "Instrumentation for GitLab"
|
13
|
+
spec.homepage = "http://about.gitlab.com"
|
14
|
+
spec.license = "MIT"
|
13
15
|
|
14
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|tools)/}) }
|
15
17
|
spec.require_paths = ["lib"]
|
16
|
-
spec.required_ruby_version =
|
18
|
+
spec.required_ruby_version = ">= 2.4.0"
|
17
19
|
|
18
|
-
spec.add_runtime_dependency
|
19
|
-
spec.add_runtime_dependency
|
20
|
-
spec.add_runtime_dependency
|
21
|
-
spec.add_runtime_dependency
|
22
|
-
spec.add_runtime_dependency
|
20
|
+
spec.add_runtime_dependency "actionpack", "~> 5"
|
21
|
+
spec.add_runtime_dependency "activesupport", "~> 5"
|
22
|
+
spec.add_runtime_dependency "grpc", "~> 1.15"
|
23
|
+
spec.add_runtime_dependency "jaeger-client", "~> 0.10"
|
24
|
+
spec.add_runtime_dependency "opentracing", "~> 0.4"
|
23
25
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
26
|
+
spec.add_development_dependency "rack", "~> 2.0"
|
27
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.6.0"
|
29
|
+
spec.add_development_dependency "rspec-parameterized", "~> 0.4"
|
30
|
+
spec.add_development_dependency "rubocop", "~> 0.65.0"
|
31
|
+
spec.add_development_dependency "rubocop-rspec", "~> 1.22.1"
|
32
|
+
spec.add_development_dependency "rufo", "~> 0.5"
|
31
33
|
end
|
data/lib/gitlab-labkit.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
# https://guides.rubyonrails.org/active_support_core_extensions.html
|
2
|
-
require 'active_support/all'
|
3
|
-
|
4
1
|
# rubocop:disable Naming/FileName
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "active_support/all"
|
5
|
+
|
6
|
+
# LabKit is a module for handling cross-project
|
7
|
+
# infrastructural concerns, partcularly related to
|
8
|
+
# observability.
|
5
9
|
module Labkit
|
6
|
-
autoload :Correlation,
|
7
|
-
autoload :Tracing,
|
8
|
-
autoload :Logging,
|
10
|
+
autoload :Correlation, "labkit/correlation"
|
11
|
+
autoload :Tracing, "labkit/tracing"
|
12
|
+
autoload :Logging, "labkit/logging"
|
9
13
|
end
|
14
|
+
|
10
15
|
# rubocop:enable Naming/FileName
|
data/lib/labkit/correlation.rb
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
|
3
3
|
module Labkit
|
4
4
|
module Correlation
|
5
|
+
# CorrelationId module provides access the Correlation-ID
|
6
|
+
# of the current request
|
5
7
|
module CorrelationId
|
6
|
-
LOG_KEY =
|
8
|
+
LOG_KEY = "correlation_id"
|
7
9
|
|
8
10
|
class << self
|
9
|
-
def use_id(correlation_id, &
|
11
|
+
def use_id(correlation_id, &_blk)
|
10
12
|
# always generate a id if null is passed
|
11
13
|
correlation_id ||= new_id
|
12
14
|
|
data/lib/labkit/logging.rb
CHANGED
@@ -2,24 +2,52 @@
|
|
2
2
|
|
3
3
|
module Labkit
|
4
4
|
module Logging
|
5
|
+
# Sanitizer provides log message sanitization, removing
|
6
|
+
# confidential information from log messages
|
5
7
|
class Sanitizer
|
8
|
+
SCP_URL_REGEXP = %r{
|
9
|
+
(?:((?:[\-_.!~*()a-zA-Z\d;&=+$,]|%[a-fA-F\d]{2})+)(:(?:(?:[\-_.!~*()a-zA-Z\d;:&=+$,]|%[a-fA-F\d]{2})*))?@) (?# 1: username, 2: password)
|
10
|
+
(?:((?:(?:[a-zA-Z0-9\-._])+|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:(?:[a-fA-F\d]{1,4}:)*[a-fA-F\d]{1,4})?::(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))?)\]))) (?# 3: host)
|
11
|
+
:
|
12
|
+
((?:[\-_.!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*(?:;(?:[\-_.!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*)*(?:\/(?:[\-_.!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*(?:;(?:[\-_.!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*)*)*)? (?# 4: path)
|
13
|
+
}x.freeze
|
14
|
+
SCP_ANCHORED_URL_REGEXP = /^#{SCP_URL_REGEXP}$/x.freeze
|
6
15
|
ALLOWED_SCHEMES = %w[http https ssh git].freeze
|
16
|
+
URL_REGEXP = URI::DEFAULT_PARSER.make_regexp(ALLOWED_SCHEMES).freeze
|
7
17
|
|
8
18
|
def self.sanitize_field(content)
|
9
|
-
|
19
|
+
content = content.gsub(URL_REGEXP) { |url| mask_url(url) }
|
20
|
+
content = content.gsub(SCP_URL_REGEXP) { |scp_url| mask_scp_url(scp_url) }
|
10
21
|
|
11
|
-
content
|
22
|
+
content
|
12
23
|
end
|
13
24
|
|
14
|
-
|
25
|
+
# Ensures that URLS are sanitized to hide credentials
|
26
|
+
def self.mask_url(url)
|
15
27
|
url = url.to_s.strip
|
16
|
-
|
28
|
+
p = URI::DEFAULT_PARSER.parse(url)
|
17
29
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
rescue
|
22
|
-
|
30
|
+
p.password = "*****" if p.password.present?
|
31
|
+
p.user = "*****" if p.user.present?
|
32
|
+
p.to_s
|
33
|
+
rescue URI::InvalidURIError
|
34
|
+
""
|
35
|
+
end
|
36
|
+
|
37
|
+
# Ensures that URLs of the form user:password@hostname:project.git are
|
38
|
+
# sanitized to hide credentials
|
39
|
+
def self.mask_scp_url(scp_url)
|
40
|
+
scp_url = scp_url.to_s.strip
|
41
|
+
m = SCP_ANCHORED_URL_REGEXP.match(scp_url)
|
42
|
+
return "" unless m
|
43
|
+
|
44
|
+
password = m[2]
|
45
|
+
host = m[3]
|
46
|
+
path = m[4]
|
47
|
+
|
48
|
+
return "*****@#{host}:#{path}" unless password.present?
|
49
|
+
|
50
|
+
"*****:*****@#{host}:#{path}"
|
23
51
|
end
|
24
52
|
end
|
25
53
|
end
|
data/lib/labkit/tracing.rb
CHANGED
@@ -1,41 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "active_support/all"
|
4
4
|
|
5
5
|
module Labkit
|
6
|
+
# Tracing provides distributed tracing functionality
|
6
7
|
module Tracing
|
7
|
-
autoload :Common,
|
8
|
-
autoload :Factory,
|
9
|
-
autoload :GRPCInterceptor,
|
10
|
-
autoload :JaegerFactory,
|
11
|
-
autoload :RackMiddleware,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
autoload :RailsCommon, 'labkit/tracing/rails/rails_common'
|
17
|
-
end
|
18
|
-
|
19
|
-
module Sidekiq
|
20
|
-
autoload :ClientMiddleware, 'labkit/tracing/sidekiq/client_middleware'
|
21
|
-
autoload :ServerMiddleware, 'labkit/tracing/sidekiq/server_middleware'
|
22
|
-
autoload :SidekiqCommon, 'labkit/tracing/sidekiq/sidekiq_common'
|
23
|
-
end
|
24
|
-
|
25
|
-
# Only enable tracing when the `GITLAB_TRACING` env var is configured. Note that we avoid using ApplicationSettings since
|
26
|
-
# the same environment variable needs to be configured for Workhorse, Gitaly and any other components which
|
27
|
-
# emit tracing. Since other components may start before Rails, and may not have access to ApplicationSettings,
|
28
|
-
# an env var makes more sense.
|
8
|
+
autoload :Common, "labkit/tracing/common"
|
9
|
+
autoload :Factory, "labkit/tracing/factory"
|
10
|
+
autoload :GRPCInterceptor, "labkit/tracing/grpc_interceptor"
|
11
|
+
autoload :JaegerFactory, "labkit/tracing/jaeger_factory"
|
12
|
+
autoload :RackMiddleware, "labkit/tracing/rack_middleware"
|
13
|
+
autoload :Rails, "labkit/tracing/rails"
|
14
|
+
autoload :Sidekiq, "labkit/tracing/sidekiq"
|
15
|
+
|
16
|
+
# Tracing is only enabled when the `GITLAB_TRACING` env var is configured.
|
29
17
|
def self.enabled?
|
30
18
|
connection_string.present?
|
31
19
|
end
|
32
20
|
|
33
21
|
def self.connection_string
|
34
|
-
ENV[
|
22
|
+
ENV["GITLAB_TRACING"]
|
35
23
|
end
|
36
24
|
|
37
25
|
def self.tracing_url_template
|
38
|
-
ENV[
|
26
|
+
ENV["GITLAB_TRACING_URL"]
|
39
27
|
end
|
40
28
|
|
41
29
|
def self.tracing_url_enabled?
|
@@ -51,7 +39,9 @@ module Labkit
|
|
51
39
|
|
52
40
|
# Avoid using `format` since it can throw TypeErrors
|
53
41
|
# which we want to avoid on unsanitised env var input
|
54
|
-
tracing_url_template.to_s
|
42
|
+
tracing_url_template.to_s
|
43
|
+
.gsub("{{ correlation_id }}", correlation_id)
|
44
|
+
.gsub("{{ service }}", service_name)
|
55
45
|
end
|
56
46
|
end
|
57
47
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "opentracing"
|
4
4
|
|
5
5
|
module Labkit
|
6
6
|
module Tracing
|
7
|
+
# Common is a mixin for various distributed tracing instrumentation
|
7
8
|
module Common
|
8
9
|
def tracer
|
9
10
|
OpenTracing.global_tracer
|
@@ -16,7 +17,7 @@ module Labkit
|
|
16
17
|
|
17
18
|
# Add correlation details to the span if we have them
|
18
19
|
correlation_id = Labkit::Correlation::CorrelationId.current_id
|
19
|
-
span.set_tag(
|
20
|
+
span.set_tag("correlation_id", correlation_id) if correlation_id
|
20
21
|
|
21
22
|
begin
|
22
23
|
yield span
|
@@ -37,7 +38,7 @@ module Labkit
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def log_exception_on_span(span, exception)
|
40
|
-
span.set_tag(
|
41
|
+
span.set_tag("error", true)
|
41
42
|
span.log_kv(kv_tags_for_exception(exception))
|
42
43
|
end
|
43
44
|
|
@@ -45,13 +46,13 @@ module Labkit
|
|
45
46
|
case exception
|
46
47
|
when Exception
|
47
48
|
{
|
48
|
-
:"event" =>
|
49
|
+
:"event" => "error",
|
49
50
|
:"error.kind" => exception.class.to_s,
|
50
51
|
:"message" => Labkit::Logging::Sanitizer.sanitize_field(exception.message),
|
51
|
-
:"stack" => exception.backtrace&.join('\n')
|
52
|
+
:"stack" => exception.backtrace&.join('\n'),
|
52
53
|
}
|
53
54
|
else
|
54
|
-
{ :"event" =>
|
55
|
+
{ :"event" => "error", :"error.kind" => exception.class.to_s, :"error.object" => Labkit::Logging::Sanitizer.sanitize_field(exception.to_s) }
|
55
56
|
end
|
56
57
|
end
|
57
58
|
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "cgi"
|
4
4
|
|
5
5
|
module Labkit
|
6
6
|
module Tracing
|
7
|
+
# Factory provides tools for setting up and configuring the
|
8
|
+
# distributed tracing system within the process, given the
|
9
|
+
# tracing connection string
|
7
10
|
class Factory
|
8
|
-
OPENTRACING_SCHEME =
|
11
|
+
OPENTRACING_SCHEME = "opentracing"
|
9
12
|
|
10
13
|
def self.create_tracer(service_name, connection_string)
|
11
14
|
return unless connection_string.present?
|
@@ -15,7 +18,7 @@ module Labkit
|
|
15
18
|
driver_name = opentracing_details[:driver_name]
|
16
19
|
|
17
20
|
case driver_name
|
18
|
-
when
|
21
|
+
when "jaeger"
|
19
22
|
JaegerFactory.create_tracer(service_name, opentracing_details[:options])
|
20
23
|
else
|
21
24
|
raise "Unknown driver: #{driver_name}"
|
@@ -31,7 +34,7 @@ module Labkit
|
|
31
34
|
def self.parse_connection_string(connection_string)
|
32
35
|
parsed = URI.parse(connection_string)
|
33
36
|
|
34
|
-
raise
|
37
|
+
raise "Invalid tracing connection string" unless valid_uri?(parsed)
|
35
38
|
|
36
39
|
{ driver_name: parsed.host, options: parse_query(parsed.query) }
|
37
40
|
end
|
@@ -1,34 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require
|
3
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
4
|
+
require "opentracing"
|
5
|
+
require "grpc"
|
5
6
|
|
6
7
|
module Labkit
|
7
8
|
module Tracing
|
9
|
+
# GRPCInterceptor is a client-side GRPC interceptor
|
10
|
+
# for instrumenting GRPC calls with distributed tracing
|
8
11
|
class GRPCInterceptor < GRPC::ClientInterceptor
|
9
12
|
include Common
|
10
13
|
include Singleton
|
11
14
|
|
12
15
|
def request_response(request:, call:, method:, metadata:)
|
13
|
-
wrap_with_tracing(method,
|
16
|
+
wrap_with_tracing(method, "unary", metadata) { yield }
|
14
17
|
end
|
15
18
|
|
16
19
|
def client_streamer(requests:, call:, method:, metadata:)
|
17
|
-
wrap_with_tracing(method,
|
20
|
+
wrap_with_tracing(method, "client_stream", metadata) { yield }
|
18
21
|
end
|
19
22
|
|
20
23
|
def server_streamer(request:, call:, method:, metadata:)
|
21
|
-
wrap_with_tracing(method,
|
24
|
+
wrap_with_tracing(method, "server_stream", metadata) { yield }
|
22
25
|
end
|
23
26
|
|
24
27
|
def bidi_streamer(requests:, call:, method:, metadata:)
|
25
|
-
wrap_with_tracing(method,
|
28
|
+
wrap_with_tracing(method, "bidi_stream", metadata) { yield }
|
26
29
|
end
|
27
30
|
|
28
31
|
private
|
29
32
|
|
30
33
|
def wrap_with_tracing(method, grpc_type, metadata)
|
31
|
-
tags = {
|
34
|
+
tags = { "component" => "grpc", "span.kind" => "client", "grpc.method" => method, "grpc.type" => grpc_type }
|
32
35
|
|
33
36
|
in_tracing_span(operation_name: "grpc:#{method}", tags: tags) do |span|
|
34
37
|
OpenTracing.inject(span.context, OpenTracing::FORMAT_TEXT_MAP, metadata)
|
@@ -39,3 +42,5 @@ module Labkit
|
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
45
|
+
|
46
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "jaeger/client"
|
4
4
|
|
5
5
|
module Labkit
|
6
6
|
module Tracing
|
7
|
+
# JaegerFactory will configure Jaeger distributed tracing
|
7
8
|
class JaegerFactory
|
8
9
|
# When the probabilistic sampler is used, by default 0.1% of requests will be traced
|
9
10
|
DEFAULT_PROBABILISTIC_RATE = 0.001
|
@@ -21,13 +22,12 @@ module Labkit
|
|
21
22
|
kwargs = {
|
22
23
|
service_name: service_name,
|
23
24
|
sampler: get_sampler(options[:sampler], options[:sampler_param]),
|
24
|
-
reporter: get_reporter(service_name, options[:http_endpoint], options[:udp_endpoint])
|
25
|
-
}
|
26
|
-
.compact
|
25
|
+
reporter: get_reporter(service_name, options[:http_endpoint], options[:udp_endpoint]),
|
26
|
+
}.compact
|
27
27
|
|
28
28
|
extra_params = options.except(:sampler, :sampler_param, :http_endpoint, :udp_endpoint, :strict_parsing, :debug)
|
29
29
|
if extra_params.present?
|
30
|
-
message = "jaeger tracer: invalid option: #{extra_params.keys.join(
|
30
|
+
message = "jaeger tracer: invalid option: #{extra_params.keys.join(", ")}"
|
31
31
|
|
32
32
|
raise message if options[:strict_parsing]
|
33
33
|
|
@@ -39,11 +39,11 @@ module Labkit
|
|
39
39
|
|
40
40
|
def self.get_sampler(sampler_type, sampler_param)
|
41
41
|
case sampler_type
|
42
|
-
when
|
42
|
+
when "probabilistic"
|
43
43
|
sampler_rate = sampler_param ? sampler_param.to_f : DEFAULT_PROBABILISTIC_RATE
|
44
44
|
Jaeger::Samplers::Probabilistic.new(rate: sampler_rate)
|
45
|
-
when
|
46
|
-
const_value = sampler_param ==
|
45
|
+
when "const"
|
46
|
+
const_value = sampler_param == "1"
|
47
47
|
Jaeger::Samplers::Const.new(const_value)
|
48
48
|
end
|
49
49
|
end
|
@@ -70,7 +70,7 @@ module Labkit
|
|
70
70
|
private_class_method :get_http_sender
|
71
71
|
|
72
72
|
def self.get_udp_sender(encoder, address)
|
73
|
-
pair = address.split(
|
73
|
+
pair = address.split(":", 2)
|
74
74
|
host = pair[0]
|
75
75
|
port = pair[1] ? pair[1].to_i : DEFAULT_UDP_PORT
|
76
76
|
|
@@ -1,15 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "opentracing"
|
4
|
+
require "active_support/all"
|
5
|
+
require "action_dispatch"
|
6
6
|
|
7
7
|
module Labkit
|
8
8
|
module Tracing
|
9
|
+
# RackMiddleware is a rack middleware component for
|
10
|
+
# instrumenting incoming http requests into a Rails/Rack
|
11
|
+
# server
|
9
12
|
class RackMiddleware
|
10
13
|
include Common
|
11
14
|
|
12
|
-
REQUEST_METHOD =
|
15
|
+
REQUEST_METHOD = "REQUEST_METHOD"
|
13
16
|
|
14
17
|
def initialize(app)
|
15
18
|
@app = app
|
@@ -19,10 +22,10 @@ module Labkit
|
|
19
22
|
method = env[REQUEST_METHOD]
|
20
23
|
|
21
24
|
context = tracer.extract(OpenTracing::FORMAT_RACK, env)
|
22
|
-
tags = {
|
25
|
+
tags = { "component" => "rack", "span.kind" => "server", "http.method" => method, "http.url" => self.class.build_sanitized_url_from_env(env) }
|
23
26
|
|
24
27
|
in_tracing_span(operation_name: "http:#{method}", child_of: context, tags: tags) do |span|
|
25
|
-
@app.call(env).tap { |status_code, _headers, _body| span.set_tag(
|
28
|
+
@app.call(env).tap { |status_code, _headers, _body| span.set_tag("http.status_code", status_code) }
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Labkit
|
4
|
+
module Tracing
|
5
|
+
# Rails provides classes for instrumenting Rails events
|
6
|
+
module Rails
|
7
|
+
autoload :ActionViewSubscriber, "labkit/tracing/rails/action_view_subscriber"
|
8
|
+
autoload :ActiveRecordSubscriber, "labkit/tracing/rails/active_record_subscriber"
|
9
|
+
autoload :RailsCommon, "labkit/tracing/rails/rails_common"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -3,13 +3,15 @@
|
|
3
3
|
module Labkit
|
4
4
|
module Tracing
|
5
5
|
module Rails
|
6
|
+
# ActionViewSubscriber bridges action view notifications to
|
7
|
+
# the distributed tracing subsystem
|
6
8
|
class ActionViewSubscriber
|
7
9
|
include RailsCommon
|
8
10
|
|
9
|
-
COMPONENT_TAG =
|
10
|
-
RENDER_TEMPLATE_NOTIFICATION_TOPIC =
|
11
|
-
RENDER_COLLECTION_NOTIFICATION_TOPIC =
|
12
|
-
RENDER_PARTIAL_NOTIFICATION_TOPIC =
|
11
|
+
COMPONENT_TAG = "ActionView"
|
12
|
+
RENDER_TEMPLATE_NOTIFICATION_TOPIC = "render_template.action_view"
|
13
|
+
RENDER_COLLECTION_NOTIFICATION_TOPIC = "render_collection.action_view"
|
14
|
+
RENDER_PARTIAL_NOTIFICATION_TOPIC = "render_partial.action_view"
|
13
15
|
|
14
16
|
# Instruments Rails ActionView events for opentracing.
|
15
17
|
# Returns a lambda, which, when called will unsubscribe from the notifications
|
@@ -25,7 +27,7 @@ module Labkit
|
|
25
27
|
end,
|
26
28
|
ActiveSupport::Notifications.subscribe(RENDER_PARTIAL_NOTIFICATION_TOPIC) do |_, start, finish, _, payload|
|
27
29
|
subscriber.notify_render_partial(start, finish, payload)
|
28
|
-
end
|
30
|
+
end,
|
29
31
|
]
|
30
32
|
|
31
33
|
create_unsubscriber subscriptions
|
@@ -33,34 +35,34 @@ module Labkit
|
|
33
35
|
|
34
36
|
# For more information on the payloads: https://guides.rubyonrails.org/active_support_instrumentation.html
|
35
37
|
def notify_render_template(start, finish, payload)
|
36
|
-
generate_span_for_notification(
|
38
|
+
generate_span_for_notification("render_template", start, finish, payload, tags_for_render_template(payload))
|
37
39
|
end
|
38
40
|
|
39
41
|
def notify_render_collection(start, finish, payload)
|
40
|
-
generate_span_for_notification(
|
42
|
+
generate_span_for_notification("render_collection", start, finish, payload, tags_for_render_collection(payload))
|
41
43
|
end
|
42
44
|
|
43
45
|
def notify_render_partial(start, finish, payload)
|
44
|
-
generate_span_for_notification(
|
46
|
+
generate_span_for_notification("render_partial", start, finish, payload, tags_for_render_partial(payload))
|
45
47
|
end
|
46
48
|
|
47
49
|
private
|
48
50
|
|
49
51
|
def tags_for_render_template(payload)
|
50
|
-
{
|
52
|
+
{ "component" => COMPONENT_TAG, "template.id" => payload[:identifier], "template.layout" => payload[:layout] }
|
51
53
|
end
|
52
54
|
|
53
55
|
def tags_for_render_collection(payload)
|
54
56
|
{
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
"component" => COMPONENT_TAG,
|
58
|
+
"template.id" => payload[:identifier],
|
59
|
+
"template.count" => payload[:count] || 0,
|
60
|
+
"template.cache.hits" => payload[:cache_hits] || 0,
|
59
61
|
}
|
60
62
|
end
|
61
63
|
|
62
64
|
def tags_for_render_partial(payload)
|
63
|
-
{
|
65
|
+
{ "component" => COMPONENT_TAG, "template.id" => payload[:identifier] }
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|
@@ -3,12 +3,14 @@
|
|
3
3
|
module Labkit
|
4
4
|
module Tracing
|
5
5
|
module Rails
|
6
|
+
# ActiveRecordSubscriber bridges active record notifications to
|
7
|
+
# the distributed tracing subsystem
|
6
8
|
class ActiveRecordSubscriber
|
7
9
|
include RailsCommon
|
8
10
|
|
9
|
-
ACTIVE_RECORD_NOTIFICATION_TOPIC =
|
10
|
-
OPERATION_NAME_PREFIX =
|
11
|
-
DEFAULT_OPERATION_NAME =
|
11
|
+
ACTIVE_RECORD_NOTIFICATION_TOPIC = "sql.active_record"
|
12
|
+
OPERATION_NAME_PREFIX = "active_record:"
|
13
|
+
DEFAULT_OPERATION_NAME = "sqlquery"
|
12
14
|
|
13
15
|
# Instruments Rails ActiveRecord events for opentracing.
|
14
16
|
# Returns a lambda, which, when called will unsubscribe from the notifications
|
@@ -36,12 +38,12 @@ module Labkit
|
|
36
38
|
|
37
39
|
def tags_for_notification(payload)
|
38
40
|
{
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
"component" => "ActiveRecord",
|
42
|
+
"span.kind" => "client",
|
43
|
+
"db.type" => "sql",
|
44
|
+
"db.connection_id" => payload[:connection_id],
|
45
|
+
"db.cached" => payload[:cached] || false,
|
46
|
+
"db.statement" => payload[:sql],
|
45
47
|
}
|
46
48
|
end
|
47
49
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "active_support/all"
|
4
4
|
|
5
5
|
module Labkit
|
6
6
|
module Tracing
|
7
7
|
module Rails
|
8
|
+
# RailsCommon is a mixin for providing instrumentation
|
9
|
+
# functionality for the rails instrumentation classes
|
8
10
|
module RailsCommon
|
9
11
|
extend ActiveSupport::Concern
|
10
12
|
include Labkit::Tracing::Common
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Labkit
|
4
|
+
module Tracing
|
5
|
+
# Sidekiq provides classes for instrumenting Sidekiq client and server
|
6
|
+
# functionality
|
7
|
+
module Sidekiq
|
8
|
+
autoload :ClientMiddleware, "labkit/tracing/sidekiq/client_middleware"
|
9
|
+
autoload :ServerMiddleware, "labkit/tracing/sidekiq/server_middleware"
|
10
|
+
autoload :SidekiqCommon, "labkit/tracing/sidekiq/sidekiq_common"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,17 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "opentracing"
|
4
4
|
|
5
5
|
module Labkit
|
6
6
|
module Tracing
|
7
7
|
module Sidekiq
|
8
|
+
# ClientMiddleware provides a sidekiq client middleware for
|
9
|
+
# instrumenting distributed tracing calls made from the client
|
10
|
+
# application
|
8
11
|
class ClientMiddleware
|
9
12
|
include SidekiqCommon
|
10
13
|
|
11
|
-
SPAN_KIND =
|
14
|
+
SPAN_KIND = "client"
|
12
15
|
|
13
|
-
def call(
|
14
|
-
in_tracing_span(operation_name: "sidekiq:#{job[
|
16
|
+
def call(_worker_class, job, _queue, _redis_pool)
|
17
|
+
in_tracing_span(operation_name: "sidekiq:#{job["class"]}", tags: tags_from_job(job, SPAN_KIND)) do |span|
|
15
18
|
# Inject the details directly into the job
|
16
19
|
tracer
|
17
20
|
.inject(span.context, OpenTracing::FORMAT_TEXT_MAP, job)
|
@@ -1,19 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "opentracing"
|
4
4
|
|
5
5
|
module Labkit
|
6
6
|
module Tracing
|
7
7
|
module Sidekiq
|
8
|
+
# ServerMiddleware provides a sidekiq server middleware for
|
9
|
+
# instrumenting distributed tracing calls when they are
|
10
|
+
# executed by the Sidekiq server
|
8
11
|
class ServerMiddleware
|
9
12
|
include SidekiqCommon
|
10
13
|
|
11
|
-
SPAN_KIND =
|
14
|
+
SPAN_KIND = "server"
|
12
15
|
|
13
|
-
def call(
|
16
|
+
def call(_worker, job, _queue)
|
14
17
|
context = tracer.extract(OpenTracing::FORMAT_TEXT_MAP, job)
|
15
18
|
|
16
|
-
in_tracing_span(operation_name: "sidekiq:#{job[
|
19
|
+
in_tracing_span(operation_name: "sidekiq:#{job["class"]}", child_of: context, tags: tags_from_job(job, SPAN_KIND)) { |_span| yield }
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
@@ -3,17 +3,18 @@
|
|
3
3
|
module Labkit
|
4
4
|
module Tracing
|
5
5
|
module Sidekiq
|
6
|
+
# SidekiqCommon is a mixin for the sidekiq middleware components
|
6
7
|
module SidekiqCommon
|
7
8
|
include Labkit::Tracing::Common
|
8
9
|
|
9
10
|
def tags_from_job(job, kind)
|
10
11
|
{
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
"component" => "sidekiq",
|
13
|
+
"span.kind" => kind,
|
14
|
+
"sidekiq.queue" => job["queue"],
|
15
|
+
"sidekiq.jid" => job["jid"],
|
16
|
+
"sidekiq.retry" => job["retry"].to_s,
|
17
|
+
"sidekiq.args" => job["args"]&.join(", "),
|
17
18
|
}
|
18
19
|
end
|
19
20
|
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.0.
|
4
|
+
version: 0.1.0.pre.1.pre.gcb57c95
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Newdigate
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.4'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: gitlab-styles
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.4'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2.4'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: rack
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +142,14 @@ dependencies:
|
|
156
142
|
requirements:
|
157
143
|
- - "~>"
|
158
144
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
145
|
+
version: 0.65.0
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
150
|
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
152
|
+
version: 0.65.0
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: rubocop-rspec
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +164,20 @@ dependencies:
|
|
178
164
|
- - "~>"
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: 1.22.1
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rufo
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.5'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.5'
|
181
181
|
description:
|
182
182
|
email:
|
183
183
|
- andrew@gitlab.com
|
@@ -187,11 +187,13 @@ extra_rdoc_files: []
|
|
187
187
|
files:
|
188
188
|
- ".gitignore"
|
189
189
|
- ".gitlab-ci.yml"
|
190
|
-
- ".prettierrc"
|
191
190
|
- ".rspec"
|
192
191
|
- ".rubocop.yml"
|
193
192
|
- ".ruby-version"
|
193
|
+
- ".rufo"
|
194
194
|
- Gemfile
|
195
|
+
- LICENSE
|
196
|
+
- README.md
|
195
197
|
- Rakefile
|
196
198
|
- gitlab-labkit.gemspec
|
197
199
|
- lib/gitlab-labkit.rb
|
@@ -205,14 +207,14 @@ files:
|
|
205
207
|
- lib/labkit/tracing/grpc_interceptor.rb
|
206
208
|
- lib/labkit/tracing/jaeger_factory.rb
|
207
209
|
- lib/labkit/tracing/rack_middleware.rb
|
210
|
+
- lib/labkit/tracing/rails.rb
|
208
211
|
- lib/labkit/tracing/rails/action_view_subscriber.rb
|
209
212
|
- lib/labkit/tracing/rails/active_record_subscriber.rb
|
210
213
|
- lib/labkit/tracing/rails/rails_common.rb
|
214
|
+
- lib/labkit/tracing/sidekiq.rb
|
211
215
|
- lib/labkit/tracing/sidekiq/client_middleware.rb
|
212
216
|
- lib/labkit/tracing/sidekiq/server_middleware.rb
|
213
217
|
- lib/labkit/tracing/sidekiq/sidekiq_common.rb
|
214
|
-
- package-lock.json
|
215
|
-
- package.json
|
216
218
|
homepage: http://about.gitlab.com
|
217
219
|
licenses:
|
218
220
|
- MIT
|
@@ -225,12 +227,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
227
|
requirements:
|
226
228
|
- - ">="
|
227
229
|
- !ruby/object:Gem::Version
|
228
|
-
version: 2.
|
230
|
+
version: 2.4.0
|
229
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
232
|
requirements:
|
231
|
-
- - "
|
233
|
+
- - ">"
|
232
234
|
- !ruby/object:Gem::Version
|
233
|
-
version:
|
235
|
+
version: 1.3.1
|
234
236
|
requirements: []
|
235
237
|
rubyforge_project:
|
236
238
|
rubygems_version: 2.7.8
|
data/.prettierrc
DELETED
data/package-lock.json
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "labkit-ruby",
|
3
|
-
"requires": true,
|
4
|
-
"lockfileVersion": 1,
|
5
|
-
"dependencies": {
|
6
|
-
"@prettier/plugin-ruby": {
|
7
|
-
"version": "0.5.1",
|
8
|
-
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-0.5.1.tgz",
|
9
|
-
"integrity": "sha512-i5vcRvswNc0FhR41CnKCIy4hIztXDJb99vFavn/4cDeSk9Gu2OYnorDCpgjSVnu8l7go2P4na+Rws3qoxrX09A==",
|
10
|
-
"dev": true,
|
11
|
-
"requires": {
|
12
|
-
"prettier": "^1.16.4"
|
13
|
-
}
|
14
|
-
},
|
15
|
-
"prettier": {
|
16
|
-
"version": "1.16.4",
|
17
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.16.4.tgz",
|
18
|
-
"integrity": "sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==",
|
19
|
-
"dev": true
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|